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.
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.
Mac OS Sierra.
In terminal, while trying to execute a .sh file that involves a Python script with Fortran portions, I got this message:
lenscov-master Roger$ ./run_covariances.sh recompile
rm *.o *.so
rm: *.so: No such file or directory
make: [clean] Error 1 (ignored)
gfortran -fPIC -c *.f -lgfortran -lifcore
f2py-2.7 -c loop_lensing.f90 *.o -m loop_lensing --opt=-ffixed-line-length-
none --opt=-O3
/bin/sh: f2py-2.7: command not found
make: *** [loop_lensing] Error 127
However, it is fine just test-running the .f90 file:
f2py -c loop_lensing.F90 -m test
returns a bunch of normal-looking information.
Does anyone maybe know what is going on?
it is fine just test-running the .f90 file
means you have f2py installed. But the script use f2py-2.7
You need to check the version of installed f2py, and make sure f2py-2.7 redirects to the corrent f2py.
The script (or a Makefile) tries to invoke f2py-2.7 instead of f2py. If it is your script or you can easily adjust it, rename all f2py-2.7 to f2py. Otherwise you have to tell us more about the script and show the code of the script.
As foodtooth says, make sure you have f2py 2.7 and not f2py-3, but I don't expect that to be a problem.
You could also make a symlink f2py -> f2py-2.7 for the script.
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
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 checked this question and it is not applicable.
Python missing or unusable error while cross compiling GDB
I'm trying to build gdb 7.5 with python support on Cent OS 5.
configure --with-expat --with-python
Does not log any errors and the Python devel files are installed.
I set LDFLAGS="L/usr/local/expat-2.1 -L/opt/python27/lib
/opt/python27/lib contains:
rwxrwxrwx 1 root root 19 Mar 14 15:35 libpython2.7.so -> libpython2.7.so.1.0
-r-xr-xr-x 1 root root 1893448 Aug 30 2012 libpython2.7.so.1.0
drwxr-xr-x 2 root root 4096 Mar 14 15:35 pkgconfig
drwxr-xr-x 27 root root 20480 Mar 14 21:49 python2.7
Running make produces this error:
checking whether to use python... yes
checking for python... /opt/python27/bin/python
checking for python2.7... no
configure: error: python is missing or unusable
/opt/python27/bin/python exists has the correct permissions and is executable.
Why can't the link process find python?
The next line AFTER the configure: error: line should be something like:
make[1]: [configure-gdb]: ....
telling you that this error comes from running configure in the gdb subdirectory. So you should look in the config.log file there. This should show you something that configure tried to do that failed -- probably a chunk of C code that failed to compile, with an error message from the compiler something like 'can't find include file "Python.h"'. This tells you what the problem is -- it couldn't find the python header file used to embed python in gdb.
Now your problem may be slightly different, but its probably related to not having the python embedding components properly installed.
Why can't the link process find python?
It's not the link process; it's the configure process in one of the subdirectories.
Find out which subdirectory it is (make should say Leaving directory XXXX), and look in config.log in that subdirectory for what went wrong.
The reason I posted is that config.log does not point to a problem, yet when I run make I receive the error from the original post
The make process runs additional configure processes. Your error is clearly from that additional process. You claim to have checked all config.logs in all subdirectories, but that appears unlikely given the symptoms you've described.
Sorry for making you wait 10 years for an answer.
In my case I looked under the gdb/config.log file and found this:
configure:10369: checking for python2.7
configure:10387: gcc -o conftest -g -O2 -I/home/user/stevie-bsp/toolchain-build/builds/destdir/aarch64-host-linux-gnu/include -I/usr/include/python2.7 -I/usr/include/python2.7 -static-libstdc++ -static-libgcc conftest.c -ldl -lncursesw -lm -ldl -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions >&5
conftest.c:54:10: fatal error: Python.h: No such file or directory
54 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
Looks like it is a misleading error message when the Python 2 headers aren't installed. I fixed that on Ubuntu with apt install python2-dev; on CentOS the package name would vary.
Secondly, the command python must start the Python 2 interpreter. The build process will not give a clear error about this and silently fails to query the include path for the Python headers. I resolved it by using the python-is-python2 package on Ubuntu. I'm not sure about CentOS but in the worst case you can create a symlink.