0

Let me explain the situation.

I compiled a c++ library using system g++ (under linux). Then built a cython module which calls a function in the pre-compiled library. Building the cython module was done under an anaconada venv (but no g++ installed inside the venv. Hence cython must had used system gcc/g++). Now under the same anaconda venv, importing the cython module results in an error as:

anaconda3/envs/hspy/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./libc_rd_halo.so).

It seems like the c library (libc_rd_halo.so) which was compiled by system g++ is now looking for an anaconda g++ library. And I don't have g++ installed in anaconda venv.


I can fix the problem by using anaconda g++ to compile the c library from the beginning. Build the cython module again, and then I can import the module. But I'd like to let anaconda cython use system compiler and look for the system compiler library when the module is being imported.

My questions are:

  1. why does anaconda cython look for a local anaconda g++ by default, but not the system compiler? any benefit doing so?

  2. How can I make anaconda cython look for system compiler library?

Hoseung Choi
  • 1,017
  • 2
  • 12
  • 20

1 Answers1

0
  1. why does anaconda cython look for a local anaconda g++ by default, but not the system compiler? any benefit doing so?

  2. How can I make anaconda cython look for system compiler library?

  1. Because libraries compiled with one version of GCC can only be linked with other libraries that were compiled with a compatible version of GCC, as you found out.

  2. You don't. Per above, binaries build with the system compiler may or may not work with other anaconda binaries built using the anaconda compiler.

If you want your binary to use system libraries then you need to make a system package, not an anaconda package. The system package will then only work on that system (and version of).

Community
  • 1
  • 1
danny
  • 5,140
  • 1
  • 19
  • 31