mspgcc-install icon indicating copy to clipboard operation
mspgcc-install copied to clipboard

Feature req: cross-compilation on arm platform

Open hodiapa opened this issue 12 years ago • 5 comments

What is required to enable a compilation on an arm platform? Would like to have mspgcc running on raspberrypi/beaglebone based systems. --Thanks

hodiapa avatar Jul 16 '13 16:07 hodiapa

I naively tried (and failed) to compile it on a raspberry I have. When building gcc it fails with the following message:

gcc   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat   -DHAVE_CONFIG_H -DGENERATOR_FILE  -o build/gengtype \
        build/gengtype.o build/errors.o build/gengtype-lex.o build/gengtype-parse.o build/gengtype-state.o build/version.o ../build-armv6l-unknown-linux-gnueabi/libiberty/libiberty.a
/bin/bash ../../../gcc-4.6.3/gcc/../move-if-change tmp-gi.list gtyp-input.list
echo timestamp > s-gtyp-input
build/gengtype  \
                    -S ../../../gcc-4.6.3/gcc -I gtyp-input.list -w gtype.state
build/gengtype  \
                    -r gtype.state
make[2]: *** [s-gtype] Killed
make[2]: Leaving directory `/home/pi/mspgcc-install/mspgcc-20120406/BUILD/gcc/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/home/pi/mspgcc-install/mspgcc-20120406/BUILD/gcc'
make: *** [all] Error 2

I'll have a go with a BeagleBone Black tomorrow, so that we can see if it's a RPi-specific issue.

jlhonora avatar Jul 16 '13 21:07 jlhonora

rather than compiling it directly on the raspberrypi/beaglebone; could you use a crosscompiler for arm like the linaro or the code sourcery toolchain and compile it on the host machine? this would be an ideal solution cause it will take a veryyyy long time to do actual compilation on the target(raspberrypi/beaglebone/arm)

hodiapa avatar Jul 16 '13 21:07 hodiapa

I'm not very familiar with linaro or with using the CS toolchain to cross compile GCC, that's why I tried with the most simple approach. Feel free to try it yourself!

I know it does take a while compiling it directly on the Pi, I know it firsthand :). Anyway, I have a bunch of idle raspberries sitting at the office, so I'll just wait. Maybe the best solution for getting it running in these archs is to wait for package maintainers to upload pre-compiled packages. But with the upcoming Red Hat msp430-gcc release there's no clear future of how this will be done.

On Tue, Jul 16, 2013 at 5:15 PM, hodiapa [email protected] wrote:

rather than compiling it directly on the raspberrypi/beaglebone; could you use a crosscompiler for arm like the linaro or the code sourcery toolchain and compile it on the host machine? this would be an ideal solution cause it will take a veryyyy long time to do actual compilation on the target(raspberrypi/beaglebone/arm)

— Reply to this email directly or view it on GitHubhttps://github.com/jlhonora/mspgcc-install/issues/4#issuecomment-21074581 .

jlhonora avatar Jul 16 '13 21:07 jlhonora

I am going to try this, but seems like if we declare following macros in the beginning of the script, we could possibly do the cross compilation.

CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags build_configargs additional configure arguments for build directories host_configargs additional configure arguments for host directories target_configargs additional configure arguments for target directories AR AR for the host AS AS for the host DLLTOOL DLLTOOL for the host LD LD for the host LIPO LIPO for the host NM NM for the host RANLIB RANLIB for the host STRIP STRIP for the host WINDRES WINDRES for the host WINDMC WINDMC for the host OBJCOPY OBJCOPY for the host OBJDUMP OBJDUMP for the host

hodiapa avatar Jul 16 '13 21:07 hodiapa

hi.. I have made a test script which is currently built only for the binutils package for arm platform for the msp430. you can try running the following: https://gist.github.com/hodiapa/64096d132febde0c1773

Will try to test the remaining packages tommorrow

hodiapa avatar Jul 18 '13 00:07 hodiapa