aparcar / openwrt

Staging tree of Paul Spooren
Other
8 stars 1 forks source link

FS#1091 - libiconv-full undefined reference compile-time linking error for x86/_64 using GCC7 Musl #959

Open aparcar opened 6 years ago

aparcar commented 6 years ago

staehle:

LEDE Trunk using latest commit fbde9ac718409720a937671f3354837223b5db76 Feeds all using latest trunk sources, though that shouldn't affect this Target is "x86" Generic (also tried x86_64) Selected GCC 7 for compiler options .config is attached

Problem discovered when enabling the 'minidlna' package, which has a dependency on 'libiconv-full' - a core LEDE package.

Compilation fails on 'libiconv-full' with undefined reference errors (linking errors) for objects 'aliases_lookup' and 'aliases2_lookup' in "libiconv.so": make[5]: Entering directory '/home/jstaehle/prem2/depot/lede/build_dir/target-i386_pentium4_musl/libiconv-1.11.1/src' /bin/sh ../libtool --mode=link i486-openwrt-linux-musl-gcc -L/home/jstaehle/prem2/depot/lede/staging_dir/target-i386_pentium4_musl/usr/lib -L/home/jstaehle/prem2/depot/lede/staging_dir/target-i386_pentium4_musl/lib -L/home/jstaehle/prem2/depot/lede/staging_dir/toolchain-i386_pentium4_gcc-7.2.0_musl/usr/lib -L/home/jstaehle/prem2/depot/lede/staging_dir/toolchain-i386_pentium4_gcc-7.2.0_musl/lib -znow -zrelro iconv_no_i18n.o ../srclib/libicrt.a ../lib/libiconv.la -o iconv_no_i18n i486-openwrt-linux-musl-gcc -znow -zrelro iconv_no_i18n.o -o iconv_no_i18n -L/home/jstaehle/prem2/depot/lede/staging_dir/target-i386_pentium4_musl/usr/lib -L/home/jstaehle/prem2/depot/lede/staging_dir/target-i386_pentium4_musl/lib -L/home/jstaehle/prem2/depot/lede/staging_dir/toolchain-i386_pentium4_gcc-7.2.0_musl/usr/lib -L/home/jstaehle/prem2/depot/lede/staging_dir/toolchain-i386_pentium4_gcc-7.2.0_musl/lib ../srclib/libicrt.a ../lib/.libs/libiconv.so -Wl,--rpath -Wl,/home/jstaehle/prem2/depot/lede/build_dir/target-i386_pentium4_musl/libiconv-1.11.1/lib/.libs ../lib/.libs/libiconv.so: undefined reference to aliases_lookup' ../lib/.libs/libiconv.so: undefined reference toaliases2_lookup' collect2: error: ld returned 1 exit status Makefile:64: recipe for target 'iconv_no_i18n' failed make[5]: *** [iconv_no_i18n] Error 1 Full build log is also attached

Tested with a full default configuration and only options enabled being GCC 7 and a modular option for the libiconv-full package, so that should rule out any external influence.

I did find one other reference to this issue on the LEDE forums a few months ago here: [[https://forum.lede-project.org/t/compilation-fails-on-libiconv-full/4504|LEDE Forums: compilation fails on libiconv-full]]

aparcar commented 6 years ago

staehle:

Uh oh, compile log didn't get attached. Here you go. Thanks!

aparcar commented 6 years ago

harrylwc:

add -std=gnu89 to package/libs/libiconv-full/Makefile

TARGET_CFLAGS += $(FPIC) -DUSE_DOS -std=gnu89

aparcar commented 6 years ago

staehle:

Adding '-std=gnu89' to the LEDE package Makefile TARGET_CFLAGS results in a successful compilation. Great answer, harrylwc!

aparcar commented 6 years ago

staehle:

As a note, I submitted a pull request on the LEDE GitHub with this fix: https://github.com/lede-project/source/pull/1455