Im trying to install cx_Freeze for Python 3.3. However, when compiling the source I get this error
gcc -pthread build/temp.linux-i686-3.3/source/bases/Console.o -L/usr/local/lib/python3.3/config-3.3m -lpython3.3 -o build/lib.linux-i686-3.3/cx_Freeze/bases/Console -Xlinker -export-dynamic -lpthread -ldl -lutil -lm -s
/usr/bin/ld: cannot find -lpython3.3
collect2: error: ld returned 1 exit status
Since I'm a newbie I couldn't really figure out what's missing so I've tried installing libpython3.3-dev and python3.3-dev, but this doesn't solve the problem. I don't know if this is wheather a Python or gcc problem. What am I missing?
create link and it will be ok!
sudo ln /usr/local/lib/libpython3.3m.a /usr/local/lib/libpython3.3.a
Related
I am super desperate...I am using Ubuntu 18.04.3 LTS
For a robotics class I had to build their project (after cloning it from git) with the make command. After some time i am receiving the following:enter image description here
(...)
make[1]: Entering directory '/home/fia/robotics-course/rai/rai/ry'
* UpToDate ../../rai/Kin/libKin.so
* UpToDate ../../rai/Core/libCore.so
* UpToDate ../../rai/KOMO/libKOMO.so
* UpToDate ../../rai/LGP/libLGP.so
g++ -g -march=native -Wall -DRAI_PYBIND `python3-config --cflags` -Wno-terminate -fPIC -std=c++14 -o lgp-py.o -c lgp-py.cpp
* UpToDate ../../rai/Operate/libOperate.so
g++ -g -march=native -Wall -DRAI_PYBIND `python3-config --cflags` -Wno-terminate -fPIC -std=c++14 -o ry.o -c ry.cpp
* UpToDate ../../rai/Perception/libPerception.so
* UpToDate ../../rai/RosCom/libRosCom.so
g++ -L/home/fia/robotics-course/rai/lib -L/usr/local/lib -o libry.so ./lgp-py.o ./ry.o -lCore -lKin -lKOMO -lLGP -lOperate -lRosCom -lPerception `python3-config --ldflags` -lrt -shared
lto1: internal compiler error: in lto_tag_to_tree_code, at lto-streamer.h:1005
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
../../build/generic.mk:299: recipe for target 'libry.so' failed
make[1]: *** [libry.so] Error 1
make[1]: Target 'default' not remade because of errors.
make[1]: Leaving directory '/home/fia/robotics-course/rai/rai/ry'
***** FAILED rai/rai/ry/libry.so
I am assuming that the line "internal compiler error" shows me whats wrong but I can not figure out how to solve it... I re-installed g++ and also redownloaded the git repository several times but nothing seems to work. I already thought that maybe me Operating System has a problem?
I already thought about reistalling Ubuntu...
So if anyone has an idea i would be super thankful!
Regards
Fia
"Internal compiler error" sounds like there's a bug in the compiler, so here are some ideas to try to work around it.
You could try compiling it with clang++ instead of g++. Install it using:
sudo apt-get install clang
Then build using something like:
CC=clang CXX=clang++ LD=clang make
Because the error mentions lto, you could also turning link-time optimization off:
LDFLAGS=-fno-lto make
I am trying to port python codes on windows to c codes and the convert it to an executable on windows 7. In linux I can do this easily, but in windows, this is totally new for me plus I am not good with compilers.
I download minGW and installed the compiler collection which includes gcc.
Below shows how I am trying to include python headers when compiling the .c file
C:\Users\repzero>gcc -Os -I C:\Python27\include -o C:\Users\repzero\hello.o C:\Users\repzero\hello.c -lpython2.7 -lpthread -lm -lutil
I get the errors
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -lpython2.7
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -lutil
collect2.exe: error: ld returned 1 exit status
Additional information
Here is my command line which I used to port python codes to c does (This generates hello.c) this works fine
cython --embed -o hello.c hello.py
How can I alleviate those errors?
I want to install tifffile package from terminal:
pip install tifffile
I am getting the following error
gcc -pthread -shared -L/home/l-01-314/anaconda3/lib -Wl,-rpath=/home/l-01-314/anaconda3/lib,--no-as-needed build/temp.linux-x86_64-3.5/tifffile/_tifffile.o -L/home/l-01-314/anaconda3/lib -lpython3.5m -o build/lib.linux-x86_64-3.5/tifffile/_tifffile.cpython-35m-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lpython3.5m
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
any idea why I am getting this error ?
solved, there was a wrong link from system gcc so I installed gcc for python anaconda via conda.
conda install -c anaconda gcc=4.8.5
I got this error message after run it on Centos 7 (512MB).
sudo make pycaffe
or
sudo make distribute
Error message
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [python/caffe/_caffe.so] Error 1
I had the same problem with trying to install dlib. The solution was to build Python with the --enable-shared flag. When using pyenv it can be done like this:
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install --force 2.7.11
I had recently encountered a similar error with another software package.
Try passing CFLAGS="-fPIC" or CXXFLAGS="-fPIC" while configuring or building. That worked for me.
You might also want to go through this page on -fPIC errors:
I have troubles using a Python interface generated with SWIG (I have OSX 10.11.12). After compiling and linking everything together as such:
swig -python erk_integrator.i
gcc -c -fPIC -O3 model.c auxiliary_functions.c timing_functions.c
gcc -c -fPIC -O3 erk_integrator.c erk_integrator_wrap.c -I. -I/usr/local/include/python2.7
gcc -lpython -dynamiclib model.o erk_integrator.o erk_integrator_wrap.o auxiliary_functions.o timing_functions.o -o _erk_integrator.so
I try a test script, but Python throws a fatal error:
/usr/local/bin/python test_erk.py
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6
But when I run
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 test_erk.py
everything works as it should. However, I need to use /usr/local/bin/python (from Homebrew) instead of the system Python.
I think something goes wrong in the linking step. Many thanks for helping!
This blog post helped me solve it: blog.tim-smith.us/2015/09/python-extension-modules-os-x
It turns out on OSX you need
-undefined dynamic_lookup
instead of
-lpython