PYNQ: PYTHON PRODUCTIVITY

Collect2: error: ld returned 1 exit status

Hello Pynq Support,

I am rebuilding PYNQ for Ultra96 to add some customized package and I got error collect2: error: ld returned 1 exit status when the script is running gcc-mb. I am have this error with both Ubuntu 16.04 and 18.04.

This is a part of the log:
[DEBUG] Missing: ‘x86_64-pc-linux-gnu-windres’ or ‘x86_64-pc-linux-gnu-windres’ or ‘windres’ : not required.
[DEBUG] ‘aarch64-host_unknown-linux-gnu-ar’ -> ‘/tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-ar’
[DEBUG] ==> Executing: ‘chmod’ ‘700’ ‘/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/bin/aarch64-host_unknown-linux-gnu-ar’
[DEBUG] ==> Return status 0
[DEBUG] ‘aarch64-host_unknown-linux-gnu-as’ -> ‘/tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-as’
[DEBUG] ==> Executing: ‘chmod’ ‘700’ ‘/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/bin/aarch64-host_unknown-linux-gnu-as’
[DEBUG] ==> Return status 0
[DEBUG] Missing: ‘aarch64-linux-gnu-dlltool’ or ‘aarch64-linux-gnu-dlltool’ or ‘dlltool’ : not required.
[DEBUG] ‘aarch64-host_unknown-linux-gnu-gcc’ -> ‘/tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-gcc’
[DEBUG] ==> Executing: ‘chmod’ ‘700’ ‘/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/bin/aarch64-host_unknown-linux-gnu-gcc’
[DEBUG] ==> Return status 0
[DEBUG] ‘aarch64-host_unknown-linux-gnu-g++’ -> ‘/tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++’
[DEBUG] ==> Executing: ‘chmod’ ‘700’ ‘/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/bin/aarch64-host_unknown-linux-gnu-g++’
[DEBUG] ==> Return status 0
[DEBUG] Testing ‘! ( = y )’
[DEBUG] Missing: ‘aarch64-linux-gnu-gnatbind’ or ‘aarch64-linux-gnu-gnatbind’ or ‘gnatbind’ : not required.
[DEBUG] Missing: ‘aarch64-linux-gnu-gnatmake’ or ‘aarch64-linux-gnu-gnatmake’ or ‘gnatmake’ : not required.
[DEBUG] ‘aarch64-host_unknown-linux-gnu-ld’ -> ‘/tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-ld’
[DEBUG] ==> Executing: ‘chmod’ ‘700’ ‘/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/bin/aarch64-host_unknown-linux-gnu-ld’
[DEBUG] ==> Return status 0
[DEBUG] ‘aarch64-host_unknown-linux-gnu-nm’ -> ‘/tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-nm’
[DEBUG] ==> Executing: ‘chmod’ ‘700’ ‘/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/bin/aarch64-host_unknown-linux-gnu-nm’
[DEBUG] ==> Return status 0
[DEBUG] ‘aarch64-host_unknown-linux-gnu-objcopy’ -> ‘/tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-objcopy’
[DEBUG] ==> Executing: ‘chmod’ ‘700’ ‘/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/bin/aarch64-host_unknown-linux-gnu-objcopy’
[DEBUG] ==> Return status 0
[DEBUG] ‘aarch64-host_unknown-linux-gnu-objdump’ -> ‘/tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-objdump’
[DEBUG] ==> Executing: ‘chmod’ ‘700’ ‘/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/bin/aarch64-host_unknown-linux-gnu-objdump’
[DEBUG] ==> Return status 0
[DEBUG] ‘aarch64-host_unknown-linux-gnu-ranlib’ -> ‘/tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-ranlib’
[DEBUG] ==> Executing: ‘chmod’ ‘700’ ‘/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/bin/aarch64-host_unknown-linux-gnu-ranlib’
[DEBUG] ==> Return status 0
[DEBUG] ‘aarch64-host_unknown-linux-gnu-strip’ -> ‘/tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-strip’
[DEBUG] ==> Executing: ‘chmod’ ‘700’ ‘/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/bin/aarch64-host_unknown-linux-gnu-strip’
[DEBUG] ==> Return status 0
[DEBUG] Missing: ‘aarch64-linux-gnu-windres’ or ‘aarch64-linux-gnu-windres’ or ‘windres’ : not required.
[DEBUG] ‘makeinfo’ -> ‘/usr/bin/makeinfo’
[DEBUG] ==> Executing: ‘chmod’ ‘700’ ‘/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/bin/makeinfo’
[DEBUG] ==> Return status 0
[DEBUG] CFLAGS for build compiler: '-O2 -g -I/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/include ’
[DEBUG] LDFLAGS for build compiler: '-L/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/lib ’
[DEBUG] CFLAGS for host compiler: ‘-O2 -g -pipe -I/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/complibs-host/include --sysroot=/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/sysroot.aarch64’
[DEBUG] LDFLAGS for host compiler: ‘-L/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/complibs-host/lib --sysroot=/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/sysroot.aarch64’
[DEBUG] =================================================================
[DEBUG] Checking that we can run gcc -v
[DEBUG] ==> Executing: ‘aarch64-host_unknown-linux-gnu-gcc’ ‘-v’
[DEBUG] Using built-in specs.
[DEBUG] COLLECT_GCC=/tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-gcc
[DEBUG] COLLECT_LTO_WRAPPER=/tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/…/libexec/gcc/aarch64-linux-gnu/8.2.0/lto-wrapper
[DEBUG] Target: aarch64-linux-gnu
[DEBUG] Configured with: /proj/esdt_sdk/gnu_abe/ABE/builds/lin/arm/arm-linux/snapshots/gcc-8.2.0/configure SHELL=/bin/sh --with-bugurl=https://bugs.linaro.org --with-mpc=/proj/esdt_sdk/gnu_abe/ABE/builds/lin/aarch64/aarch64-linux/builds/destdir/x86_64-unknown-linux-gnu --with-mpfr=/proj/esdt_sdk/gnu_abe/ABE/builds/lin/aarch64/aarch64-linux/builds/destdir/x86_64-unknown-linux-gnu --with-gmp=/proj/esdt_sdk/gnu_abe/ABE/builds/lin/aarch64/aarch64-linux/builds/destdir/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld --disable-libstdcxx-pch --disable-libmudflap --with-cloog=no --with-ppl=no --with-isl=no --disable-nls --enable-c99 --enable-gnu-indirect-function --disable-multilib --with-arch=armv8-a --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419 --enable-multiarch CFLAGS=-O2 CXXFLAGS=-O2 --disable-silent-rules --enable-libquadmath --enable-libg2c --enable-symvers=gnu --enable-libstdcxx-pch --disable-libssp --disable-libmudflap --enable-checking=release --enable-cheaders=c_global --enable-poison-system-directories --enable-clocale=generic --enable-shared --enable-threads=posix --disable-multilib --enable-c99 --without-local-prefix --enable-lto --disable-bootstrap --with-linker-hash-style=gnu --with-ppl=no --with-cloog=no --without-isl --enable-nls --enable-__cxa_atexit --with-build-sysroot=/proj/esdt_sdk/gnu_abe/ABE/builds/lin/aarch64/aarch64-linux/builds/destdir/x86_64-unknown-linux-gnu/aarch64-linux-gnu/libc --enable-plugins --enable-linker-build-id --enable-long-long --enable-shared --with-sysroot=/proj/esdt_sdk/gnu_abe/ABE/builds/lin/aarch64/aarch64-linux/builds/destdir/x86_64-unknown-linux-gnu/aarch64-linux-gnu/libc --enable-languages=c,c++,lto --enable-checking=yes --disable-bootstrap --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=aarch64-linux-gnu --prefix=/proj/esdt_sdk/gnu_abe/ABE/builds/lin/aarch64/aarch64-linux/builds/destdir/x86_64-unknown-linux-gnu
[DEBUG] Thread model: posix
[DEBUG] gcc version 8.2.0 (GCC)
[DEBUG] ==> Return status 0
[DEBUG] Checking that we can run gcc -v: done in 0.01s (at 00:01)
[DEBUG] =================================================================
[DEBUG] Checking that gcc can compile a trivial program
[DEBUG] ==> Executing: ‘aarch64-host_unknown-linux-gnu-gcc’ ‘-O2’ ‘-g’ ‘-pipe’ ‘-I/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/complibs-host/include’ ‘–sysroot=/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/sysroot.aarch64’ ‘-L/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/buildtools/complibs-host/lib’ ‘–sysroot=/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/sysroot.aarch64’ ‘/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/build/test.c’ ‘-o’ ‘/media/duyliontran/Data/xilinx/PYNQ/sdbuild/build/gcc-mb/.build/HOST-aarch64-linux-gnu/microblazeel-xilinx-elf/build/.gccout’
[DEBUG] /tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/…/lib/gcc/aarch64-linux-gnu/8.2.0/…/…/…/…/aarch64-linux-gnu/bin/ld: cannot find crt1.o: No such file or directory
[DEBUG] /tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/…/lib/gcc/aarch64-linux-gnu/8.2.0/…/…/…/…/aarch64-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
[DEBUG] /tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/…/lib/gcc/aarch64-linux-gnu/8.2.0/…/…/…/…/aarch64-linux-gnu/bin/ld: cannot find -lc
[DEBUG] /tools/Xilinx/SDK/2019.1/gnu/aarch64/lin/aarch64-linux/bin/…/lib/gcc/aarch64-linux-gnu/8.2.0/…/…/…/…/aarch64-linux-gnu/bin/ld: cannot find crtn.o: No such file or directory
[ERROR] collect2: error: ld returned 1 exit status
[ERROR]
[ERROR] >>
[ERROR] >> Build failed in step ‘Checking that gcc can compile a trivial program’
[ERROR] >> called in step ‘(top-level)’
[ERROR] >>
[ERROR] >> Error happened in: CT_DoExecLog[scripts/functions@376]
[ERROR] >> called from: main[scripts/crosstool-NG.sh@611]
[ERROR] >>
[ERROR] >> For more info on this error, look at the file: ‘build.log’
[ERROR] >> There is a list of known issues, some with workarounds, in:
[ERROR] >> https://crosstool-ng.github.io/docs/known-issues/
[ERROR] >>
[ERROR] >> NOTE: Your configuration includes features marked EXPERIMENTAL.
[ERROR] >> Before submitting a bug report, try to reproduce it without enabling
[ERROR] >> any experimental features. Otherwise, you’ll need to debug it
[ERROR] >> and present an explanation why it is a bug in crosstool-NG - or
[ERROR] >> preferably, a fix.
[ERROR] >>
[ERROR] >> NOTE: You configuration uses non-default patch sets. Please
[ERROR] >> select ‘bundled’ as the set of patches applied and attempt
[ERROR] >> to reproduce this issue. Issues reported with other patch
[ERROR] >> set selections (none, local, bundled+local) are going to be
[ERROR] >> closed without explanation.
[ERROR] >>
[ERROR] >> If you feel this is a bug in crosstool-NG, report it at:
[ERROR] >> https://github.com/crosstool-ng/crosstool-ng/issues/
[ERROR] >>
[ERROR] >> Make sure your report includes all the information pertinent to this issue.
[ERROR] >> Read the bug reporting guidelines here:
[ERROR] >> http://crosstool-ng.github.io/support/
[ERROR]
[ERROR] (elapsed: 0:00.61)

I tried to delete the gcc-mb folder, rebuild again but the result is still the same. Similar problem here: PYNQ 2.5 ct-ng build error

Thanks and best regards,
Duy

You may want to check if the ct-ng is up-to-date. Have you run setup_host.sh before you started to build 2.5 image, or did you just use an old VM / Ubuntu machine?

Hello @rock,

I already run setup_host.sh before starting to build. I use the 18.04 Ubuntu and installed it on the laptop. Everything on my computer is up-to-date.

Thanks and best regards,
Duy

I would suggest restart the OS, then run make clean before you try make again.