bensondaled / pseyepy

PSEye-py: a python interface to the PS3Eye camera
Apache License 2.0
78 stars 26 forks source link

g++ is not recognizing the option '-stdlib=libc++' #7

Open nlpguyz opened 5 years ago

nlpguyz commented 5 years ago

I am using the command "python3 setup.py install" to compile the c++ code but got the error that "-stdlib=libc++" is not recognized. My environment is the following:

Ubuntu 16.04 g++ 5.4 python 3.5

If I manually remove "-stdlib=libc++" from setup.py and camera.cpp, compilation went through but I got a linker error in libusb-1.0.a:

x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/pseyepy/cameras.o build/temp.linux-x86_64-3.5/pseyepy/src/ps3eye.o build/temp.linux-x86_64-3.5/pseyepy/src/ps3eye_capi.o -Lpseyepy/ext/lib -lusb-1.0 -o build/lib.linux-x86_64-3.5/pseyepy/cameras.cpython-35m-x86_64-linux-gnu.so -std=c++11
/usr/bin/ld: pseyepy/ext/lib/libusb-1.0.a(libusb_1_0_la-core.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
pseyepy/ext/lib/libusb-1.0.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-g++' failed with exit status 1

Anyone fixed the issue? Thanks!

nenesta commented 4 years ago

any ask for this question?

DansDesigns commented 3 years ago

could also do with a solution to this....

osskar12 commented 3 years ago

I have the same problem, anybody solved this?

iRonJ commented 3 years ago

Try the fix here: https://github.com/bensondaled/pseyepy/pull/9/commits/6bd80943811e0be59571699d2048eabc6a9645cd

osskar12 commented 3 years ago

After modifying the files and trying to install, i get this error:

building 'pseyepy.cameras' extension g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ipseyepy/src -Ipseyepy/ext/include/libusb-1.0 -I/home/marius/anaconda3/include/python3.8 -c pseyepy/cameras.cpp -o build/temp.linux-x86_64-3.8/pseyepy/cameras.o -std=c++11 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ In file included from pseyepy/src/ps3eye_capi.h:29:0, from pseyepy/cameras.cpp:658: pseyepy/src/ps3eye.h:20:10: fatal error: libusb-1.0/libusb.h: File not found

include <libusb-1.0/libusb.h>

^~~~~ compilation terminated. error: command 'g++' failed with exit status 1

I am using Ubuntu 18.04

osskar12 commented 3 years ago

Im sorry im very inexperienced, i just noticed i can download the source code of this commit and not modify the files manually. Still, i run into this error:

. . . building 'pseyepy.cameras' extension creating build/temp.linux-x86_64-3.7 creating build/temp.linux-x86_64-3.7/pseyepy creating build/temp.linux-x86_64-3.7/pseyepy/src g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ipseyepy/src -Ipseyepy/ext/include/libusb-1.0 -I/home/marius/anaconda3/envs/dlc-live/include/python3.7m -c pseyepy/cameras.cpp -o build/temp.linux-x86_64-3.7/pseyepy/cameras.o -std=c++11 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ In file included from pseyepy/src/ps3eye_capi.h:29:0, from pseyepy/cameras.cpp:658: pseyepy/src/ps3eye.h:20:10: fatal error: libusb-1.0/libusb.h: No such file or directory

include <libusb-1.0/libusb.h>

Help would be greatly appreciated! Greetings