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
Static Build errors #904
Comments
Yeah, unfortunately we assume that you want to build a DLL by default. Windows is problematic here -- you have to set things up for either a DLL or a static lib, and they aren't handled the same way. Define -DNN_STATIC_LIB=1 or you can define NNG_DECL=extern -- either will work. I will review our approach for nng and for future nanomsg releases. |
For now I'll add docs to this effect. |
This are the steps to get a static library: (Linux)
Or you can use the following script: #!/bin/bash #Download nanomsg library 1.0 stable #Extract from archive and delete archive #Rename source file #Create destination folder #Switch into nanomsgsrc folder #Create build directory and switch into it #Compile |
There are problems during static build, about unavailability of symbols in static lib.
There are no hint about necessity of including NN_STATIC_LIB as macro define while building with static linkage.
$ g++ pair.c -pthread -lnanomsg C:\msys64\tmp\ccyDAzLi.o:pair.c:(.text+0x57): undefined reference to `__imp_nn_send' C:\msys64\tmp\ccyDAzLi.o:pair.c:(.text+0x94): undefined reference to `__imp_nn_recv' C:\msys64\tmp\ccyDAzLi.o:pair.c:(.text+0xc7): undefined reference to `__imp_nn_freemsg' C:\msys64\tmp\ccyDAzLi.o:pair.c:(.text+0x10d): undefined reference to `__imp_nn_setsockopt' C:\msys64\tmp\ccyDAzLi.o:pair.c:(.text+0x173): undefined reference to `__imp_nn_socket' C:\msys64\tmp\ccyDAzLi.o:pair.c:(.text+0x1a7): undefined reference to `__imp_nn_bind' C:\msys64\tmp\ccyDAzLi.o:pair.c:(.text+0x1e8): undefined reference to `__imp_nn_shutdown' C:\msys64\tmp\ccyDAzLi.o:pair.c:(.text+0x20d): undefined reference to `__imp_nn_socket' C:\msys64\tmp\ccyDAzLi.o:pair.c:(.text+0x241): undefined reference to `__imp_nn_connect' C:\msys64\tmp\ccyDAzLi.o:pair.c:(.text+0x282): undefined reference to `__imp_nn_shutdown' collect2.exe: error: ld returned 1 exit status
The text was updated successfully, but these errors were encountered: