Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install (of 0.4.1) fails in Windows under Python 3.5.1 using VS2015 compiler #46

Open
PatternMatching opened this issue Mar 14, 2016 · 2 comments

Comments

@PatternMatching
Copy link

When attempting to install swigibpy using pip and Python 3.5.1 in Windows, I received the following error when attempting to compile swigibpy/IB/Shared/EClientSocketBase.cpp:

Macro definition of snprintf conflicts with Standard Library function declaration

A quick search on Google yielded a very helpful result. It appears that until now, many libraries (including IB API) used snprintf by defining it as _snprintf, since _snprintf was supported.

As of VS2015 (e.g. VC14), snprintf is officially supported, and it should therefore never be #define'd.

The offending line is in swigibpy/IB/Shared/StdAfx.h (8):

#define snprintf _snprintf

It would appear that IB fixed this in a release following the version included with swigibpy 0.4.1. I believe that this is also specific to the Python 3.x releases because Python 2.x builds point to earlier version of the VC++ compiler.

Not sure if this is super urgent given the pending push of version 0.5, but wanted to raise it in case it is a forcing function to move things along.

@osteth
Copy link

osteth commented Jul 20, 2017

I am getting an the same error when trying to install. from my research, it looks like 'snprintf' is declared incorrectly and should be called as a standard function instead of declaring it because it has apparently been added to the standard lib? not sure honestly, just what I have managed to gather from trying to fix it myself.

pip install swigibpy

Collecting swigibpy
Using cached swigibpy-0.4.1.tar.gz
Building wheels for collected packages: swigibpy
Running setup.py bdist_wheel for swigibpy ... error
Complete output from command C:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\me\AppData\Local\Temp\pip-build-b5wc6ast\swigibpy\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d C:\Users\me\AppData\Local\Temp\tmp46pw1p5jpip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
copying swigibpy.py -> build\lib.win-amd64-3.6
running build_ext
building '_swigibpy' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
creating build\temp.win-amd64-3.6\Release\IB
creating build\temp.win-amd64-3.6\Release\IB\PosixSocketClient
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DIB_USE_STD_STRING=1 -IIB -IIB/PosixSocketClient -IIB/Shared -IC:\ProgramData\Anaconda3\include -IC:\ProgramData\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\winrt" /EHsc /TpIB/PosixSocketClient/EClientSocketBase.cpp /Fobuild\temp.win-amd64-3.6\Release\IB/PosixSocketClient/EClientSocketBase.obj /D_CRT_SECURE_NO_DEPRECATE /EHsc /wd4355 /wd4800
EClientSocketBase.cpp
C:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt\stdio.h(1931): warning C4005: 'snprintf': macro redefinition
c:\users\me\appdata\local\temp\pip-build-b5wc6ast\swigibpy\ib\shared\StdAfx.h(8): note: see previous definition of 'snprintf'
C:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt\stdio.h(1933): fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2


Failed building wheel for swigibpy
Running setup.py clean for swigibpy
Failed to build swigibpy
Installing collected packages: swigibpy
Running setup.py install for swigibpy ... error
Complete output from command C:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\me\AppData\Local\Temp\pip-build-b5wc6ast\swigibpy\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\me\AppData\Local\Temp\pip-n2axuo5h-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
copying swigibpy.py -> build\lib.win-amd64-3.6
running build_ext
building '_swigibpy' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
creating build\temp.win-amd64-3.6\Release\IB
creating build\temp.win-amd64-3.6\Release\IB\PosixSocketClient
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DIB_USE_STD_STRING=1 -IIB -IIB/PosixSocketClient -IIB/Shared -IC:\ProgramData\Anaconda3\include -IC:\ProgramData\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\winrt" /EHsc /TpIB/PosixSocketClient/EClientSocketBase.cpp /Fobuild\temp.win-amd64-3.6\Release\IB/PosixSocketClient/EClientSocketBase.obj /D_CRT_SECURE_NO_DEPRECATE /EHsc /wd4355 /wd4800
EClientSocketBase.cpp
C:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt\stdio.h(1931): warning C4005: 'snprintf': macro redefinition
c:\users\me\appdata\local\temp\pip-build-b5wc6ast\swigibpy\ib\shared\StdAfx.h(8): note: see previous definition of 'snprintf'
C:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt\stdio.h(1933): fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

----------------------------------------

Command "C:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\me\AppData\Local\Temp\pip-build-b5wc6ast\swigibpy\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\me\AppData\Local\Temp\pip-n2axuo5h-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\me\AppData\Local\Temp\pip-build-b5wc6ast\swigibpy\

@programmingwithalex
Copy link

Commenting out line swigibpy/IB/Shared/StdAfx.h (8) let me install the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants