Wrapper compilation doesn't prioritize repository includes
Created by: Zaharid
I think this is the root cause of #127 (closed).
If I try to compile the wrapper, the underlying SWIG command is:
cd /home/zah/nngit/nnpdf/nd/libnnpdf/wrapper && /home/zah/anaconda3/bin/swig3.0 -python -outdir /home/zah/nngit/nnpdf/nd/libnnpdf/wrapper -c++ -I/home/zah/nngit/nnpdf/libnnpdf/src/NNPDF -I/home/zah/anaconda3/envs/nnpdf-dev/include -I/home/zah/nngit/nnpdf/libnnpdf/include -I/home/zah/anaconda3/envs/nnpdf-dev/lib/python3.6/site-packages/numpy/core/include -I/home/zah/anaconda3/envs/nnpdf-dev/include/python3.6m -I/home/zah/nngit/nnpdf/libnnpdf/wrapper/../src -o /home/zah/nngit/nnpdf/nd/libnnpdf/wrapper/nnpdfPYTHON_wrap.cxx /home/zah/nngit/nnpdf/libnnpdf/wrapper/src/nnpdf.i
If I corrupt the NNPDF/utils.h
that I have in my path, from a previous installation, I get an error:
/home/zah/anaconda3/envs/nnpdf-dev/include/NNPDF/utils.h:29: Error: Syntax error in input(1).
that I shouldn't b seeing because it should be looking first at the source includes, rather than at the installed headers.
I note that the first include in the command above:
-I/home/zah/nngit/nnpdf/libnnpdf/src/NNPDF
is wrong, as it should be -I/home/zah/nngit/nnpdf/libnnpdf/src
. And indeed it works when I execute the command manually with that change.
Incidentally, the generation of the cxx file (i.e. the SWIG command) works fine in the old libnnpdf repository, but the compilation subsequently fails because then it starts looking at the installed headers first. This also happens here:
cd /home/zah/nngit/nnpdf/nd/libnnpdf/wrapper && /home/zah/anaconda3/envs/nnpdf-dev/bin/x86_64-conda_cos6-linux-gnu-c++ -DDEFAULT_NNPDF_PROFILE_PATH=\"/usr/local/share/NNPDF/nnprofile.yaml\" -D_nnpdf_EXPORTS -I/home/zah/nngit/nnpdf/libnnpdf/src/NNPDF -I/home/zah/anaconda3/envs/nnpdf-dev/include -I/home/zah/nngit/nnpdf/libnnpdf/include -I/home/zah/anaconda3/envs/nnpdf-dev/lib/python3.6/site-packages/numpy/core/include -I/home/zah/anaconda3/envs/nnpdf-dev/include/python3.6m -I/home/zah/nngit/nnpdf/libnnpdf/wrapper/../src -Wall -Wextra -march=nocona -mtune=haswell -fvisibility-inlines-hidden -fmessage-length=0 -ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -D_GLIBCXX_USE_CXX11_ABI=1 -I/home/zah/anaconda3/envs/nnpdf-dev/include -I/home/zah/anaconda3/envs/nnpdf-dev/include -I/home/zah/anaconda3/envs/nnpdf-dev/include -I/home/zah/anaconda3/envs/nnpdf-dev/include -I/home/zah/anaconda3/envs/nnpdf-dev/include -O3 -DNDEBUG -fPIC -std=c++14 -o CMakeFiles/_nnpdf.dir/nnpdfPYTHON_wrap.cxx.o -c /home/zah/nngit/nnpdf/nd/libnnpdf/wrapper/nnpdfPYTHON_wrap.cxx
and also works if I change manually the first include to be src
instead of src/NNPDF
.