2020年12月22日星期二

Build error using cython | LINK : fatal error LNK1181

I am using anaconda3 shell to execute a cython script such that I can use Python later to call my functions. I have the source code from the publisher which is written in C/C++ and don't have any programming experience in C/C++.

Hence, I would like to use cython to wrap the C/c++ files. I am using Windows 10 with x64 based OS, Visual studio 2017 and anaconda3 to execute all my python modules.

My setup.py file looks like this:

#setup.py  from setuptools import setup,Extension  from Cython.Build import cythonize    extensions=[Extension("IrisAO_Python", [".\\DM files\\IrisAO_Python.pyx"],                        include_dirs = [".\\DM files\\"],                        library_dirs = [".\\DM files\\"],                         libraries=["IrisAO.Devices"])]    setup(      name = "irisao",      ext_modules = cythonize(extensions),      packages = ['DM files'],      package_dir ={'DM files':'.\\DM files'},      py_modules=['__init__','IrisAO_Python_MirrorControl']   )  

I would urge the experts looking at this problem to download all the files from my github repository. Without downloading the files, the debugging of the problem is useless. :https://github.com/abani-nayak/IrisAO-for-Windows/tree/editing

Next, I use anaconda3 shell to compile the extension setup.py:

(base) C:\Users\Abani\Documents\DM setup\Final>python setup.py build_ext --inplace  

However, I am getting a fatal link error LNK1181. The preview of the error can be found here:

cl : Command line warning D9027 : source file 'Kits\10\include\10.0.17763.0\winrt -IC:\Program' ignored  cl : Command line warning D9024 : unrecognized source file type 'Files', object file assumed  cl : Command line warning D9027 : source file 'Files' ignored  cl : Command line warning D9024 : unrecognized source file type '(x86)\Windows', object file assumed  cl : Command line warning D9027 : source file '(x86)\Windows' ignored  cl : Command line warning D9027 : source file 'Kits\10\include\10.0.17763.0\cppwinrt /EHsc /TpraisePythonException.cpp /Fobuild\temp.win-amd64-3.8\Release\raisePythonException.obj' ignored  cl : Command line warning D9021 : no action performed  C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:.\DM files\" /LIBPATH:C:\Users\Abani\anaconda3\libs /LIBPATH:C:\Users\Abani\anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64" IrisAO.Devices.lib /EXPORT:PyInit_IrisAO_Python "build\temp.win-amd64-3.8\Release\.\DM files\IrisAO_Python.obj" build\temp.win-amd64-3.8\Release\raisePythonException.obj /OUT:build\lib.win-amd64-3.8\IrisAO_Python.cp38-win_amd64.pyd "/IMPLIB:build\temp.win-amd64-3.8\Release\.\DM files\IrisAO_Python.cp38-win_amd64.lib"  LINK : fatal error LNK1181: cannot open input file 'Files.obj'  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\link.exe' failed with exit status 1181    (base) C:\Users\Abani\Documents\DM setup\Final>  

The error says: cannot open input file 'Files.obj'. I don't know why it is saying cannot open input file although there is no such file 'Files.obj' in my 'DM files' folder.

Hence, I ask experts for their necessary help. Once again all the files necessary for executing cython script can be found here: https://github.com/abani-nayak/IrisAO-for-Windows/tree/editing

https://stackoverflow.com/questions/65418160/build-error-using-cython-link-fatal-error-lnk1181 December 23, 2020 at 10:06AM

没有评论:

发表评论