Dear all,
I have been trying for the last few weeks to find a solution to my problem, without success.
Stack overflow and other venues are unresponsive.
I am trying to build locally (without uploading, for now), a set of packages, part of a suite for scientific data analysis. I am building the packages separately, as individual conda packages.
One of the (three) python packages has a C++ extension which requires gsl
and fftw3
libraries.
So I believe the correct procedure is to add g++
, gsl
and fftw3
as host
requirements
in the meta.yaml
file.
More precisely I am adding g++
as
- {{ compiler(‘cxx’) }} `
which I believe is some Jinja magic to work on different platform compilers.
Now, the problem.
If I install the package in the base environment I have no issue, and the system libraries for fftw3 and gsl are found and pointed to appropriately.
If I instead install it in a conda environment with its own C++ compiler and python, it fails finding the libraries.
I think the issue can be sorted in the main setup.py
:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy
import os
import sys
ext = Extension(
'balrog_tdi', ["cythfile.pyx"],
libraries=["myCfile", "gsl", "gslcblas", "fftw3"],
language="c++",
library_dirs=["lib", os.path.join(sys.prefix, 'lib')],
include_dirs=["lib", os.path.join(sys.prefix, 'include'),
numpy.get_include()]
)
However I never get to that stage, since before installing the package I need to compile some C libraries through make. That’s where I fail locating the correct lib
and 'include` folders with the following error:
(condabuild) 04:27 riccardo:~/Desktop/conda-folder/balrog-tdi-waveforms/lib $ make
g++ -g -c -Wall -Wno-class-memaccess -O3 -fPIC my_wrap.cpp -o my_wrap.o
In file included from Wrap.h:6,
from my_wrap.h:5,
from my_wrap.cpp:2:
Includes.h:10:10: fatal error: fftw3.h: No such file or directory
10 | #include <fftw3.h>
| ^~~~~~~~~
compilation terminated.
make: *** [Makefile:15: my_wrap.o] Error 1
Does anyone have any suggestion on how to point make
to the lib and include folders at build time using the conda build global variables? I suppose I can use some CFLAGS, but a working example would be extremely useful, as I am maintaining a library, but I am not an expert in its C++ segment.