Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - gcc installation on QNX 6.6: (15 Items)
   
gcc installation on QNX 6.6  
Hi,

I have been able to successfully bootstrap pkgsrc on QNX 6.6 (x86 VM), following the instructions on the wiki (http://
community.qnx.com/sf/wiki/do/viewPage/projects.pkgsrc/wiki/PkgsrcOnQnx6.6?showDetails=true)

I am trying to get gcc 4.8 installed, but am getting compile errors during the build of the nbpatch dependency. This is 
the error message I am getting:

/opt/qnx/qnx660/target/qnx6/x86/lib/libc.a(getopt_long.o): In function `getopt_long':
(.text+0xa80): multiple definition of `getopt_long'
/opt/qnx/pkgsrc/devel/nbpatch/work/libnbcompat/libnbcompat.a(getopt_long.o):getopt_long.c:(.text+0x120): first defined 
here
collect2: error: ld returned 1 exit status

Looking at the configure output, there should be a way to disable the building of the includeed getopt_long.c file, 
which would be my next step. Is this the right thing to do? Any help will be greately appreciated.

Best regards,
damjan
Re: gcc installation on QNX 6.6  
I am curious to know what you mean by getting pkgsrc running on QNX 6.6.   

Are you using a host such as Windows or Linux to build QNX 6.6 runtimes from pkgsrc, or
were you thinking that you would use a QNX 6.6 system to build pkgsrc packages?

If the latter, what were you planning to use as the compiler?

Thanks
Re: gcc installation on QNX 6.6  
Hi Mitchell,

my goal is to use a QNX 6.6 system to build pkgsrc packages. I'm trying to build ROS (www.ros.org) on QNX, which has a 
large number of dependencies, so cross-compiling does not seem feasible.

For bootstraping pkgsrc on QNX 6.6, I used the procedure described here (http://community.qnx.com/sf/wiki/do/viewPage/
projects.pkgsrc/wiki/PkgsrcOnQnx6.6?showDetails=true) by Sean. It basically uses some clever nfs mounting and ssh 
trickery to make QNX think it has a locally installed compiler, while it is in fact using the cross-compiler installed 
on the development host (Linux) by the QNX 6.6. Momentics IDE. Using this method, I was able to bootstrap pkgsrc. Right 
now I'm still working on getting the native gcc running. Once I have that, I'll hopefully be able to do native builds of
 all the packages I need. Hope this answers your question :)

Best,
damjan
Re: gcc installation on QNX 6.6  
Thanks for your reply.   One more question.

From your description it sounds like you are running the compiler on QNX, but the compiler is located on a Linux system.
    That doesn't sound like it can work.   If it did, you could presumably copy the compiler and all the important files
 to QNX and run it there.   I'm assuming a Linux executable cannot run on QNX.   Do I have that right?
Re: gcc installation on QNX 6.6  
The 'tools' are scripts that ssh to the host and run the real tool there. The objects etc get built on the host but the 
target sees them via nfs via a mountpoint that mirrors the host.

Sent from my BlackBerry 10 smartphone on the Rogers network.
  Original Message
From: Mitchell Schoenbrun
Sent: Wednesday, August 13, 2014 7:58 PM
To: general-pkgsrc
Reply To: general-pkgsrc@community.qnx.com
Subject: Re: gcc installation on QNX 6.6


Thanks for your reply.   One more question.

From your description it sounds like you are running the compiler on QNX, but the compiler is located on a Linux system.
    That doesn't sound like it can work.   If it did, you could presumably copy the compiler and all the important files
 to QNX and run it there.   I'm assuming a Linux executable cannot run on QNX.   Do I have that right?



_______________________________________________

General
http://community.qnx.com/sf/go/post111423
To cancel your subscription to this discussion, please e-mail general-pkgsrc-unsubscribe@community.qnx.com
Re: gcc installation on QNX 6.6  
I hope my questions aren't getting tedious, but I do have a strong interest in this.

If the compilation is happening on the Linux Host, why does it matter that it's being controlled from the QNX target 
system?    It would seem just as easy to build it on the Linux system as that is what the "tools" are doing anyway?   I 
hope I'm missing something here.
Re: gcc installation on QNX 6.6  
pkgsrc isn't set up for that.  It either wants self hosted tools
or a NetBSD tool set up for cross compilation.

When things were working well in pkgsrc over 6000 packages were being
built.  This is an attempt to leverage that without turning this into
something that doesn't resemble pkgsrc at all: cached results for
configure test etc...

On Wed, Aug 13, 2014 at 09:52:42PM -0400, Mitchell Schoenbrun wrote:
> I hope my questions aren't getting tedious, but I do have a strong interest in this.
> 
> If the compilation is happening on the Linux Host, why does it matter that it's being controlled from the QNX target 
system?    It would seem just as easy to build it on the Linux system as that is what the "tools" are doing anyway?   I 
hope I'm missing something here.
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post111425
> To cancel your subscription to this discussion, please e-mail general-pkgsrc-unsubscribe@community.qnx.com
Re: gcc installation on QNX 6.6  
Do you have PSP 660-3851-RS5495 installed on the host as mentioned on
that pkgsrc on 6.6 page?  One of the missing headers was getopt.h.

