【问题标题】:Can't figure out how to link C++ package I want to compile to a library无法弄清楚如何将我要编译的 C++ 包链接到库
【发布时间】:2021-09-20 10:51:21
【问题描述】:

我想编译依赖于libmaus2 库的biobambam2 包。两者都是一个目录中的单独文件夹。我编译了 libmaus2 并且 libmaus2.pc 文件在它的基本目录中。现在,如果我尝试使用此命令编译 biobambam2:

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

我收到以下错误:

...
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.

如果我尝试像这样手动设置 PKG_CONFIG_PATH 变量:

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

错误如下所示:

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

谁能告诉我如何解决这个问题?我已经坚持了好几个小时了。

【问题讨论】:

  • 示例:1./configure PKG_CONFIG_PATH=..... --prefix 和其他选项。 ......... ...... 2export PKG_CONFIG_LIBDIR=[path-to-directory-with-libmaus2.pc]
  • 这不起作用
  • 我正在尝试以 Ubuntu 18.04 映像为基础配置 Docker。
  • 我手动编辑了 libmaus2.pc 文件,它似乎工作正常。非常感谢。我现在正在重新编译,如果您想发布问题的解决方案,我会尽快回复您。
  • 您的设置异常。默认构建目录是 /home/name/tmp/,如果将 libmaus2 配置为 --prefix=/usr/ --libdir=/usr/lib/x86_64-linux-gnu,则构建 biobambam2 完全没有问题。

标签: c++ linux makefile configure


【解决方案1】:

Ubuntu 18.04 示例:内置于 /home/name/tmp/

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

从 Ubuntu 20.04 https://packages.ubuntu.com/focal/libdeflate-dev 下载 → sudo gdebi libdeflate0_1.5-3_amd64.deb && sudo gdebi libdeflate-dev_1.5-3_amd64.deb

安装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

没有错误。

【讨论】:

    猜你喜欢
    • 2013-11-05
    • 2020-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多