Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Building GCC: (7 Items)
   
Building GCC  
Are the instruction for building gcc found on the wiki still valid (http://community.qnx.com/sf/wiki/do/viewPage/
projects.toolchain/wiki/Resources_GCC)

I had to edit build_hooks to replace reference to 8.0.0 for 6.5.0 but I'm still having strange issues.  Wanted to check 
if it should work as per the instruction before diving into this.

- Mario
Re: Building GCC  
For the most part, yes, there are some minor things you might run into, but should be pretty obvious once you hit them.

1) You may need to change the SDP version, as you found out already.
2) You may need to update 'basedir' for linux hosted cross compilers as it won't install into QNX_HOST like the other 
hosts.
3) You may need updated versions of GCC's prerequisites. GCC source includes a script to grab them (./contrib/
download_prerequisites), or we have recent versions in the source tree.
Re: Building GCC  
> For the most part, yes, there are some minor things you might run into, but 
> should be pretty obvious once you hit them.
> 
> 1) You may need to change the SDP version, as you found out already.

- Done

> 2) You may need to update 'basedir' for linux hosted cross compilers as it 
> won't install into QNX_HOST like the other hosts.

Will do,.

> 3) You may need updated versions of GCC's prerequisites. GCC source includes a
>  script to grab them (./contrib/download_prerequisites), or we have recent 
> versions in the source tree.

Forgot to mention it but I did that already.


First time I run it, it stops at:

mkdir 32
configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.

The second time it failes with :

make "AR_FLAGS=rc" "CC_FOR_BUILD=gcc" "CFLAGS=-O2" "CXXFLAGS=-g -O2" "CFLAGS_FOR_BUILD=-g -O2" "CFLAGS_FOR_TARGET=-g -O2
" "INSTALL=/usr/bin/install -c" "INSTALL_DATA=/usr/bin/install -c -m 644" "INSTALL_PROGRAM=/usr/bin/install -c" "
INSTALL_SCRIPT=/usr/bin/install -c" "LDFLAGS=-static-libstdc++ -static-libgcc -Wl,-s " "LIBCFLAGS=-O2" "
LIBCFLAGS_FOR_TARGET=-g -O2" "MAKE=make" "MAKEINFO=/home2/neon-vendor/qnxgcc/gcc_4_8_branch/missing makeinfo --split-
size=5000000 --split-size=5000000 " "PICFLAG=" "PICFLAG_FOR_TARGET=" "SHELL=/bin/bash" "EXPECT=expect" "RUNTEST=runtest"
 "RUNTESTFLAGS=" "exec_prefix=/opt/qnx650/host/linux/x86/usr" "infodir=/opt/qnx650/host/linux/x86/usr/share/info" "
