-
Notifications
You must be signed in to change notification settings - Fork 82
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
Option to build app as a shared library #57
Comments
I would rather add a new keyword 'fips_begin_sharedlib()'? I currently don't have a use case for shared libs, and might not be able to test this well on all platforms though. |
I have added a fips_begin_sharedlib()/fips_end_sharedlib() macro, and added a very simple example to fips-hello-dep1 (https://github.com/floooh/fips-hello-dep1/blob/master/src/sharedlib_test/CMakeLists.txt), I only quickly tested compilation on OSX (results in a .dylib file) and Windows, the DLL is built to fips-deploy/[project]/[config]. Let me know if I forgot something :) |
Reminder for Linux: Linking CXX shared library /home/travis/build/floooh/fips-deploy/fips-hello-dep1/linux-make-debug/libdep1shared.so /usr/bin/ld: ../dep1/libdep1.a(dep1.cc.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC ../dep1/libdep1.a: could not read symbols: Bad value collect2: error: ld returned 1 exit status make[2]: *** [/home/travis/build/floooh/fips-deploy/fips-hello-dep1/linux-make-debug/libdep1shared.so] Error 1 make[1]: *** [src/sharedlib_test/CMakeFiles/dep1shared.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [100%] Built target dep1test |
For some reason I don't understand, dependencies are not handled properly yet. I have a shared library with one module using "fips_libs(OpenGL32)" which fails to link because of missing GL symbols. Debug CMake output indicates that the module is processed after the shared lib. OS X links fine. Linux gives a linker relocation error similar to yours above. edit: I "fixed" the dependency issue by changing the order in which fips_add_subdirectory() was called, moving the directory which contains the shared library after the module which depends on OpenGL32.lib. It may be unreasonably complicated to change the system to be independent of declaration order of modules, which would probably mean to defer all the fips_end_*() logic until the fips_finish() call. |
Hmm, good catch, I can reproduce this by moving the Oryol samples includes above the modules in the root CMakeLists.txt. I'll open a separate ticket for this, but I agree that moving dependency resolution to the end might be too complex... I'll put at least a note into the docs for now. |
Can I close this ticket? |
Sure. :) |
E.g. via fips_begin_app({name} shared).
The text was updated successfully, but these errors were encountered: