cythonでclangをつかってコンパイルしたいです。OSはUbuntuです
CythonでコンパイルするときGNU cが使われると思います。
そのとき
CC=/usr/bin/clang++ python3 setup.py build_ext --inplace
かもしくは
setup.pyに
os.environ["CC"] = "clang++"
を入れると
コンパイラーがclang++に代わるのを知りました。
しかしリンカーはg++のまま変わりませんでした。
このリンカーも変えたいのですがどうすればいいでしょうか?
os.environ["LD"] = "clang++"
はだめでした。
記述をそのまま書きます。
sh
1$ python3 setup.py build_ext --inplace 2/usr/lib 3['-L/usr/lib', 'opencv_flann', 'opencv_dnn', 'opencv_imgcodecs', 'opencv_features2d', 'opencv_core', 'opencv_superres', 'opencv_videoio', 'opencv_highgui', 'opencv_imgproc', 'opencv_videostab', 'opencv_calib3d', 'opencv_ml', 'opencv_objdetect', 'opencv_video', 'opencv_shape', 'opencv_photo', 'opencv_stitching', '-L/home/ubuntu/work4/XXXX_jetson-linux_2_1_0_04_06_20/XXXX_linux_2_1_0_04_06_20/lib/armv8-a', 'ArgusKit'] 4running build_ext 5building 'opencv_mat' extension 6clang++ -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/usr/include/opencv2 -I/home/ubuntu/work4/XXX_jetson-linux_2_1_0_04_06_20/XXXXX_linux_2_1_0_04_06_20/include -I/usr/include/python3.6m -c opencv_mat.cpp -o build/temp.linux-aarch64-3.6/opencv_mat.o 7In file included from opencv_mat.cpp:674: 8In file included from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/arrayobject.h:4: 9In file included from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/ndarrayobject.h:12: 10In file included from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1822: 11/usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: 12 "Using deprecated NumPy API, disable it with " "#define 13 NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings] 14#warning "Using deprecated NumPy API, disable it with " \ 15 ^ 161 warning generated. 17clang++ -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/usr/include/opencv2 -I/home/ubuntu/work4/XXXXK_jetson-linux_2_1_0_04_06_20/XXXXX_linux_2_1_0_04_06_20/include -I/usr/include/python3.6m -c csample.cpp -o build/temp.linux-aarch64-3.6/csample.o 18clang++ -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/usr/include/opencv2 -I/home/ubuntu/work4/XXXX_jetson-linux_2_1_0_04_06_20/XXXXX_linux_2_1_0_04_06_20/include -I/usr/include/python3.6m -c safr.cpp -o build/temp.linux-aarch64-3.6/safr.o 19safr.cpp:597:5: warning: control reaches end of non-void function 20 [-Wreturn-type] 21 } 22 ^ 231 warning generated. 24warning: no library file corresponding to '-L/usr/lib' found (skipping) 25warning: no library file corresponding to '-L/home/ubuntu/work4/XXXX_jetson-linux_2_1_0_04_06_20/XXXX_linux_2_1_0_04_06_20/lib/armv8-a' found (skipping) 26aarch64-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-aarch64-3.6/opencv_mat.o build/temp.linux-aarch64-3.6/csample.o build/temp.linux-aarch64-3.6/safr.o -lopencv_flann -lopencv_dnn -lopencv_imgcodecs -lopencv_features2d -lopencv_core -lopencv_superres -lopencv_videoio -lopencv_highgui -lopencv_imgproc -lopencv_videostab -lopencv_calib3d -lopencv_ml -lopencv_objdetect -lopencv_video -lopencv_shape -lopencv_photo -lopencv_stitching -lArgusKit -o /home/ubuntu/work4/ooo/cython_opencvMat/opencv_mat.cpython-36m-aarch64-linux-gnu.so 27/usr/bin/ld: cannot find -lArgusKit 28collect2: error: ld returned 1 exit status 29error: command 'aarch64-linux-gnu-g++' failed with exit status 1
こんな感じで最後のリンカーだけaarch64-linux-gnu-g++ のまま変わりません。
なぜでしょう?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。