SpaceCadetPinball
SpaceCadetPinball copied to clipboard
Builds as a Shared Library instead of an application under Linux
I'm pretty stumped on how to work around this, I've been staying up for hours and now it's 6:30am and I still can't figure out how to make CMake change it's output to an Executable instead of a shared library. No command prefixes I've searched have worked (I keep seeing something about no-pie but nope, nothing)
Any workarounds? It works in the terminal via ./SpaceCadetPinball but then I can't have a shortcut or launcher to it.
Whew ok finally figured it out: open CMakeLists.txt, and add this somewhere
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-pie")
make clean cmake . make
I believe your claims about shared library are false. CMake add_executable should always produce an executable, example:./bin/SpaceCadetPinball: ELF 64-bit LSB pie executable.
Your problem is that your GUI refuses to launch ELF compiled with Position Independent Executable. CMake by default does not use PIE for executables, and I did not enable it in the project. For PIE to appear, it must be forced by the compiler, probably gcc in your case. My gcc also does this, while clang does not. So, you have a conflict of interests: compiler wants more secure ELFs, GUI works against that; a typical Linux problem.
Your workaround that suppresses forced PIE is correct. Another option is to try other compiler.
PIE ELF handling should be fixed upstream.