-
Notifications
You must be signed in to change notification settings - Fork 7
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 #28
Comments
I got it running. I don't know why, but for the static build it is necessary that the linking step is conducted by the c++ compiler instead of the fortran compiler. This can be achived with cmake by setting:
Maybe this should be implemented in nlopt-f. |
If you link static libraries their link dependencies get promoted, in this case there is an indirect dependency on the C++ runtime from NLOpt itself. Defaulting to C++ for linking will probably not work in all cases, instead a new link library could be added (in fact it should be handled by NLOpt's CMake export). |
Another workaround is to include the library "libstdc++" when linking, which has worked for me to operate on both nlopt and nlopt-f in static version.
|
I'm trying to use nlopt-f in a statically compiled executable. But the build process of nlopt-f fails if
BUILD_SHARED_LIBS=OFF
is used.Linker fails with undefined reference error. An excerpt of the log:
If I build also the shared libraries of NLopt the build process of nlopt-f works but my executable has a dependency to the shared library of NLopt.
The text was updated successfully, but these errors were encountered: