Search code examples
c++linuxmakefileconfigure

Can't figure out how to link C++ package I want to compile to a library


I want to compile biobambam2 package which is dependent on libmaus2 library. Both are separate folders in one directory. I compiled libmaus2 and libmaus2.pc file is in its base directory. Now if I try to compile biobambam2 using this command:

- autoreconf -i -f
- ./configure --with-libmaus2=/SOFT/libmaus2-2.0.794-release-20210706224245 \
    --prefix=/SOFT/biobambam2-2.0.182-release-20210412001032
- make install

I get the following error:

...
configure: error: Package requirements (libmaus2 >= 2.0.774) were not met:

Package libmaus2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libmaus2.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libmaus2', required by 'world', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables libmaus2_CFLAGS
and libmaus2_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

If I try to manually set PKG_CONFIG_PATH variable like so:

autoreconf -i -f && \
export PKG_CONFIG_PATH="/SOFT/libmaus2-2.0.794-release-20210706224245/:$PKG_CONFIG_PATH" && \
./configure --prefix=/SOFT/biobambam2-2.0.182-release-20210412001032/ && \
make install

The error looks like this:

...
checking for libmaus2... yes
checking whether we can compile a program using libmaus2... no
configure: error: Required libmaus2 is not available.

Can anyone advise me on how to solve this? I've been stuck on this for hours.


Solution

  • Ubuntu 18.04 example : Build in /home/name/tmp/

    sudo apt install python3-pygments libsnappy-dev libgmp-dev

    Downloaded from Ubuntu 20.04 https://packages.ubuntu.com/focal/libdeflate-devsudo gdebi libdeflate0_1.5-3_amd64.deb && sudo gdebi libdeflate-dev_1.5-3_amd64.deb

    Installed gcc94-c++_9.4.0-9_amd64.deb https://drive.google.com/file/d/1xTbHe8ktjKR2gSmQ0Qcw0WEuMoKR8s_w/view?usp=sharingsudo gdebi gcc94-c++_9.4.0-9_amd64.deb

    git clone https://gitlab.com/german.tischler/libmaus2.git
    cd libmaus2/
    libtoolize && aclocal && autoheader && automake --add-missing && autoconf
    export CC=gcc94 CXX=g++94 && ./configure --prefix=/usr libdir=/usr/lib/x86_64-linux-gnu
    make
    sudo make install-strip
    

    git clone https://gitlab.com/german.tischler/biobambam2.git
    cd biobambam2/
    libtoolize && aclocal && autoheader && automake --add-missing && autoconf
    export CC=gcc94 CXX=g++94 && ./configure
    make
    sudo make install-strip
    

    No errors.