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

INDI fails to build on Launchpad for 21.04+ #1504

Closed
knro opened this issue Jun 29, 2021 · 4 comments
Closed

INDI fails to build on Launchpad for 21.04+ #1504

knro opened this issue Jun 29, 2021 · 4 comments
Labels

Comments

@knro
Copy link
Contributor

knro commented Jun 29, 2021

Been getting failures for x86-64 and arm64 when compiling INDI on Launchpad.

This happens in the linking step and they are all related to relocation error. That's what I got in a VM:

[  0%] Linking CXX shared library libindidriver.so
/usr/bin/cmake -E cmake_link_script CMakeFiles/indidriver.dir/link.txt --verbose=1
/usr/bin/g++ -fPIC -g -O2 -ffile-prefix-map=/home/jasem/packages/indi=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2 -fstack-protector-all -fPIE -O1 -Wa,--noexecstack  -Wall -Wextra -Wno-unused-but-set-variable -Wno-format-truncation -g -Wl,-Bsymbolic-functions -flto=auto -Wl,-z,relro  -Wl,-z,nodump -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -pie  -shared -Wl,-soname,libindidriver.so.1 -o libindidriver.so.1.9.1 CMakeFiles/indidriver.dir/indidriver.c.o CMakeFiles/indidriver.dir/libs/webcam/v4l2_decode/v4l2_builtin_decoder.cpp.o CMakeFiles/indidriver.dir/libs/indibase/hid_libusb.c.o  -lusb-1.0 -lnova -lpthread -lcfitsio -lm -lz -ljpeg -lfftw3 -ltheoraenc -ltheoradec -logg 
/usr/bin/ld: /tmp/libindidriver.so.1.9.1.MKiPkN.ltrans6.ltrans.o: warning: relocation against `_ZTINSt8__detail11_AnyMatcherINSt7__cxx1112regex_traitsIcEELb1ELb0ELb0EEE' in read-only section `.text'
/usr/bin/ld: /tmp/libindidriver.so.1.9.1.MKiPkN.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC

log.txt

However, we are already setting set(CMAKE_POSITION_INDEPENDENT_CODE ON) in line 9 in CMakelists.txt, so any ideas what's causing this error for newer version of GCC apparently?

@jpaana @jochym @pawel-soja @xsnrg any ideas?

@knro knro added the bug label Jun 29, 2021
@k-ross
Copy link
Contributor

k-ross commented Jun 29, 2021

Could it be because of PIE flags? The documentation states "These options are similar to -fpic and -fPIC, but generated position independent code can be only linked into executables."

@jpaana
Copy link
Contributor

jpaana commented Jun 29, 2021

I compile with 21.04 on x64 and default compiler daily without problems as my dev and observatory machines run that, but haven't seen this one. Differences to my compile options seem to be LTO and hardening related. 21.04 is the first version with lto turned on by default for packages so I tried adding -flto=auto to my build options and got the same error, so that seems to be the culprit (or symptom of some other problem). There is some info on LTO by default in https://wiki.ubuntu.com/ToolChain/LTO

@knro knro closed this as completed in 7fb682d Jun 29, 2021
@knro
Copy link
Contributor Author

knro commented Jun 29, 2021

Could it be because of PIE flags? The documentation states "These options are similar to -fpic and -fPIC, but generated position independent code can be only linked into executables."

That's exactly it, it now makes a valid debian package.

@jpaana compiling works OK, it was failing in creating a debian package via debuild -uc -nc

@jpaana
Copy link
Contributor

jpaana commented Jun 29, 2021

Good, I just got the same error while linking from my normal build with just adding the -flto=auto, but yes, your latest commit fixed that too.

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

3 participants