I am trying to build gcc G4.8.5 for architecture s390x(cross compiled) on x86 32(sles10 patchlevel 4)
for sles12sp2 and i am getting an error

/s390x-suse-linux/bin/ld: cannot find -lm
collect2: error: ld returned 1 exit status
 make[3]: *** [all-recursive] Error 1
 make[3]: Leaving directory `toolchain_s390/build.s390x/gcc/s390x-suse-linux/libstdc++-v3'
 make[2]: *** [all] Error 2
 Error building GCC

Any guidance in right direction is highly appreciated

Update: I am able to build binutils compat compat_binutils compat_gcc compat_gettext compat_links compat_m4 gmp links mpc mpfr


It looks like you’re trying to build the full GCC cross-compiler, but that needs a cross-built libc which you apparently don’t have yet. To build a cross-compiler, you need to

  • build a stage 1 C-only cross-GCC (configure with --languages=c or --languages=c,c++ at the most, build with make all-gcc, install with make install-gcc),
  • use that to build libc for your target,
  • build the full cross-GCC.
  • Did you build the libc too? – Stephen Kitt Apr 5 '17 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.