I am trying to install the fabric library to an old machine. There are some legacy libraries in /usr/lib, such as libgmp.
(py27)[qrtt1#hcservice app]$ ls /usr/lib|grep gmp
libgmp.a
libgmp.so
libgmp.so.3
libgmp.so.3.3.3
libgmpxx.a
libgmpxx.so
libgmpxx.so.3
libgmpxx.so.3.0.5
I have compiled the libgmp 5.x in my $HOME/app, and then am trying to install pycrypto (it is the dependency of fab):
CFLGAS=-I/home/qrtt1/app/include LDFLGAS=-L/home/qrtt1/app/lib pip install pycrypto
I observed that none of my include or lib directories are in the in the compilation / linking options:
gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/ -I/home/qrtt1/app/include/python2.7 -c src/_fastmath.c -o build/temp.linux-i686-2.7/src/_fastmath.o
gcc -pthread -shared build/temp.linux-i686-2.7/src/_fastmath.o -lgmp -o build/lib.linux-i686-2.7/Crypto/PublicKey/_fastmath.so
building 'Crypto.Hash._MD2' extension
gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/home/qrtt1/app/include/python2.7 -c src/MD2.c -o build/temp.linux-i686-2.7/src/MD2.o
gcc -pthread -shared build/temp.linux-i686-2.7/src/MD2.o -o build/lib.linux-i686-2.7/Crypto/Hash/_MD2.so
building 'Crypto.Hash._MD4' extension
gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/home/qrtt1/app/include/python2.7 -c src/MD4.c -o build/temp.linux-i686-2.7/src/MD4.o
gcc -pthread -shared build/temp.linux-i686-2.7/src/MD4.o -o build/lib.linux-i686-2.
How do I assign the CFLAGS and LDFLAGS correctly for building pycrypto ?
I try to download pycrypto-2.5 and install it:
(py27)[qrtt1#hcservice pycrypto-2.5]$ CFLGAS=-I/home/qrtt1/app/include LDFLGAS=-L/home/qrtt1/app/lib python setup.py install
No CFLAGS or LDFLAGS set up with it. May be the pycrypto-2.5 going wrong ?
Please check what you have typed :
CFLAGS=-I/home/qrtt1/app/include LDFLAGS=-L/home/qrtt1/app/lib pip install pycrypto
it should be CFLAGS
Related
I am using python 3.8 with a computation DLL written in C++ and using openmp to use all CPU's cores.
When I bench the C++ code it uses all the CPU's cores. But when I compile it as a DLL and use it from python, it only uses 1 core, like if Python was limiting the library to only use 1 core.
Here is my library compilation lines if I am doing something wrong:
g++ -O3 -Wall -c -fmessage-length=0 -fopenmp -pthread -o "src\\Environnement.o" "..\\src\\Environnement.cpp"
g++ -O3 -Wall -c -fmessage-length=0 -fopenmp -pthread -o "src\\LexicalAnalyser.o" "..\\src\\LexicalAnalyser.cpp"
g++ -O3 -Wall -c -fmessage-length=0 -fopenmp -pthread -o "src\\Fun.o" "..\\src\\Fun.cpp"
g++ -O3 -Wall -c -fmessage-length=0 -fopenmp -pthread -o "src\\lib.o" "..\\src\\lib.cpp"
g++ -O3 -Wall -c -fmessage-length=0 -fopenmp -pthread -o "src\\Status.o" "..\\src\\Status.cpp"
g++ -O3 -Wall -c -fmessage-length=0 -fopenmp -pthread -o "src\\Lexem.o" "..\\src\\Lexem.cpp"
g++ -shared -o libSyntaxicAnalyser.dll "src\\Environnement.o" "src\\Fun.o" "src\\Lexem.o" "src\\LexicalAnalyser.o" "src\\Status.o" "src\\Variable.o" "src\\lib.o" "D:\\Apps\\mingw\\lib\\gcc\\mingw32\\9.2.0\\libgomp.a" -pthread
But I am feeling like python GIL is also applying to the C++ lib and prevent it to use all the cpu's cores...
Does anyone has the answer ?
Thank you very much
Sam
So after digging, I have found 2 things:
GIL does not apply to the DLL if called using CDLL. (GIL applies to the dll if you use PyDLL: https://docs.python.org/3.8/library/ctypes.html#loading-shared-libraries)
In my C++ linker command line, gomp lib was missing (-lgomp). Here is the correct command:
g++ -LD:/Apps/mingw/lib/gcc/mingw32/9.2.0 -shared -o libSyntaxicAnalyser.dll "src\\Environnement.o" "src\\Fun.o" "src\\Lexem.o" "src\\LexicalAnalyser.o" "src\\Status.o" "src\\Variable.o" "src\\lib.o" "src\\main.o" -lgomp -pthread
And now it works !
Cheers
I am trying to run a GitHub repository that is about SNNs. But, when I run the python script, I get a compiler error from the weave package.
Link: https://github.com/djsaunde/lm-snn/blob/master/code/train/csnn_pc_mnist.py
The code generates neuron groups and after that tried to apply STDP backpropagation algorith to them but brian.STDP object couldn't be generated beacuse of the compiler error.
Error
weave.build_tools.CompileError: error: Command "/home/mzp7/workspace/DSNN/Examples/lm-snn/miniconda2/bin/x86_64-conda_cos6-linux-gnu-c++ -fno-strict-aliasing -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -pipe -DNDEBUG -fwrapv -O3 -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/mzp7/workspace/DSNN/Examples/lm-snn/miniconda2/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/mzp7/workspace/DSNN/Examples/lm-snn/miniconda2/include -fPIC -I/home/mzp7/workspace/DSNN/Examples/lm-snn/miniconda2/lib/python2.7/site-packages/weave -I/home/mzp7/workspace/DSNN/Examples/lm-snn/miniconda2/lib/python2.7/site-packages/weave/scxx -I/home/mzp7/workspace/DSNN/Examples/lm-snn/miniconda2/lib/python2.7/site-packages/numpy/core/include -I/home/mzp7/workspace/DSNN/Examples/lm-snn/miniconda2/include/python2.7 -c /home/mzp7/workspace/DSNN/Examples/lm-snn/miniconda2/lib/python2.7/site-packages/weave/scxx/weave_imp.cpp -o /tmp/weave-mzp7-UMTCud/python27_intermediate/compiler_7d6a1f80b8499f1aba77652aa8d9d6d7/home/mzp7/workspace/DSNN/Examples/lm-snn/miniconda2/lib/python2.7/site-packages/weave/scxx/weave_imp.o -MMD -MF /tmp/weave-mzp7-UMTCud/python27_intermediate/compiler_7d6a1f80b8499f1aba77652aa8d9d6d7/home/mzp7/workspace/DSNN/Examples/lm-snn/miniconda2/lib/python2.7/site-packages/weave/scxx/weave_imp.o.d -O3 -ffast-math -march=native" failed with exit status 1
x86_64-conda_cos6-linux-gnu-c++: error: unrecognized command line option '-ffast-math -march=native'; did you mean '-fsso-struct=native'?
I use the miniconda2 environment.
Conda package: libgcc
Pip packages:
numpy
matplotlib
scipy
brian
weave
sympy
networkx
pandas
sklearn
brian2
Thank you.
When pip-installing a Python project with C++ parts,
pip3 install . --verbose --user
the typical compile line will be something like
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/eigen3/ -I/usr/local/include/python3.7 -I/home/nschloe/.local/include/python3.7m -I/usr/include/python3.7m -c src/generate.cpp -o build/temp.linux-x86_64-3.7/src/generate.o
Explicitly setting CFLAGS like
OPT="" CFLAGS="" pip3 install . --verbose --user
results in
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/eigen3/ -I/usr/local/include/python3.7 -I/home/nschloe/.local/include/python3.7m -I/usr/include/python3.7m -c src/generate.cpp -o build/temp.linux-x86_64-3.7/src/generate.o
retaining most of the flags.
Question: Where are all the compiler options set? More specifically: How can I remove -g? (It's eating too much memory.)
When installing spaCy under Ubuntu, but I got the following compile error.
The installation code is simply using pip install spacy.
/opt/rh/devtoolset-2/root/usr/bin/gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/mnt/nfs/lijin/local/opt/include/python2.7 -I/tmp/pip-install-ikyFEg/spacy/include -I/mnt/nfs/lijin/local/opt/include/python2.7 -c spacy/parts_of_speech.cpp -o build/temp.linux-x86_64-2.7/spacy/parts_of_speech.o -O2 -Wno-strict-prototypes -Wno-unused-function
unable to execute '/opt/rh/devtoolset-2/root/usr/bin/gcc': No such file or directory
error: command '/opt/rh/devtoolset-2/root/usr/bin/gcc' failed with exit status 1
My system has a /usr/bin/gcc but not in /opt/rh/xxx. Can anyone help fix this problem? Thank you.
I'm trying to compile Python 2.7.3 on Centos6. Almost everything works ok, except the thing I really need ^^.
When I type make, I'm getting the error:
building '_ssl' extension
gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -I/usr/local/include -I/root/Python-2.7.3/Include -I/root/Python-2.7.3 -c /root/Python-2.7.3/Modules/_ssl.c -o build/temp.linux-i686-2.7/root/Python-2.7.3/Modules/_ssl.o
gcc -pthread -shared build/temp.linux-i686-2.7/root/Python-2.7.3/Modules/_ssl.o -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-i686-2.7/_ssl.so
*** WARNING: renaming "_ssl" since importing it failed: build/lib.linux-i686-2.7/_ssl.so: undefined symbol: krb5_auth_con_getrcache
And at the end I'm getting a message that the build failed for module _ssl (something like this).
Have you ever faced this problem? I have installed both OpenSSL (0.9.8e fips) and OpenSSL-dev.
Make sure the right paths to openssl-dev (lib and include) are in your Makefile