libdir=/opt/qnx650/host/linux/x86/usr/lib" "prefix=/opt/qnx650/host/linux/x86/usr" "tooldir=/opt/qnx650/host/linux/x86/
usr/i486-pc-nto-qnx6.5.0" "AR=ar" "AS=as" "CC=gcc" "CXX=g++" "LD=ld" "LIBCFLAGS=-O2" "NM=nm" "PICFLAG=" "RANLIB=ranlib" 
"DESTDIR=" DO=all multi-do # make
make[4]: Entering directory `/home2/neon-vendor/qnxgcc/gcc_4_8_branch/linux-x86-o-ntox86/zlib'
if [ -z "32 x32" ]; then \
	  true; \
	else \
	  rootpre=`${PWDCMD-pwd}`/; export rootpre; \
	  srcrootpre=`cd ../../zlib; ${PWDCMD-pwd}`/; export srcrootpre; \
	  lib=`echo "${rootpre}" | sed -e 's,^.*/\([^/][^/]*\)/$,\1,'`; \
	  compiler="gcc"; \
	  for i in `${compiler} --print-multi-lib 2>/dev/null`; do \
	    dir=`echo $i | sed -e 's/;.*$//'`; \
	    if [ "${dir}" = "." ]; then \
	      true; \
	    else \
	      if [ -d ../${dir}/${lib} ]; then \
		flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
		if (cd ../${dir}/${lib}; make  \
				CFLAGS="-O2 ${flags}" \
				CCASFLAGS=" ${flags}" \
				FCFLAGS=" ${flags}" \
				FFLAGS=" ${flags}" \
				ADAFLAGS=" ${flags}" \
				prefix="/opt/qnx650/host/linux/x86/usr" \
				exec_prefix="/opt/qnx650/host/linux/x86/usr" \
				GCJFLAGS=" ${flags}" \
				GOCFLAGS=" ${flags}" \
				CXXFLAGS="-g -O2 ${flags}" \
				LIBCFLAGS="-O2 ${flags}" \
				LIBCXXFLAGS="-g -O2 -fno-implicit-templates ${flags}" \
				LDFLAGS="-static-libstdc++ -static-libgcc -Wl,-s  ${flags}" \
				MULTIFLAGS="${flags}" \
				DESTDIR="" \
				INSTALL="/usr/bin/install -c" \
				INSTALL_DATA="/usr/bin/install -c -m 644" \
				INSTALL_PROGRAM="/usr/bin/install -c" \
				INSTALL_SCRIPT="/usr/bin/install -c" \
				all); then \
		  true; \
		else \
		  exit 1; \
		fi; \
	      else true; \
	      fi; \
	    fi; \
	  done; \
	fi
make[5]: Entering directory `/home2/neon-vendor/qnxgcc/gcc_4_8_branch/linux-x86-o-ntox86/32/zlib'
make[5]: *** No rule to make target `all'.  Stop.
make[5]: Leaving directory `/home2/neon-vendor/qnxgcc/gcc_4_8_branch/linux-x86-o-ntox86/32/zlib'
make[4]: *** [multi-do] Error 1
make[4]: Leaving directory `/home2/neon-vendor/qnxgcc/gcc_4_8_branch/linux-x86-o-ntox86/zlib'
make[3]: *** [all-multi] Error 2
make[3]: Leaving directory `/home2/neon-vendor/qnxgcc/gcc_4_8_branch/linux-x86-o-ntox86/zlib'
make[2]: *** [all-zlib] Error 2
make[2]: Leaving directory `/home2/neon-vendor/qnxgcc/gcc_4_8_branch/linux-x86-o-ntox86'
make[1]: *** [all] Error 2
make[1]: Leaving directory...
View Full Message
Re: Building GCC  
I am pretty sure that error will happen if the just built GCC doesn't work.

My first guess would be needing updated binutils available, but if that's not it the config logs might give you a better
 idea as to what the error actually.
Re: Building GCC  
> I am pretty sure that error will happen if the just built GCC doesn't work.
> 

Nah its too early for that, seems like it's zlib for GCC. At anyrate I went around the problem by specifying --with-
system-zlib and installing zlib with sudo install ... and the build completed without any hic-up.

> My first guess would be needing updated binutils available, but if that's not 
> it the config logs might give you a better idea as to what the error actually.

For QNX650 I'm using the latest 2.24 ( 2.25 are for 6.6.0 only it seems ).  

As for the host it's Ubuntu 14 but with gcc 5 installed. 

That being said all is good now I've got the binaires I wanted and I can experiment with it, want to see if I can get 
better compile time with 64bit binaries and fine tune optimisation option. Any gain will help ;-)



Re: Building GCC  
I've successfully compiled 4.9.3 version of gcc for ntox86 target and linux_x86-64 host and it works fine. But what I 
couldn't understand so far is how to get ntox86-* files which are just symlinks(?) for i486-pc-nto-qnx6.5.0-*. Should I 
run some post build (or install) script or these symlinks always created manually? Without these files I feel my build 
result incomplete :))
Re: Building GCC  
All the symlinks are created as part of the packaging step.

You could create these manually, but it seems like easy work for a shell script.