avr32-toolchain
avr32-toolchain copied to clipboard
Build g++ configuration proposal
Since the projects I need to build witth this toolchain are all C++, I tried to also build the g++, currently not implemented by the Makefile.
I did it more like a copy/paste experiment, based on the gcc code, and less based on any knowledge.
However, the configure parameters I used have no logic behind, I just added those from the gross-g++ over those of build-gcc.
Could you review these configuration details and update the Makefile accordingly, in order to also build the g++?
Thank you,
Liviu
p.s. BTW, why does the Makefile need to build gcc and g++ separately?
.PHONY: prep-g++ prep-g++ stamps/prep-g++: stamps/patch-gcc [ -d stamps ] || mkdir stamps; touch stamps/prep-g++;
.PHONY: build-g++
build-g++ stamps/build-g++: stamps/install-binutils stamps/prep-newlib stamps/prep-g++
mkdir -p build/g++ && cd build/g++ &&
pushd ../../gcc-$(GCC_VERSION) ;
make clean ;
popd ;
../../gcc-$(GCC_VERSION)/configure --prefix=$(PREFIX)
--target=$(TARGET) $(DEPENDENCIES) --enable-languages="c++" --with-gnu-ld
--with-gnu-as --with-newlib --disable-nls --disable-libssp
--with-newlib --with-dwarf2 --enable-sjlj-exceptions
--enable-version-specific-runtime-libs --disable-libstdcxx-pch
--disable-shared
--without-headers
--disable-threads --disable-libmudflap --disable-libgomp
--disable-libunwind-exceptions --disable-libffi --enable-extra-sgxxlite-multilibs
--with-build-time-tools=$(PREFIX)/$(TARGET)/bin
--enable-cxx-flags=$(CFLAGS_FOR_TARGET)
--with-sysroot=$(PREFIX)/$(TARGET)
--with-build-sysroot=$(PREFIX)/$(TARGET)
--with-build-time-tools=$(PREFIX)/$(TARGET)/bin
CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)
LDFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)"
CPPFLAGS_FOR_TARGET="--sysroot=$(PREFIX)/$(TARGET)"
--with-bugurl=$(BUG_URL) &&
$(MAKE) -j$(PROCS)
[ -d stamps ] || mkdir stamps
touch stamps/build-g++;
.PHONY: install-g++
install-g++ stamps/install-g++: stamps/build-g++
cd build/g++ &&
$(MAKE) installdirs install-target &&
$(MAKE) -C gcc install-common install-cpp install- install-driver install-headers install-man
[ -d stamps ] || mkdir stamps
touch stamps/install-g++;
FYI, running a command like
$ strings avr32-g++ | grep configure
on the Atmel Toolchain for Linux produced the following result:
/home/tools/hudson/workspace/avr32-gnu-toolchain/src/gcc/configure --target=avr32 --host=i686-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/home/tools/hudson/workspace/avr32-gnu-toolchain/avr32-gnu-toolchain-linux_x86 --enable-languages=c,c++ --disable-nls --disable-libssp --disable-libstdcxx-pch --with-dwarf2 --enable-version-specific-runtime-libs --disable-shared --enable-doc --with-mpfr-lib=/home/tools/hudson/workspace/avr32-gnu-toolchain/avr32-gnu-toolchain-linux_x86/lib --with-mpfr-include=/home/tools/hudson/workspace/avr32-gnu-toolchain/avr32-gnu-toolchain-linux_x86/include --with-gmp=/home/tools/hudson/workspace/avr32-gnu-toolchain/avr32-gnu-toolchain-linux_x86 --enable-__cxa_atexit --disable-shared --with-newlib --with-pkgversion=AVR_32_bit_GNU_Toolchain_3.2.3_261 --with-bugurl=http://www.atmel.com/avr
Thanks for the config options from the Linux toolchain that should be helpful. In reference to the lack of logic, it's possible that there are some things in there that are unneeded or don't have useful effects in this particular build situation, but gcc and newlib in particular have some arcane options and flags that are sometimes necessary or were suggested to help certain issues at different times. It's possible that there's some unnecessary cruft depending on the GCC version and the platform being used :-)
p.s. BTW, why does the Makefile need to build gcc and g++ separately?
GCC needs to be bootstrapped to build g++ as far as I can recall. So, instead of doing a bare bootstrap install and then recompiling gcc with c & c++ enabled, I install the C version first which then allows the rest of it to be built. There's a bit of information about it here: http://gcc.gnu.org/install/build.html
The example I started with used the approach of building the C then C++ compilers as stages rather than building a minimal bootstrap version then the C/C++ and it has seemed to work fine for me, however I don't use g++ a huge amount so if you have trouble, definitely file an issue and I can look into it, especially if you have a test case I can run.
I'll give this a try and push it to the repo if it builds for me as well.
Hmm... do I miss something? After the successful build there is avr32-g++ and it tends to work for me.