diff --git a/pkgs/build-support/gcc-cross-wrapper/builder.sh b/pkgs/build-support/gcc-cross-wrapper/builder.sh index 86d18ced54ef..e71e17427202 100644 --- a/pkgs/build-support/gcc-cross-wrapper/builder.sh +++ b/pkgs/build-support/gcc-cross-wrapper/builder.sh @@ -7,8 +7,11 @@ cflagsCompile="-B$out/bin/" if test -z "$nativeLibc"; then cflagsCompile="$cflagsCompile -B$libc/lib/ -isystem $libc/include" ldflags="$ldflags -L$libc/lib" + # Get the proper dynamic linker for glibc and uclibc. dlinker=`eval 'echo $libc/lib/ld-*.so.?'` - ldflagsBefore="-dynamic-linker $dlinker" + if [ -n "$dlinker" ]; then + ldflagsBefore="-dynamic-linker $dlinker" + fi fi if test -n "$nativeTools"; then