On Tue, Aug 12, 2014 at 06:13:55PM -0400, Damjan Miklic wrote:
> Hi,
> 
> I have been able to successfully bootstrap pkgsrc on QNX 6.6 (x86 VM), following the instructions on the wiki (http://
community.qnx.com/sf/wiki/do/viewPage/projects.pkgsrc/wiki/PkgsrcOnQnx6.6?showDetails=true)
> 
> I am trying to get gcc 4.8 installed, but am getting compile errors during the build of the nbpatch dependency. This 
is the error message I am getting:
> 
> /opt/qnx/qnx660/target/qnx6/x86/lib/libc.a(getopt_long.o): In function `getopt_long':
> (.text+0xa80): multiple definition of `getopt_long'
> /opt/qnx/pkgsrc/devel/nbpatch/work/libnbcompat/libnbcompat.a(getopt_long.o):getopt_long.c:(.text+0x120): first defined
 here
> collect2: error: ld returned 1 exit status
> 
> Looking at the configure output, there should be a way to disable the building of the includeed getopt_long.c file, 
which would be my next step. Is this the right thing to do? Any help will be greately appreciated.
> 
> Best regards,
> damjan
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post111393
> To cancel your subscription to this discussion, please e-mail general-pkgsrc-unsubscribe@community.qnx.com
Re: gcc installation on QNX 6.6  
Hi Sean,

thanks for the reply. Yes, I have installed the patch you are referring to, and I can see getopt.h in my target/qnx6/usr
/include/ directory (on the Linux host) and also in /usr/include on the QNX target (I had to copy the whole usr/include/
 over to the QNX VM in order to even get started with building gcc).

In the meanwhile, I worked around the issue by editing devel/nbpatch/work/libnbcompat/getopt_long.c by hand, moving the 
#endif on line 345 to the end of the file (so that getopt_long is excluded from the build when HAVE_GETOPT_LONG is 
defined) and recompiling.

The above hack got me a bit further, but now I'm stuck at:

libtool: compile:  gcc -DHAVE_CONFIG_H -I. "-DLT_CONFIG_H=<config.h>" -DLTDL -I. -I. -Ilibltdl -I./libltdl -I./libltdl/
libltdl -I/usr/include -O2 -I/usr/include -MT libltdl/loaders/dlopen.lo -MD -MP -MF libltdl/loaders/.deps/dlopen.Tpo -c 
libltdl/loaders/dlopen.c  -fPIC -shared -DPIC -o libltdl/loaders/.libs/dlopen.o
In file included from libltdl/loaders/dlopen.c:32:0:
./libltdl/libltdl/lt__private.h:35:23: error: #include expects "FILENAME" or <FILENAME>
In file included from ./libltdl/libltdl/lt__private.h:52:0,
                 from libltdl/loaders/dlopen.c:32:
./libltdl/libltdl/lt__dirent.h:35:23: error: #include expects "FILENAME" or <FILENAME>
(***full error output is attached ***)

I'm really clueless about this error. There is 

#    include LT_CONFIG_H 

on line 35 of lt_private.h which is defined in the compilation command as <config.h>. I'm having a hard time 
understandig why this is not recognized by the compiler.

Any futher insight will be greately appreciated.

Best,
damjan
Attachment: Text qnx66-pkgsrc-gcc48-libtool.error 8.3 KB
Re: gcc installation on QNX 6.6  
I have made some progress towards building gcc. In addition to the libtool-base error above, several dependencies were 
giving me build errors, so I installed those from 6.5 binary packages (ftp://ftp.netbsd.org/pub/pkgsrc/packages/QNX/i386
/6.5.0_head_20110826/All/) which seems to work fine. This way, I was able to satisfy all dependencies and start building
 gcc 4.8 itself. Several components build successfully, some with fairly minor tweaks. However, now I'm stuck on this 
error:

build/genautomata ../../gcc-4.8.1/gcc/config/i386/i386.md \
  insn-conditions.md > tmp-automata.c
Memory fault (core dumped) 
gmake[3]: *** [s-automata] Error 139
gmake[3]: Leaving directory `/opt/qnx/pkgsrc/lang/gcc48/work/build/gcc'
gmake[2]: *** [all-stage1-gcc] Error 2

I tried applying this patch: https://gcc.gnu.org/ml/gcc-patches/2013-06/msg00397.html but it didn't make any difference.


Sean, can you maybe shed some light on this? Were you actually able to compile gcc48 on the QNX 6.6. VM? 

If it can help, I have very detailed error logs of all the errors I encountered during the build process, and the steps 
I took to resolve them. I have a keen interest in getting the native build to work and am willing to invest a 
considerable amount of time into it, if you could point me in the right direction.

Best,
damjan
Re: gcc installation on QNX 6.6  
Damian do it
# ldrel -L -S 4096000 genautomata or
# ldrel -L -S 6144000 genautomata
# touch genautomata 
Re: gcc installation on QNX 6.6  
Hi Bogdan,

thanks a lot, your suggestion worked and got me one step further! The gcc executable now gets built :)

Sure enough, the next problem has come up :) While configuring multilib, I get the error:

checking for i386-pc-nto-qnx6.6.0-gcc... /opt/qnx/pkgsrc/lang/gcc48/work/build/./gcc/xgcc -B/opt/qnx/pkgsrc/lang/gcc48/
work/build/./gcc/ -B/usr/pkg/gcc48/i386-pc-nto-qnx6.6.0/bin/ -B/usr/pkg/gcc48/i386-pc-nto-qnx6.6.0/lib/ -isystem /usr/
pkg/gcc48/i386-pc-nto-qnx6.6.0/include -isystem /usr/pkg/gcc48/i386-pc-nto-qnx6.6.0/sys-include   
checking for suffix of object files... configure: error: in `/opt/qnx/pkgsrc/lang/gcc48/work/build/i386-pc-nto-qnx6.6.0/
libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
gmake[2]: *** [configure-stage1-target-libgcc] Error 1

Looking at config.log I can see that the call to the newly-built gcc failed:

/opt/qnx/pkgsrc/lang/gcc48/work/build/./gcc/xgcc -B/opt/qnx/pkgsrc/lang/gcc48/work/build/./gcc/ -B/usr/pkg/gcc48/i386-pc
-nto-qnx6.6.0/bin/ -B/usr/pkg/gcc48/i386-pc-nto-qnx6.6.0/lib/ -isystem /usr/pkg/gcc48/i386-pc-nto-qnx6.6.0/include -
isystem /usr/pkg/gcc48/i386-pc-nto-qnx6.6.0/sys-include    -o conftest -g -O2 -I/usr/pkg/include -I/usr/include -I/usr/
pkg/include/gettext  -Wl,-R/usr/pkg/lib conftest.c

The call seem weird, because the /usr/pkg/gcc48 directory has not been created yet (and I wouldn't expect it to be 
created untill the very end of the installation process). In short, looks like something along the way has been 
misconfigured?

Best,
damjan
Re: gcc installation on QNX 6.6  
Full compiler gcc 4.8.3 and other software for QNX6.6 on x86 Oracle VirtualBox and VMware I have placed on my web page 
http://www.ajamweb.pl
http://www.ajamweb.pl/Instalacja_gcc.html
Re: gcc installation on QNX 6.6  
Hi Bogdan, thanks, this looks great! 

A couple of questions: 

What's the Arch0 tool that you are mentioning in the instructions, and how to get it?
In the instructions you have posted, it is not always completely clear what is done on the QNX target, and what is done 
on the host. The gcc 4.8 binary that you provide, is it a native compiler to be run on the QNX target, or a cross-
compiler, to be run on the host?
Re: gcc installation on QNX 6.6  
Hi Damjan
> Hi Bogdan, thanks, this looks great! 
> 
> A couple of questions: 
> 
> What's the Arch0 tool that you are mentioning in the instructions, and how to 
> get it?
look mc.tar.bz2 from my site => usr/local/bin/ArchO
ArchO:
=========================
#!/bin/sh
if test $# -eq 0
then
    echo "Brak pliku do rozpakowania"
    echo "     Uzyj Arch zbior lub katalog"
    exit 0
fi

echo Odtworzenie archiwum !!!
echo
if [ -f "$1" ] ; then
     case "$1" in
        *.tar.bz2) tar xvjf- $1 ;;
        *.tar.gz) tar xvzf- $1 ;;
        *.bz2) bunzip2 $1 ;;
        *.rar) unrar x $1 ;;
        *.gz) gunzip $1 ;;
        *.tar) tar xvf $1 ;;
        *.tbz2) tar xvjf $1 ;;
        *.tgz) tar xvzf $1 ;;
        *.zip) unzip $1 ;;
        *.Z) uncompress $1 ;;
        *.7z) 7z x $1 ;;
        *.tar.xz) xz -dc $1 | tar xvf - ;;
        *.tar.lz) lzip -dc $1 | tar xvf - ;;
        *) echo "'$1' nie może zostać rozpakowany" ;;
      esac
else
      echo "'$1' nie jest poprawnym plikiem"
fi
===================
> In the instructions you have posted, it is not always completely clear what is
>  done on the QNX target, and what is done on the host. The gcc 4.8 binary that
>  you provide, is it a native compiler to be run on the QNX target, or a cross-
> compiler, to be run on the host?
This  gcc 4.8 binary is not cross-compiler, it is native compiler for QNX 6.6.0 for x86 VMware/ Oracle VM VirtualBox. 
You can use it to compile programs directly on a virtual machine. All these software together with the compiler was 
compiled directly into x86 VMware  and not on Linux or Windows.
QNX Momentics IDE I use only for the transfer of all necessary software for QNX 6.6.0 ISO image running on a virtual 
machine