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

[regression in 0.2.1.6] relocation R_X86_64_PC32 cannot be used against symbol __stack_chk_guard; recompile with -fPIC #553

Closed
yurivict opened this issue Jan 1, 2020 · 5 comments
Labels

Comments

@yurivict
Copy link

yurivict commented Jan 1, 2020

ld: error: relocation R_X86_64_PC32 cannot be used against symbol __stack_chk_guard; recompile with -fPIC
>>> defined in /lib/libc.so.7
>>> referenced by AutoTime.cpp
>>>               CMakeFiles/MNNCore.dir/source/core/AutoTime.cpp.o:(MNN::Timer::Timer())

ld: error: relocation R_X86_64_PC32 cannot be used against symbol __stack_chk_guard; recompile with -fPIC
>>> defined in /lib/libc.so.7
>>> referenced by AutoTime.cpp
>>>               CMakeFiles/MNNCore.dir/source/core/AutoTime.cpp.o:(MNN::Timer::Timer())

clang-8

FreeBSD 12

@Naville
Copy link
Contributor

Naville commented Jan 2, 2020

-fPIC is indeeded added in our CMakeLists and MNN builds without any issue on our Ubuntu CI so I'm a bit confused about what's going on here. Any more context? output of initial cmake configuration or better yet, a full build log would do.

Also please consider using #549 instead so I could track issues better

@yurivict
Copy link
Author

yurivict commented Jan 2, 2020

-fPIC is missing in some command lines. Adding it to CXXFLAGS and CFLAGS environment variables solved the problem.

@Naville
Copy link
Contributor

Naville commented Jan 2, 2020

Right. Unless I'm missing something here, CMakeLists.txt#L173 already sets this flag. And consider this line is above any other target is created/imported, this should have effect on all targets created by CMake.

Are you sure CMAKE_SYSTEM_NAME is Linux on FreeBSD?

@Naville
Copy link
Contributor

Naville commented Jan 2, 2020

So CMAKE_SYSTEM_NAME is FreeBSD on FreeBSD which breaks that part of the logic. This was never discovered in previous versions because the old CMakeLists.txt was passing -fPIC everywhere. This should be fixable in our next release

@Naville Naville closed this as completed Jan 2, 2020
@yurivict
Copy link
Author

yurivict commented Jan 2, 2020

No, on FreeBSD CMAKE_SYSTEM_NAME=FreeBSD

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

No branches or pull requests

2 participants