how to install mongodb-c driver in ubuntu and use in coturn server - mongodb

i am using coturn and i want to use mongodb as a database
when i run the turnserver it shows
SQLite supported, default database location is /var/lib/turn/turndb
0: Redis supported
0: PostgreSQL supported
0: MySQL supported
0: MongoDB is not supported
0:
0: Default Net Engine version: 3 (UDP thread per CPU core)
i have installed coturn
using this command
sudo apt-get install coturn
and the coturn docs says
mongo-c-driver packages are not available "automatically". MongoDB
support will not be compiled, unless you install it "manually" before
the TURN server compilation. Refer to
https://github.com/mongodb/mongo-c-driver for installation
instructions of the driver.
and tried to install mongo c driver by following this guide
Install libmongoc with a Package Manager
apt-get install libmongoc-1.0-0
Build environment on Unix
On Debian / Ubuntu:
$ sudo apt-get install cmake libssl-dev libsasl2-dev
Configuring the build
Preparing a build from a git repository clone
$ git clone https://github.com/mongodb/mongo-c-driver.git
$ cd mongo-c-driver
$ git checkout 1.17.0 # To build a particular release
$ python build/calc_release_version.py > VERSION_CURRENT
$ mkdir cmake-build
$ cd cmake-build
$ cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
Executing a build
Building on Unix, macOS, and Windows (MinGW-W64 and MSYS2)ΒΆ
$ cmake --build .
$ sudo cmake --build . --target install
and
~/mongo-c-driver/cmake-build$cmake --build . help
returned
Unknown argument help
Usage: cmake --build <dir> [options] [-- [native-options]]
Options:
<dir> = Project binary directory to be built.
--target <tgt> = Build <tgt> instead of default targets.
May only be specified once.
--config <cfg> = For multi-configuration tools, choose <cfg>.
--clean-first = Build target 'clean' first, then build.
(To clean only, use --target 'clean'.)
--use-stderr = Ignored. Behavior is default in CMake >= 3.0.
-- = Pass remaining options to the native tool.
and
Generating the documentation
cmake -DENABLE_MAN_PAGES=ON -DENABLE_HTML_DOCS=ON ..
returned
-- No CMAKE_BUILD_TYPE selected, defaulting to RelWithDebInfo
file VERSION_CURRENT contained BUILD_VERSION 1.17.0
-- Build and install static libraries
-- Using bundled libbson
libbson version (from VERSION_CURRENT file): 1.17.0
-- struct timespec found
Adding -fPIC to compilation of bson_static components
CMake Error at CMakeLists.txt:10 (_message):
Could NOT find Sphinx (missing: SPHINX_EXECUTABLE)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message)
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
build/cmake/FindSphinx.cmake:10 (find_package_handle_standard_args)
src/libbson/CMakeLists.txt:444 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/user/mongo-c-driver/cmake-build/CMakeFiles/CMakeOutput.log".
See also "/home/user/mongo-c-driver/cmake-build/CMakeFiles/CMakeError.log".
cmake --build . --target mongoc-doc
make: *** No rule to make target 'mongoc-doc'. Stop.
and when i restart the coturn server it still shows that mongodb is not supported
how can i resolve this issue

sudo apt-get install python3-sphinx

Related

How can I use a recent version of GCC in GitHub CI?

I have a C++ project on GitHub with which I use GitHub CI. My workflow is configured to run on Linux and Windows through the strategy property:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
This has worked well for me so far, with Cmake identifying the compiler as GNU 9.3.0. However, I would now like to use an experimental feature added in GCC 10 in my project, and so my build fails due to the old compiler version.
How can I use a more recent version of GCC from my GitHub CI workflow?
For the linux build you can use the following build step to switch the default gcc to gcc-10.
- name: switch to gcc-10 on linux
if: matrix.configurations.os == "ubuntu-latest"
run: |
sudo apt install gcc-10 g++-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
sudo update-alternatives --set gcc /usr/bin/gcc-10
The first 2 lines in the script should be optional, as gcc-10 is already installed in ubuntu-latest. But it doesn't hurt much to have them there and it might help to make clear what is happening and how to reproduce the build locally.
You can check the manpage for update-alternatives if you are interested how this works.
windows-latest uses visual-studio as it's default compiler, but since you only asked about gcc I suppose that it already supports the c++ features you are using?
#wirew0rm posted an excellent answer, which works very well generically. It's useful to note that one is allowed to use sudo on the GitHub CI runners, and so one simply needs to install the desired packages:
sudo apt install gcc-10 g++-10
# or
sudo apt install gcc-11 g++-11
# or, for very recent Clang:
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 12
sudo apt-get install libc++-12-dev libc++abi-12-dev
Then, because I was using CMake, I could set the CXX environment variable instead of using sudo update-alternatives:
echo "CXX=g++-10" >> $GITHUB_ENV
The subsequent CMake configure step would then select g++-10 as the C++ compiler.

How to build and install wal2json without also installing the package postgresql-server-dev on Debian 9?

I'm trying to stream data automatically from PostgreSQL 10 to Kafka using debezium together with the logical decoding plugin, wal2json.
I followed all the instructions on how to build and install the plugin from this link by running these command lines:
$ git clone https://github.com/eulerto/wal2json.git
$ cd wal2json
$ PATH=/usr/lib/postgresql/10/bin:$PATH
$ USE_PGXS=1 make
$ USE_PGXS=1 sudo make install
Yet, the steps for installation include this command line: USE_PGXS=1 make and it requires the installation of this package
sudo apt-get install postgresql-server-dev-10
else, I get the following error
Makefile:10: /usr/lib/postgresql/11/lib/pgxs/src/makefiles/pgxs.mk: No such file or directory
make: *** No rule to make target '/usr/lib/postgresql/11/lib/pgxs/src/makefiles/pgxs.mk'. Stop.
In fact, I am not allowed to install the package postgresql-server-dev-10 for personal reasons.
Thus, is there any way to install wal2json without installing that package or without using the command make?
Thank you.

Setting up a Movesense development environment on Linux

I followed an instruction to set up a Movesense development environment, "Manual setup on Linux", from Suunto / Movesense-community / Movesense-device-lib, README.md
However, I got stuck at sudo apt-get install gcc-arm-embedded:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package gcc-arm-embedded
How can I move forward?
I used Ubuntu 17.10 (Artful Aardvark) as a guest OS.
Try adding the repository:
sudo apt-get remove gcc-arm-none-eabi gdb-arm-none-eabi binutils-arm-none-eabi
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
I downloaded it directly from ARM IIRC:
https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads
Following the instructions under "GNU/Linux" in the "GNU ARM Embedded Toolchain" section of
https://gnu-mcu-eclipse.github.io/toolchain/arm/install/#gnu-arm-embedded-toolchain
Summarized:
// Get some support dependencies for 32 bit running on 64-bit machines
// Check toolchain README for actual list.
$ sudo apt-get -y install lib32z1 lib32ncurses5 lib32bz2-1.0
// Install the toolchain
$ mkdir -p "${HOME}"/opt
$ cd "${HOME}"/opt
$ tar xjf ~/Downloads/gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2
$ chmod -R -w "${HOME}"/opt/gcc-arm-none-eabi-7-2017-q4-major
You will likely have to modify some of the build files in the Movesense project to point to this location for it to build.
The following might also be helpful: How to install a functional ARM cross-GCC toolchain on Ubuntu 18.04 (Bionic Beaver)
I had some trouble installing it on a Windows machine and tried out Vagrant. This makes the development environment highly movable and in sync if you have multiple developers working on the project.

Portable binaries with Rust

I have problems building a portable executable with rust.
Running an executable simply built with cargo build on Ubuntu fails with
./test: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by ./test)
Building with rustc ... -C link-args=-static fails to link correctly (output of ld ./test):
ld: error in ./test(.eh_frame); no .eh_frame_hdr table will be created.
Is there a way around this except building on an older system with an old glibc version?
Glibc is not linked statically (much as we might have liked to, it goes out of its way to prevent this). As a result, the system libraries (libstd and such) are always dependent on the glibc version on which they were built. This is why the buildbots in the linux cluster mozilla uses are/were old versions of centos.
See https://github.com/rust-lang/rust/issues/9545 and https://github.com/rust-lang/rust/issues/7283
Unfortunately at this time I believe there is no workaround aside from making sure you build on a system with an older glibc than you're going to deploy to.
To avoid GLIBC errors, you can compile your own version of Rust against a static alternative libc, musl.
Get the latest stable release of musl and build it with option --disable-shared:
$ mkdir musldist
$ PREFIX=$(pwd)/musldist
$ ./configure --disable-shared --prefix=$PREFIX
then build Rust against musl:
$ ./configure --target=x86_64-unknown-linux-musl --musl-root=$PREFIX --prefix=$PREFIX
then build your project
$ echo 'fn main() { println!("Hello, world!"); }' > main.rs
$ rustc --target=x86_64-unknown-linux-musl main.rs
$ ldd main
not a dynamic executable
For more information, look at the advanced linking section of the documentation.
As reported in the original documentation:
However, you may need to recompile your native libraries against musl
before they can be linked against.
You can also use rustup.
Remove old Rust installed by rustup.sh
$ sudo /usr/local/lib/rustlib/uninstall.sh # only if you have
$ rm $HOME/.rustup
Install rustup
$ curl https://sh.rustup.rs -sSf | sh
$ rustup default nightly #just for ubuntu 14.04 (stable Rust 1.11.0 has linking issue)
$ rustup target add x86_64-unknown-linux-musl
$ export PATH=$HOME/.cargo/bin:$PATH
$ cargo new --bin hello && cd hello
$ cargo run --target=x86_64-unknown-linux-musl
$ ldd target/x86_64-unknown-linux-musl/debug/hello
not a dynamic executable

Error "the PGXS Makefile cannot be found" when installing PostGis on Debian

I am in the process of installing PostGis over psql on a Debian machine (actually crunchbang).
I have completed the following steps:
$ wget http://download.osgeo.org/postgis/source/postgis-2.0.3.tar.gz
$ tar xzf postgis-2.0.3.tar.gz
$ cd postgis-2.0.3
$ ./configure
On the final step I get the following error:
configure: error: the PGXS Makefile /usr/lib/postgresql/9.1/lib/pgxs/src/makefiles/pgxs.mk cannot be found. Please install the PostgreSQL server development packages and re-run configure.
The issue is that I do already have Postgres installed:
$ psql --version
psql (9.1.9)
I have checked this on two machines with the same configuration and get the same error. What am I missing here?
PostgreSQL is broken down into several packages, and having psql installed doesn't imply that the development packages are also installed.
According to the error message:
Please install the PostgreSQL server development packages and re-run
configure
you need:
# apt-get install postgresql-server-dev-9.1
Also note there's a APT pgdg repository providing recent pre-compiled versions of postgres-related packages (including postgis) that you may use instead of self-compiling.
If your system is set up to use this repository, just do:
# apt-get install postgresql-9.1-postgis-2.0
Daniel's answer works great except that it needs the following update:
$ sudo apt-get install postgresql-9.1-postgis-2.1
These packages can be updated some time in future again. So, it is recommended to search for new packages using aptitude and install the appropriate one:
$ aptitude search postgis