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

Set -fno-PIE by default as a Ubuntu/Mint workaround #112

Merged
merged 13 commits into from
May 13, 2020

Conversation

ermo
Copy link
Contributor

@ermo ermo commented May 12, 2020

Older versions of Ubuntu and its derivates have an issue where the
file utility will interpret Position Independent Executables as
shared libraries:

https://bugs.launchpad.net/ubuntu/+source/file/+bug/1747711

As a workaround, allow setting the option ENABLE_PIE
(defaults to OFF) and add a suitable message for maintainers in both
the CMake code, during configuration runs and in ccmake.

Update the build instructions in README.md to reflect this change.

Additionally, switch sh/vsbuild.sh to the Debug target (see #50) and enable verbose compilation by default to make it easier to spot errors in CI.

Closes #94

Older versions of Ubuntu and its derivates have an issue where the
`file` utility will interpret Position Independent Executables as
shared libraries:

https://bugs.launchpad.net/ubuntu/+source/file/+bug/1747711

As a workaround, allow setting the option COMPILE_WITH_FPIE
(defaults to OFF) and add a suitable message for maintainers in both
the CMake code, during configuration runs and in ccmake.

Update the build instructions in the README to reflect this change.

Closes vegastrike#94
@Loki1950
Copy link
Member

@ermo you might add Arch to the distros that enable COMPILE_WITH_FPIE they where the first to do so I think

Copy link
Member

@BenjamenMeyer BenjamenMeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In minor suggestion

@ermo ermo closed this May 13, 2020
@ermo ermo reopened this May 13, 2020
@BenjamenMeyer
Copy link
Member

not sure what is up with the builds; seems GCC/G++ doesn't like something but Clang is happy.

ermo added 7 commits May 13, 2020 18:57
This will also aid in debugging when people compile their own local
VS binaries using vsbuild.sh, as using a Debug build is the recommended
way to report bugs per the man page.
Ask cmake to be verbose in a way such that the CI doesn't choke.

Document the arguments in README.md

Unconditionally add `-fno-PIC -fno-PIE` / `-fPIC -fPIE` to
`CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS` depending on the state of the
user configurable COMPILE_WITH_FPIE option, which defaults to OFF.
ermo added 2 commits May 13, 2020 21:02
This requires re-ordering so that CMAKE_C_FLAGS/CMAKE_CXX_FLAGS are set
before the build-type-specific CMAKE_C/CXX_FLAGS_<build-type> variables.
This time, set the options for both compiler and linker.

Add changed option name to README.md too.
@ermo
Copy link
Contributor Author

ermo commented May 13, 2020

PR message updated -- ready for merging on my end.

@BenjamenMeyer BenjamenMeyer merged commit f1584dd into vegastrike:master May 13, 2020
@ermo ermo deleted the cmake-fpie-off-by-default branch May 13, 2020 20:17
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

Successfully merging this pull request may close these issues.

Building on Mint 19.3
4 participants