Skip to content

Instantly share code, notes, and snippets.

@fgretief
Created September 3, 2013 20:53
Show Gist options
  • Save fgretief/6429416 to your computer and use it in GitHub Desktop.
Save fgretief/6429416 to your computer and use it in GitHub Desktop.
GCC verbose output of a compile on Windows with OpenEmbedded MinGW SDK
make: Entering directory `F:/workspace_4.3/TestOeSdk/Debug'
'Building target: TestOeSdk'
'Invoking: Cross GCC Linker'
arm-oe-linux-gnueabi-gcc -L"F:\Programs\oecore-x86_64-armv5te-toolchain-oe-core.0\sysroots\armv5te-oe-linux-gnueabi\usr\lib" -L"F:\Programs\oecore-x86_64-armv5te-toolchain-oe-core.0\sysroots\armv5te-oe-linux-gnueabi\lib" -L"F:\Programs\oecore-x86_64-armv5te-toolchain-oe-core.0\sysroots\armv5te-oe-linux-gnueabi\usr\lib\arm-oe-linux-gnueabi\4.8.1" --verbose -o "TestOeSdk" ./src/TestOeSdk.o
Using built-in specs.
COLLECT_GCC=arm-oe-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=f:/programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/x86_64-oesdk-mingw32/usr/bin/armv5te-oe-linux-gnueabi/../../libexec/armv5te-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.8.1/lto-wrapper.exe
Target: arm-oe-linux-gnueabi
Configured with: /home/fgretief/u/core-oe/tmp-eglibc/work-shared/gcc-4.8.1-r0/gcc-4.8.1/configure --build=x86_64-linux --host=x86_64-oesdk-mingw32 --target=arm-oe-linux-gnueabi --prefix=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-mingw32/usr --exec_prefix=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-mingw32/usr --bindir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-mingw32/usr/bin/armv5te-oe-linux-gnueabi --sbindir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-mingw32/usr/bin/armv5te-oe-linux-gnueabi --libexecdir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-mingw32/usr/libexec/armv5te-oe-linux-gnueabi --datadir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-mingw32/usr/share --sysconfdir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-mingw32/etc --sharedstatedir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-mingw32/com --localstatedir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-mingw32/var --libdir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-mingw32/usr/lib/armv5te-oe-linux-gnueabi --includedir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-mingw32/usr/include --oldincludedir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-mingw32/usr/include --infodir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-mingw32/usr/share/info --mandir=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-mingw32/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/home/fgretief/u/core-oe/tmp-eglibc/sysroots/x86_64-nativesdk-oesdk-mingw32 --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-oe-linux-gnueabi- --without-local-prefix --enable-target-optspace --enable-lto --enable-libssp --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --with-float=soft --with-gxx-include-dir=/usr/local/oecore-x86_64/sysroots/armv5te-oe-linux-gnueabi/usr/include/c++ --with-build-time-tools=/home/fgretief/u/core-oe/tmp-eglibc/sysroots/x86_64-linux/usr/arm-oe-linux-gnueabi/bin --with-sysroot=/usr/local/oecore-x86_64/sysroots/armv5te-oe-linux-gnueabi --with-build-sysroot=/home/fgretief/u/core-oe/tmp-eglibc/sysroots/qemuarm --disable-libunwind-exceptions --disable-libssp --disable-libgomp --disable-libmudflap --with-mpfr=/home/fgretief/u/core-oe/tmp-eglibc/sysroots/x86_64-nativesdk-oesdk-mingw32 --with-mpc=/home/fgretief/u/core-oe/tmp-eglibc/sysroots/x86_64-nativesdk-oesdk-mingw32 --enable-nls --disable-nls
Thread model: posix
gcc version 4.8.1 (GCC)
COMPILER_PATH=f:/programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/x86_64-oesdk-mingw32/usr/bin/armv5te-oe-linux-gnueabi/../../libexec/armv5te-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.8.1/;f:/programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/x86_64-oesdk-mingw32/usr/bin/armv5te-oe-linux-gnueabi/../../libexec/armv5te-oe-linux-gnueabi/gcc/
LIBRARY_PATH=f:/programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/x86_64-oesdk-mingw32/usr/bin/armv5te-oe-linux-gnueabi/../../lib/armv5te-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.8.1/;f:/programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/x86_64-oesdk-mingw32/usr/bin/armv5te-oe-linux-gnueabi/../../lib/armv5te-oe-linux-gnueabi/gcc/
COLLECT_GCC_OPTIONS='-LF:\Programs\oecore-x86_64-armv5te-toolchain-oe-core.0\sysroots\armv5te-oe-linux-gnueabi\usr\lib' '-LF:\Programs\oecore-x86_64-armv5te-toolchain-oe-core.0\sysroots\armv5te-oe-linux-gnueabi\lib' '-LF:\Programs\oecore-x86_64-armv5te-toolchain-oe-core.0\sysroots\armv5te-oe-linux-gnueabi\usr\lib\arm-oe-linux-gnueabi\4.8.1' '-v' '-o' 'TestOeSdk' '-mfloat-abi=soft' '-mtls-dialect=gnu'
f:/programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/x86_64-oesdk-mingw32/usr/bin/armv5te-oe-linux-gnueabi/../../libexec/armv5te-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.8.1/collect2.exe --sysroot=/usr/local/oecore-x86_64/sysroots/armv5te-oe-linux-gnueabi --build-id --eh-frame-hdr --hash-style=gnu -dynamic-linker /lib/ld-linux.so.3 -X -m armelf_linux_eabi -o TestOeSdk crt1.o crti.o crtbegin.o -LF:\Programs\oecore-x86_64-armv5te-toolchain-oe-core.0\sysroots\armv5te-oe-linux-gnueabi\usr\lib -LF:\Programs\oecore-x86_64-armv5te-toolchain-oe-core.0\sysroots\armv5te-oe-linux-gnueabi\lib -LF:\Programs\oecore-x86_64-armv5te-toolchain-oe-core.0\sysroots\armv5te-oe-linux-gnueabi\usr\lib\arm-oe-linux-gnueabi\4.8.1 -Lf:/programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/x86_64-oesdk-mingw32/usr/bin/armv5te-oe-linux-gnueabi/../../lib/armv5te-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.8.1 -Lf:/programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/x86_64-oesdk-mingw32/usr/bin/armv5te-oe-linux-gnueabi/../../lib/armv5te-oe-linux-gnueabi/gcc ./src/TestOeSdk.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o crtn.o
f:/programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/x86_64-oesdk-mingw32/usr/bin/armv5te-oe-linux-gnueabi/../../libexec/armv5te-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.8.1/ld.exe: cannot find crt1.o: No such file or directory
f:/programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/x86_64-oesdk-mingw32/usr/bin/armv5te-oe-linux-gnueabi/../../libexec/armv5te-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.8.1/ld.exe: cannot find crti.o: No such file or directory
f:/programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/x86_64-oesdk-mingw32/usr/bin/armv5te-oe-linux-gnueabi/../../libexec/armv5te-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/4.8.1/ld.exe: cannot find crtbegin.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
make: *** [TestOeSdk] Error 1
make: Leaving directory `F:/workspace_4.3/TestOeSdk/Debug'
@fgretief
Copy link
Author

