[LEDE-DEV] Bug#842710: [gcc-6] Fails to compile OpenWrt/LEDE prereq-build

Charlemagne Lasse charlemagnelasse at gmail.com
Mon Oct 31 07:30:32 PDT 2016


Package: gcc-6
Version: 6.2.0-10
Severity: serious
X-Debbugs-CC: lede-dev at lists.infradead.org

There is a regression after gcc-6 6.2.0-6. I get following output when
trying to compile LEDE/OpenWrt "Please install a static zlib"

This is wrong

$ ls -ltr /usr/lib/x86_64-linux-gnu/libz.a
-rw-r--r-- 1 root root 149834 Nov 27  2014 /usr/lib/x86_64-linux-gnu/libz.a

Following can be found in their include/prereq-build.mk

ifeq ($(HOST_OS),Linux)
  zlib_link_flags := -Wl,-Bstatic -lz -Wl,-Bdynamic
else
  zlib_link_flags := -lz
endif

$(eval $(call TestHostCommand,zlib, \
Please install a static zlib. (Missing libz.a or zlib.h), \
echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - $(zlib_link_flags)))

Testing it with gcc-6 6.2.0-6 works:

$ echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0;
}' | gcc -include zlib.h -x c -o a.out - -Wl,-Bstatic -lz
-Wl,-Bdynamic
$ echo $?
0

with gcc-6 6.2.0-10 fails:

$ echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0;
}' | gcc -include zlib.h -x c -o a.out - -Wl,-Bstatic -lz
-Wl,-Bdynamic
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libz.a(gzlib.o):
relocation R_X86_64_32S against `.rodata' can not be used when making
a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
$ echo $?
1



More information about the Lede-dev mailing list