sms-tools icon indicating copy to clipboard operation
sms-tools copied to clipboard

Cannot compile C functions

Open jiemojiemo opened this issue 6 years ago • 5 comments

when I run

python compileModule.py build_ext --inplace

I got error

running build_ext
skipping 'cutilFunctions.c' Cython extension (up-to-date)
building 'utilFunctions_C' extension
error: Unable to find vcvarsall.bat

python=3.6 windows 10

jiemojiemo avatar Oct 29 '18 12:10 jiemojiemo

windows 10 Python 3.6.5

When I run

python compileModule.py build_ext --inplace

I get

running build_ext
skipping 'cutilFunctions.c' Cython extension (up-to-date)
building 'utilFunctions_C' extension
creating build
creating build\temp.win32-3.6
creating build\temp.win32-3.6\Release
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\OWNER\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\OWNER\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\core/include -IC:\Users\OWNER\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\OWNER\AppData\Local\Programs\Python\Python36-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\include" /TcutilFunctions.c /Fobuild\temp.win32-3.6\Release\utilFunctions.obj
utilFunctions.c
c:\users\owner\dropbox\sms-tools-master\software\models\utilfunctions_c\utilFunctions.h(2): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

arnavlavan avatar Nov 10 '18 21:11 arnavlavan

@jiemojiemo Maybe this will help https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/

Anyway, as the manual tells, Ubuntu is strongly preferred over other OS.

klgsnd avatar Feb 10 '19 11:02 klgsnd

I managed to compile the c files by using the virtual Linux environment on Windows called MSYS2:

https://www.msys2.org/

perhaps you can give this a try and use google to figure out how to set everything up properly ;)

ghost avatar Jul 27 '19 10:07 ghost

Anyway, as the manual tells, Ubuntu is strongly preferred over other OS.

I respectfully disagree, I prefer Windows over Ubuntu. It is just a matter of setting up your environment properly. Clearly if you have never worked with C or C++ in a native windows environment, you will run into trouble and you will not know what to do.

I have the sms tools running on Python 3.7.4 64 bit, built with Visual Studio 2019, Windows SDK 10.0.17763.0.

For this code to compile on Windows (10), you need an install of Visual Studio and a Windows SDK. If you startup a command line environment through vcvarsall.bat you will find the build starts working much better, up until the moment it bails with a message on how it fails to find m.lib for linking.

This is remediated by removing the libraries=['m'] part from the compileModule.py script (in the setup block). Windows does not need a seperate m.lib so this is superfluous.

dijkstrah avatar Sep 27 '19 16:09 dijkstrah

Hi, i have similar problems when trying to compile through pycharm. Anyone please help me? I use pycharm a lot in my work and it's the most comfortable for me so if i don't need to i prefer to not change it image

jvstyna avatar Oct 24 '21 13:10 jvstyna

For anyone still struggling with the build issue with the error: error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ What worked for me was to install the Windows SDK and Microsoft visual studio and choosing python development.

See the following for more information: https://devguide.python.org/getting-started/setup-building/index.html#windows https://wiki.python.org/moin/WindowsCompilers#Compilers_Installation_and_configuration

avishaik avatar Dec 14 '22 05:12 avishaik