Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add -no-pie option to CMAKE_CXX_LINK_FLAGS #987

Closed
wants to merge 2 commits into from

Conversation

ltgouvea
Copy link

Fixes compiling issues with libogg in Mint Linux 19

This is the error I've encountered compiling otclient in Mint Linux 19 without this option

/usr/bin/x86_64-linux-gnu-ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libogg.a(framing.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC

to fix compiling issues with libogg in Ubuntu 18
Copy link
Contributor

@okk3 okk3 left a comment

Choose a reason for hiding this comment

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

Hello there, you're missing a comma(,) in this changed line:
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -no-pie -Wl,-Map=${PROJECT_NAME}.map")
Here's the correction for it:
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -no-pie, -Wl,-Map=${PROJECT_NAME}.map")

Best Wishes,
Okke

@ltgouvea
Copy link
Author

ltgouvea commented Dec 2, 2018

Thanks, @okk3! I applied it but the PR still fails the CI test with the following output, it seems this option is not recognized in its context although I've been able to build locally without errors.

[100%] Linking CXX executable otclient
g++: error: unrecognized command line option ‘-no-pie,’
make[2]: *** [otclient] Error 1
make[1]: *** [CMakeFiles/otclient.dir/all] Error 2
make: *** [all] Error 2
The command "cmake . -DCMAKE_BUILD_TYPE=Release
make
" exited with 2.

@iryont iryont closed this Jan 16, 2019
@JSkalskiSBG
Copy link

I had to edit this line to:

set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fPIC -no-pie -Wl,-map=${PROJECT_NAME}.map")

to make it work.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants