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

Build time error: `.rodata' can not be used when making a shared object #287

Closed
anatol opened this Issue Dec 29, 2014 · 4 comments

Comments

Projects
None yet
3 participants
@anatol
Copy link

anatol commented Dec 29, 2014

Trying to build the project on Linux Arch and I get a weird build error:

[anatol@arch weechat]$ cmake --version
cmake version 3.1.0

cmake . -DPREFIX=/usr -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so -DENABLE_MAN=ON -DENABLE_DOC=ON
[anatol@arch weechat]$ make VERBOSE=1
/usr/bin/cmake -H/home/anatol/sources/weechat -B/home/anatol/sources/weechat --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/anatol/sources/weechat/CMakeFiles /home/anatol/sources/weechat/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/anatol/sources/weechat'
make -f CMakeFiles/version_git.dir/build.make CMakeFiles/version_git.dir/depend
make[2]: Entering directory '/home/anatol/sources/weechat'
cd /home/anatol/sources/weechat && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/anatol/sources/weechat /home/anatol/sources/weechat /home/anatol/sources/weechat /home/anatol/sources/weechat /home/anatol/sources/weechat/CMakeFiles/version_git.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/anatol/sources/weechat'
make -f CMakeFiles/version_git.dir/build.make CMakeFiles/version_git.dir/build
make[2]: Entering directory '/home/anatol/sources/weechat'
/home/anatol/sources/weechat/scripts/git-version.sh /home/anatol/sources/weechat 1.1-rc1 config-git.h
File config-git.h is up-to-date (git version: "v1.1-rc1-12-gce98526")
make[2]: Leaving directory '/home/anatol/sources/weechat'
/usr/bin/cmake -E cmake_progress_report /home/anatol/sources/weechat/CMakeFiles 
[  0%] Built target version_git
make -f po/CMakeFiles/translations.dir/build.make po/CMakeFiles/translations.dir/depend
make[2]: Entering directory '/home/anatol/sources/weechat'
cd /home/anatol/sources/weechat && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/anatol/sources/weechat /ho[anatol@arch weechat]$ cmake --version
cmake version 3.1.0
me/anatol/sources/weechat/po /home/anatol/sources/weechat /home/anatol/sources/weechat/po /home/anatol/sources/weechat/po/CMakeFiles/translations.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/anatol/sources/weechat'
make -f po/CMakeFiles/translations.dir/build.make po/CMakeFiles/translations.dir/build
make[2]: Entering directory '/home/anatol/sources/weechat'
make[2]: Nothing to be done for 'po/CMakeFiles/translations.dir/build'.
make[2]: Leaving directory '/home/anatol/sources/weechat'
/usr/bin/cmake -E cmake_progress_report /home/anatol/sources/weechat/CMakeFiles  47 48 49 50 51 52
[  6%] Built target translations
make -f src/core/CMakeFiles/weechat_core.dir/build.make src/core/CMakeFiles/weechat_core.dir/depend
make[2]: Entering directory '/home/anatol/sources/weechat'
cd /home/anatol/sources/weechat && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/anatol/sources/weechat /home/anatol/sources/weechat/src/core /home/anatol/sources/weechat /home/anatol/sources/weechat/src/core /home/anatol/sources/weechat/src/core/CMakeFiles/weechat_core.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/anatol/sources/weechat'
make -f src/core/CMakeFiles/weechat_core.dir/build.make src/core/CMakeFiles/weechat_core.dir/build
make[2]: Entering directory '/home/anatol/sources/weechat'
make[2]: Nothing to be done for 'src/core/CMakeFiles/weechat_core.dir/build'.
make[2]: Leaving directory '/home/anatol/sources/weechat'
/usr/bin/cmake -E cmake_progress_report /home/anatol/sources/weechat/CMakeFiles  63 64 65 66 67 68 69 70 71 72 73 74 75 76
[ 21%] Built target weechat_core
make -f src/plugins/CMakeFiles/weechat_plugins.dir/build.make src/plugins/CMakeFiles/weechat_plugins.dir/depend
make[2]: Entering directory '/home/anatol/sources/weechat'
cd /home/anatol/sources/weechat && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/anatol/sources/weechat /home/anatol/sources/weechat/src/plugins /home/anatol/sources/weechat /home/anatol/sources/weechat/src/plugins /home/anatol/sources/weechat/src/plugins/CMakeFiles/weechat_plugins.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/anatol/sources/weechat'
make -f src/plugins/CMakeFiles/weechat_plugins.dir/build.make src/plugins/CMakeFiles/weechat_plugins.dir/build
make[2]: Entering directory '/home/anatol/sources/weechat'
make[2]: Nothing to be done for 'src/plugins/CMakeFiles/weechat_plugins.dir/build'.
make[2]: Leaving directory '/home/anatol/sources/weechat'
/usr/bin/cmake -E cmake_progress_report /home/anatol/sources/weechat/CMakeFiles  92
[ 22%] Built target weechat_plugins
make -f src/plugins/CMakeFiles/weechat_plugins_scripts.dir/build.make src/plugins/CMakeFiles/weechat_plugins_scripts.dir/depend
make[2]: Entering directory '/home/anatol/sources/weechat'
cd /home/anatol/sources/weechat && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/anatol/sources/weechat /home/anatol/sources/weechat/src/plugins /home/anatol/sources/weechat /home/anatol/sources/weechat/src/plugins /home/anatol/sources/weechat/src/plugins/CMakeFiles/weechat_plugins_scripts.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/anatol/sources/weechat'
make -f src/plugins/CMakeFiles/weechat_plugins_scripts.dir/build.make src/plugins/CMakeFiles/weechat_plugins_scripts.dir/build
make[2]: Entering directory '/home/anatol/sources/weechat'
make[2]: Nothing to be done for 'src/plugins/CMakeFiles/weechat_plugins_scripts.dir/build'.
make[2]: Leaving directory '/home/anatol/sources/weechat'
/usr/bin/cmake -E cmake_progress_report /home/anatol/sources/weechat/CMakeFiles  93 94
[ 24%] Built target weechat_plugins_scripts
make -f src/plugins/alias/CMakeFiles/alias.dir/build.make src/plugins/alias/CMakeFiles/alias.dir/depend
make[2]: Entering directory '/home/anatol/sources/weechat'
cd /home/anatol/sources/weechat && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/anatol/sources/weechat /home/anatol/sources/weechat/src/plugins/alias /home/anatol/sources/weechat /home/anatol/sources/weechat/src/plugins/alias /home/anatol/sources/weechat/src/plugins/alias/CMakeFiles/alias.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/anatol/sources/weechat'
make -f src/plugins/alias/CMakeFiles/alias.dir/build.make src/plugins/alias/CMakeFiles/alias.dir/build
make[2]: Entering directory '/home/anatol/sources/weechat'
Linking C shared module alias.so
cd /home/anatol/sources/weechat/src/plugins/alias && /usr/bin/cmake -E cmake_link_script CMakeFiles/alias.dir/link.txt --verbose=1
/usr/bin/cc    -Wall -Wextra -Werror-implicit-function-declaration  -shared -Wl,-soname,alias.so -o alias.so CMakeFiles/alias.dir/alias.o CMakeFiles/alias.dir/alias-config.o CMakeFiles/alias.dir/alias-info.o 
/usr/bin/ld: CMakeFiles/alias.dir/alias.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
CMakeFiles/alias.dir/alias.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
src/plugins/alias/CMakeFiles/alias.dir/build.make:135: recipe for target 'src/plugins/alias/alias.so' failed
make[2]: *** [src/plugins/alias/alias.so] Error 1
make[2]: Leaving directory '/home/anatol/sources/weechat'
CMakeFiles/Makefile2:854: recipe for target 'src/plugins/alias/CMakeFiles/alias.dir/all' failed
make[1]: *** [src/plugins/alias/CMakeFiles/alias.dir/all] Error 2
make[1]: Leaving directory '/home/anatol/sources/weechat'
Makefile:137: recipe for target 'all' failed
make: *** [all] Error 2
@kyrias

This comment has been minimized.

Copy link

kyrias commented Dec 29, 2014

I began bisecting WeeChat but then I got the same when building older versions, both v1.0.0 and v0.4.3, and this doesn’t seem like something changed in WeeChat, more likely the Arch build system.

@kyrias

This comment has been minimized.

Copy link

kyrias commented Dec 29, 2014

Yeah, seems this is due to CMake 3.1 and alias.o not being built with -fPIC even though it’s linked with -shared

@flashcode flashcode added the bug label Dec 30, 2014

@flashcode flashcode closed this in 00ba2e8 Jan 1, 2015

@flashcode

This comment has been minimized.

Copy link
Member

flashcode commented Jan 1, 2015

Please tell me if the problem is fixed by the commit (I don't have cmake 3.1 to test).

@anatol

This comment has been minimized.

Copy link
Author

anatol commented Jan 1, 2015

Yes it fixes the problem - compilation is fine now. Thanks.

@flashcode flashcode added this to the 1.1 milestone Jan 1, 2015

@flashcode flashcode self-assigned this Jan 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.