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

Win32 Install Error #32

Closed
philipathomas opened this issue Aug 31, 2015 · 4 comments
Closed

Win32 Install Error #32

philipathomas opened this issue Aug 31, 2015 · 4 comments

Comments

@philipathomas
Copy link

Hi All,

Stumbled on a install problem on windows 7 which I'm guessing has something to do with the native windows compiler but google search does not seem to have a fix. Install output bellow, any suggestions on how to fix this is appreciated. Thanks, Phil

C:\scripts\GIT\easysnmp>python setup.py install
'net-snmp-config' is not recognized as an internal or external command,
operable program or batch file.
C:\Python34\lib\site-packages\setuptools-18.2-py3.4.egg\setuptools\dist.py:285: UserWarning: Normalizing '0.2.5-dev' to '0.2.5.dev
0'
running install
running bdist_egg
running egg_info
creating easysnmp.egg-info
writing dependency_links to easysnmp.egg-info\dependency_links.txt
writing top-level names to easysnmp.egg-info\top_level.txt
writing easysnmp.egg-info\PKG-INFO
writing manifest file 'easysnmp.egg-info\SOURCES.txt'
reading manifest file 'easysnmp.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'easysnmp.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build
creating build\lib.win32-3.4
creating build\lib.win32-3.4\easysnmp
copying easysnmp\compat.py -> build\lib.win32-3.4\easysnmp
copying easysnmp\easy.py -> build\lib.win32-3.4\easysnmp
copying easysnmp\exceptions.py -> build\lib.win32-3.4\easysnmp
copying easysnmp\helpers.py -> build\lib.win32-3.4\easysnmp
copying easysnmp\session.py -> build\lib.win32-3.4\easysnmp
copying easysnmp\utils.py -> build\lib.win32-3.4\easysnmp
copying easysnmp\variables.py -> build\lib.win32-3.4\easysnmp
copying easysnmp__init__.py -> build\lib.win32-3.4\easysnmp
running build_ext
building 'easysnmp.interface' extension
creating build\temp.win32-3.4
creating build\temp.win32-3.4\Release
creating build\temp.win32-3.4\Release\easysnmp
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python34\include -IC:
Python34\include /Tceasysnmp/interface.c /Fobuild\temp.win32-3.4\Release\easysnmp/interface.obj -Wno-unused-function
cl : Command line error D8021 : invalid numeric argument '/Wno-unused-function'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe' failed with exit status 2

C:\scripts\GIT\easysnmp>python setup.py build
'net-snmp-config' is not recognized as an internal or external command,
operable program or batch file.
C:\Python34\lib\site-packages\setuptools-18.2-py3.4.egg\setuptools\dist.py:285: UserWarning: Normalizing '0.2.5-dev' to '0.2.5.dev
0'
running build
running build_py
running build_ext
building 'easysnmp.interface' extension
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python34\include -IC:
Python34\include /Tceasysnmp/interface.c /Fobuild\temp.win32-3.4\Release\easysnmp/interface.obj -Wno-unused-function
cl : Command line error D8021 : invalid numeric argument '/Wno-unused-function'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe' failed with exit status 2

@nnathan
Copy link
Contributor

nnathan commented Aug 31, 2015

I've never tried to compile in Win32, but I think this is an obvious incompatibility in the arguments passed to the compiler. I think this can be rectified in the setup.py by changing this line to read compiler_args=[].

If you manage to get it to work in Win32, I'll be happy to patch the setup.py to add Win32 conditionals.

Furthermore, I notice 'net-snmp-config' is not recognized as an internal or external command,. I don't know how well net-snmp compiles or plays nicely in Windows.

@fgimian
Copy link
Collaborator

fgimian commented Feb 29, 2016

Yep, as Naveen mentioned, I really don't think we can target Windows as a compatible platform for this library. It really was designed and tested on Linux only.

As such, I will be closing this case.

Cheers
Fotis

@fgimian fgimian closed this as completed Feb 29, 2016
@kamakazikamikaze
Copy link
Collaborator

I've actually been playing around with trying to make this compile on Windows today. I've made a little (if truly any) progress. I didn't realize how truly terrible/rusty I am with C/C++ until I spent the last few hours working with errors.

Thus far I have:

  • Omit '-Wno-unused-function' if the platform is win32
  • Converted GCC flags for --debug to potentially Windows-equivalent ones
    • -Wall => /Wall
    • -O0 => /Od
    • -g => /Zi
  • Browse the registry for the Net-SNMP key to retrieve the base directory
  • Potentially identified the correct libs values to pass

This, of course, opened up a whole can of worms with cross-platform compatibility. So in interfaces.c I've had to add:

#ifdef _MSC_VER

typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
typedef int mode_t;

#else
#include <stdint.h>
#endif
// I could probably merge these two, but I can clean that up later
#ifdef _WIN32
#include <winsock2.h>
#else
#include <arpa/inet.h>
#include <netdb.h>
#endif

Now I'm just encountering an issue with some enumerators, specifically:
. . .\easysnmp\easysnmp\interface.c(107) : error C2059: syntax error : 'constant'
which points to:
enum { INFO, WARNING, ERROR, DEBUG, EXCEPTION };

I don't see any of these being predefined macros in VS 2010. I suppose it could be ERROR because I later see:
\easysnmp\easysnmp\interface.c(2789) : error C2065: 'DEBUG' : undeclared identifier
\easysnmp\easysnmp\interface.c(3624) : error C2065: 'EXCEPTION' : undeclared identifier

I guess I should open this up as a Visual Studio project to get more details,

@kamakazikamikaze
Copy link
Collaborator

Ok, it's definitely ERROR. I'm assuming that it's supposed to work since it's coming from net-snmp/net-snmp-includes.h?

EDIT

Just to invite a little humor, I felt like I was taking a 100-level CS course all over again by cutting and pasting this block around to figure out where the issue was.

#ifdef ERROR
#error Error is defined
#elif defined DEBUG
#error Debug is defined
#elif defined WARNING
#error Warning is defined
#elif defined INFO
#error Info is defined
#elif defined EXCEPTION
#error Exception is defined
#endif

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

4 participants