During the recent days i had problem with GRIB API installation, i was able to install it with disable the --disable-shared flag but the problem is then i got an error while running Pygrib test "python animate.py"
(GRIB_API ERROR : JPEG support not enabled.)
So i had to install the GRIB API again without disable the shared but i got this error:
Linking C shared library ../lib/libgrib_api.so
/usr/bin/ld: /usr/local/lib/libjasper.a(jpc_math.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libjasper.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libgrib_api.so] Error 1
make[1]: *** [src/CMakeFiles/grib_api.dir/all] Error 2
make: *** [all] Error 2
then i started to compile Jasper again with -fPIC flag but i still got the
"recompile with -fPIC" for that i changed the flags in MAKE file as:
CFLAGS = -fPIC
CPP = gcc -E
CPPFLAGS =
CXX = g++
CXXCPP = g++ -E
CXXDEPMODE = depmode=gcc3
CXXFLAGS = -fPIC
FFLAGS = -fPIC
still no resualt ... i searched many but no resualt
Thanks in advance
Related
When I run !make command in yolov4, I face the issue:
chmod +x *.sh
gcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c demo.c -o obj/demo.o
demo.c:1:10: fatal error: network.h: No such file or directory
#include "network.h"
^~~~~~~~~~~
compilation terminated.
Makefile:179: recipe for target 'obj/demo.o' failed
make: \*\*\* \[obj/demo.o\] Error 1
Firstly it work fine, then I change in the darknet/src/dectector.c file for early save weights after 500 iteration and also change in the cfg/yolov4-custom.cfg file change the max_batches values 500500 to 500.
I don't think so it should create issue during the execution of !make file.
Someone have any suggestion? Anyone face this issue please guide me.
I run training command for yolov4 I face the issue access denied then I again run !make file at this command error came.
I'm trying to use the Python module on Boost. However, I'm getting an error that I cannot find what to do with.
It seems a missing switch or something, but I really could not find...
Does anyone have a clue?
Thanks!!!
/usr/include/python3.8/object.h|478|undefined reference to `_Py_Dealloc'|
System data:
Using Code::blocks, Python 3.8, Linux Mint, installed Boost by apt-get
Build log:
g++ -Wall -fexceptions -g -I/usr/lib/x86_64-linux-gnu/ -I/usr/include/python3.8/ -I/home/tavares/Downloads/boost/boost_1_77_0/stage/lib -c /home/tavares/Trabalho/pesquisa/softwares/optpipeline/PyOPY/PyOPI/bark.cpp -o obj/Debug/bark.o
g++ -Wall -fexceptions -g -I/usr/lib/x86_64-linux-gnu/ -I/usr/include/python3.8/ -I/home/tavares/Downloads/boost/boost_1_77_0/stage/lib -c /home/tavares/Trabalho/pesquisa/softwares/optpipeline/PyOPY/PyOPI/main.cpp -o obj/Debug/main.o
g++ -L/usr/lib/x86_64-linux-gnu/ -o bin/Debug/PyOPI obj/Debug/bark.o obj/Debug/main.o -lboost_program_options -lboost_system -lboost_python38
/usr/bin/ld: obj/Debug/bark.o: in function `_Py_DECREF':
/usr/include/python3.8/object.h:478: undefined reference to `_Py_Dealloc'
/usr/bin/ld: obj/Debug/bark.o: in function `boost::python::detail::none()':
/usr/local/include/boost/python/detail/none.hpp:16: undefined reference to `_Py_NoneStruct'
/usr/bin/ld: /usr/local/include/boost/python/detail/none.hpp:16: undefined reference to `_Py_NoneStruct'
/usr/bin/ld: obj/Debug/bark.o: in function `boost::python::api::object::object()':
/usr/local/include/boost/python/object_core.hpp:400: undefined reference to `_Py_NoneStruct'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu//libboost_python38.so: undefined reference to `PyExc_ValueError'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu//libboost_python38.so: undefined reference to `PyLong_AsLong'
This is kinda old, but try adding
$(python3.10-config --ldflags --embed)
to the commands at the linking phase.
Your link command becomes something like
g++ -L/usr/lib/x86_64-linux-gnu/ -o bin/Debug/PyOPI obj/Debug/bark.o obj/Debug/main.o -lboost_program_options -lboost_system -lboost_python38
$(python3.10-config --ldflags --embed)
Hope this helps someone.
I use Swig.(Mac os 10.13)
My shell script:
swig -c++ -python -o example_wrap.cpp example.i
g++ -c -std=c++17 -fPIC example.cpp
g++ -c -std=c++17 -fPIC example_wrap.cpp -o example_wrap.o \
-I/usr/local/Cellar//python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/include/python3.7m
ld -bundle -macosx_version_min 10.13 -flat_namespace \
-undefined suppress -o _example.so *.o
I spent enough time to seek how to create C++ dynamic library for Python, but I have never used the last line.Most often I create a library from an IDE.
g++ -shared is more familiar, but it doesn't work.
Many such errors appear:
Undefined symbols for architecture x86_64:
"_PyArg_ParseTuple", referenced from:
_wrap_printTree(_object*, _object*) in example_wrap.o
I know about this methods from Python.h.
So, the questions are - how does the last line work(ld -bundle ...)? Are there other methods to create the dynamic library?How can I use g++ -shared?
Here is a small CMakeLists.txt that should work for the example you posted:
cmake_minimum_required(VERSION 3.10) # change this to your needs
project(foo VERSION 0.0 LANGUAGES CXX C)
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
find_package(PythonLibs)
include_directories(${PYTHON_INCLUDE_PATH})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_SWIG_FLAGS "")
add_library(exampleImpl SHARED example.h example.cpp)
target_compile_features(exampleImpl PUBLIC cxx_std_17)
set_source_files_properties(example.i PROPERTIES CPLUSPLUS ON)
swig_add_library(example LANGUAGE python SOURCES example.i)
swig_link_libraries(example ${PYTHON_LIBRARIES} exampleImpl)
To make sure cmake uses the right python library, you can pass an appropriate option upon configure time, see here.
I downloaded the source code from here. When I run make, I get the following error message:
make: Entering directory `/home/christopher/SourceCode/svm-python-v204'
cd svm_light; make svm_learn_hideo_noexe
make[1]: Entering directory `/home/christopher/SourceCode/svm-python-v204/svm_light'
make[1]: Nothing to be done for `svm_learn_hideo_noexe'.
make[1]: Leaving directory `/home/christopher/SourceCode/svm-python-v204/svm_light'
cd svm_struct; make svm_struct_noexe
make[1]: Entering directory `/home/christopher/SourceCode/svm-python-v204/svm_struct'
make[1]: Nothing to be done for `svm_struct_noexe'.
make[1]: Leaving directory `/home/christopher/SourceCode/svm-python-v204/svm_struct'
gcc -g -lm svm_struct/svm_struct_learn.o svm_struct_api.o svm_light/svm_hideo.o svm_light/svm_learn.o svm_light/svm_common.o svm_struct/svm_struct_common.o svm_struct/svm_struct_main.o pyobjs/array.o pyobjs/constraints.o pyobjs/default.o pyobjs/document.o pyobjs/kernelparm.o pyobjs/model.o pyobjs/sample.o pyobjs/sparm.o pyobjs/sparse.o pyobjs/structmodel.o pyobjs/svmapi.o -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -o svm_python_learn
/usr/bin/ld: svm_light/svm_common.o: undefined reference to symbol 'exp##GLIBC_2.2.5'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libm.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [svm_python_learn_hideo] Error 1
make: Leaving directory `/home/christopher/SourceCode/svm-python-v204'
christopher#christopher-laptop:~/SourceCode/svm-python-v204-build$ make -C ./../svm-python-v204
make: Entering directory `/home/christopher/SourceCode/svm-python-v204'
cd svm_light; make svm_learn_hideo_noexe
make[1]: Entering directory `/home/christopher/SourceCode/svm-python-v204/svm_light'
make[1]: Nothing to be done for `svm_learn_hideo_noexe'.
make[1]: Leaving directory `/home/christopher/SourceCode/svm-python-v204/svm_light'
cd svm_struct; make svm_struct_noexe
make[1]: Entering directory `/home/christopher/SourceCode/svm-python-v204/svm_struct'
make[1]: Nothing to be done for `svm_struct_noexe'.
make[1]: Leaving directory `/home/christopher/SourceCode/svm-python-v204/svm_struct'
gcc -g -lm svm_struct/svm_struct_learn.o svm_struct_api.o svm_light/svm_hideo.o svm_light/svm_learn.o svm_light/svm_common.o svm_struct/svm_struct_common.o svm_struct/svm_struct_main.o pyobjs/array.o pyobjs/constraints.o pyobjs/default.o pyobjs/document.o pyobjs/kernelparm.o pyobjs/model.o pyobjs/sample.o pyobjs/sparm.o pyobjs/sparse.o pyobjs/structmodel.o pyobjs/svmapi.o -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -o svm_python_learn
/usr/bin/ld: svm_light/svm_common.o: undefined reference to symbol 'exp##GLIBC_2.2.5'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libm.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [svm_python_learn_hideo] Error 1
make: Leaving directory `/home/christopher/SourceCode/svm-python-v204'
Everything is fairly 'out of the box' so I suspect this is a Ubuntu problem. In particular, I suspect glibc is out of date from
undefined reference to symbol 'exp##GLIBC_2.2.5'
When I try /lib/x86_64-linux-gnu/libc.so.6, I get
GNU C Library (Ubuntu EGLIBC 2.19-0ubuntu6.6) stable release version 2.19
The latest version is 2.2.5, but eglibc, which seems to be how Ubuntu users get glibc, doesn't have a 2.2 branch. I have already tried apt-get upgrade but I am still at version 2.19. What do I do to solve this?
As of 2014, Debian seems to have moved back to glibc.
Adding LIBS=-lm near the top of the MakeFile to link against the math library solved the problem for me.
I want to compile / install the IP2Location Python extension found here:
www.ip2location.com/python.aspx
I tried following the instructions at these sites:
eli.thegreenplace.net/2008/06/28/compiling-python-extensions-with-distutils-and-mingw/
boodebr.org/main/python/build-windows-extensions
But I am getting no where. The problem is the Python extension relies on another C library:
www.ip2location.com/c.aspx
When I try to compile this library in cygwin I get the following output:
make all-recursive
make[1]: Entering directory `/home/ty/Python-IP2Location/C-IP2Location-3.0.0'
Making all in libIP2Location
make[2]: Entering directory `/home/ty/Python-IP2Location/C-IP2Location-3.0.0/li
bIP2Location'
/bin/sh ../libtool --tag=CC --mode=link gcc -mno-cygwin -IiMath/ -g -O2 -modul
e -no-undefined -avoid-version -o libIP2Location.la -rpath /cygdrive/c/MinGW/li
b libIP2Location_la-IP2Location.lo libIP2Location_la-imath.lo
libtool: link: rm -fr .libs/libIP2Location.dll.a
libtool: link: gcc -mno-cygwin -shared .libs/libIP2Location_la-IP2Location.o .l
ibs/libIP2Location_la-imath.o -mno-cygwin -o .libs/libIP2Location.dll -Wl,-
-enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libIP2Location.dll.
a
.libs/libIP2Location_la-IP2Location.o: In function `IP2Location_ip2no':
/home/ty/Python-IP2Location/C-IP2Location-3.0.0/libIP2Location/IP2Location.c:71
8: undefined reference to `_inet_addr#4'
Creating library file: .libs/libIP2Location.dll.a
collect2: ld returned 1 exit status
make[2]: *** [libIP2Location.la] Error 1
make[2]: Leaving directory `/home/ty/Python-IP2Location/C-IP2Location-3.0.0/lib
IP2Location'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/ty/Python-IP2Location/C-IP2Location-3.0.0'
make: *** [all] Error 2
I'm running python 2.6.3 on Windows 7 32-bit.
I have MS Visual Studio 2008 (though no idea how to use it) and of course cygwin / MinGW.
Any help or pointers would be greatly appreciated.
OK, so the full solution is:
download stdint.h and put it in the IP2Location C Library folder: http://msinttypes.googlecode.com/svn/trunk/stdint.h
open a dos prompt and execute "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
from the same dos prompt execute "nmake /f Makefile.win"
cd to the Python extension folder and execute "set LINK=/nod:msvcrt.lib"
lastly do the standard "python setup.py install"
The credit for the "set LINK=/nod:msvcrt.lib" advice goes to Tim Roberts of Providenza & Boekelheide, Inc (probo.com). -- he was kind enough to answer my cry for help on the python win32 mailing list. Thanks Tim!
Try adding -lws2_32 option to linking command.
BTW, there is another pure Python library to get country from IP.