Trying to install a compiled Python package on a 64-bit Windows machine using MinGW compiler. The same install succeeded on my 32-bit machine but failed on two different 64-bit machines:
C:\Python\Scripts> pip install python-Levenshtein
C:\Python\libs/python33.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Trying from a cloned copy:
$ python setup.py build
C:\Python\libs/python33.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Running the build command by itself:
$ gcc.exe -shared -s 'build\temp.win-amd64-3.3\Release\levenshtein\_levenshtein.o' 'build\temp.win-amd64-3.3\Release\levenshtein\_levenshtein.def' -LC:'\Python\libs' -LC:'\Python\PCbuild\amd64' -lpython33 -lmsvcr100 -o 'build\lib.win-amd64-3.3\Levenshtein\_levenshtein.pyd'
C:\Python\libs/python33.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status
$ file 'C:\Python\libs/python33.lib'
C:\Python\libs/python33.lib: current ar archive
Thank you
- Muposat
Related
Since I upgraded macOS to Monterey, I couldn’t compile the Cython file with this command:
python setup.py build_ext --inplace.
I’m getting this error:
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/opt/MacOSX11.3.sdk/usr/lib/libSystem.tbd' for architecture x86_64 clang-10: error: linker command failed with exit code 1 (use -v to see invocation) error: command 'x86_64-apple-darwin13.4.0-clang' failed with exit status 1
How can I fix it?
I am trying to execute a file as shown on this website,
http://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html
I have saved my file with .pyx extension, made the setup.py file and ran python setup.py build_ext --inplace command. So earlier I was getting error: command 'gcc' failed: No such file or directory and then I installed the package as suggested here Error: command 'gcc' failed: No such file or directory I added the C:\users\name\mingw\bin in my environment variable as suggested MinGW: "gcc is not recognized as an internal or external command".
Still, when I am typing gcc on cmd it is showing 'gcc' is not recognized as an internal or external command,operable program or batch file.
So, I am confused. I also went into mingw\bin and then I run python setup.py build_ext --inplace but then I get command 'gcc.exe' failed with exit status 1.
I am stuck on this. Please help as this is my first time to use Cython.
I am using anaconda py3.6, with conda's mingw32.
I set mingw32 as the compiler, also modified cygwinccompiler.py as suggested in Building minimal cython file with python 3.3 (Anaconda) under windows 7 .
Now I still can't build any binary pyd module, they all failed at the linking step with similar error.
C:\ProgramData\Anaconda3\Scripts\gcc.bat -shared -s build\temp.win32-3.6\Release\cymysql\packet.o build\temp.win32-3.6\Release\cymysql\packet.cp36-win32.def -LC:\ProgramData\Anaconda3\libs -LC:\ProgramData\Anaconda3\PCbuild\win32 -lpython36 -lmsvcr140 -o build\lib.win32-3.6\cymysql\packet.cp36-win32.pyd c:/programdata/anaconda3/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/bin/ld.exe: build\temp.win32-3.6\Release\cymysql\packet.cp36-win32.def:1: syntax error
c:/programdata/anaconda3/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/bin/ld.exe:build\temp.win32-3.6\Release\cymysql\packet.cp36-win32.def: file format not recognized; treating as linker script
c:/programdata/anaconda3/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/bin/ld.exe:build\temp.win32-3.6\Release\cymysql\packet.cp36-win32.def:1: syntax error
collect2.exe: error: ld returned 1 exit status error: command 'C:\\ProgramData\\Anaconda3\\Scripts\\gcc.bat' failed with exit status 1
another example:
(base) D:\pymssql-build\pymssql>gcc -shared -s build\temp.win32-3.6\Release\_mssql.o build\temp.win32-3.6\Release\_mssql.cp36-win32.def -LC:\ProgramData\Anaconda3\Library\mingw-w64\lib -LC:\ProgramData\Anaconda3\Library\lib -LD:\pymssql-build\pymssql\freetds\ming_32\lib-nossl -LC:\ProgramData\Anaconda3\libs -LC:\ProgramData\Anaconda3\PCbuild\win32 -llibiconv -liconv -lsybdb -lws2_32 -lwsock32 -lkernel32 -lpython36 -lmsvcr140 -o build\lib.win32-3.6\_mssql.cp36-win32.pyd
c:/programdata/anaconda3/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/bin/ld.exe: build\temp.win32-3.6\Release\_mssql.cp36-win32.def:1: syntax error
c:/programdata/anaconda3/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/bin/ld.exe:build\temp.win32-3.6\Release\_mssql.cp36-win32.def: file format not recognized; treating as linker script
c:/programdata/anaconda3/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/bin/ld.exe:build\temp.win32-3.6\Release\_mssql.cp36-win32.def:1: syntax error
collect2.exe: error: ld returned 1 exit status
While the def files looks just fine to me:
LIBRARY _mssql.cp36-win32.pyd
EXPORTS
PyInit__mssql
_mssql.o size: 507kb
I tried to install glove_python package (https://github.com/maciejkula/glove-python) and I keep getting the same error like this question.
I tried using the mingw32 compiler, and I got the following error.
glove/glove_cython.c:262:17: fatal error: omp.h: No such file or directory
compilation terminated.
error: command 'C:\\Anaconda2\\Scripts\\gcc.bat' failed with exit status 1
I even tried using TDM but again I'm getting the following error.
gcc: error: libgomp.spec: No such file or directory
error: command 'c:\\TDM-GCC-64\\bin\\gcc.exe' failed with exit status 1
I'm following these instructions for setting up cx_Freeze on Mac OS X in the Terminal: http://martinfitzpatrick.name/article/cx-freeze-and-pyside-on-mac/
When I type: pip install cx_Freeze
I just get a wall of output ending with:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
Any ideas?