fgretief commented Sep 5, 2013

Found a fix. There were 3 things that need to be done.

  1. Need to add a symlink to target directory. Under Windows this can be done with mklink tool:

cd f:/programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/x86_64-oesdk-mingw32/usr
mklink /D arm-oe-linux-gnueabi F:\Programs\oecore-x86_64-armv5te-toolchain-oe-core.0\sysroots\armv5te-oe-linux-gnueabi\usr

  1. The sysroot is wrong and must be set explicitly for the linker.

--sysroot=f:/Programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/armv5te-oe-linux-gnueabi

  1. Lastly, there must be a search path in the linker to be able to find some system files

-Lf:/programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/armv5te-oe-linux-gnueabi/usr/lib

When these 3 changes is in, the process compiles through and executes on ARM hardware.

root@beaglebone:~# ./TestOeSdk
Hello World

@fgretief
Copy link
Author

There was a problem with fix 1) above. It should point to the armv5 sysroot and not to its /usr directory.

cd f:/programs/oecore-x86_64-armv5te-toolchain-oe-core.0/sysroots/x86_64-oesdk-mingw32/usr
mklink /D arm-oe-linux-gnueabi ....\armv5te-oe-linux-gnueabi

Also, we fixed the sysroot in the gcc-cross-canadian_4.8.bbappend recipe by changing the --with-sysroot argument in EXTRA_OECONF_PATHS variable from

${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}
to
${exec_prefix}/../../${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}

The ${exec_prefix} path will be replaced by GCC with its executing path to make the sysroot relative to the install path, thus negating the need to pass --sysroot during compiles and thus eliminating fix 2.

Fix 3) was also eliminated by the correct path in fix 1) and sysroot in 2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment