Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - GCC 4.8.1 with gfortran installation: (3 Items)
   
GCC 4.8.1 with gfortran installation  
Hello everyone

I would like to know if there has even been a definitive solution to the question asked in [url=http://community.qnx.com
/sf/discussion/do/listPosts/projects.toolchain/discussion.core_development_tools.topc20625]this thread[/url]. Is there 
some general procedure to follow when installing unofficially made, precompiled toolchains?

I've been trying to install the GCC 4.8.1 toolchain with gfortran from here:

http://www.ajamweb.pl/

but I am not sure that I did everything correctly. In particular, I downloaded the compiler's binary and the binaries of
 all requires binaries and “installed” them in the following way on a self-hosted QNX 6.5.0 VM:

* Copied the contents of the binaries of the various required mpc, mpfr etc. libraries directly into the /usr/ folder 
and its /usr/lib, /usr/include etc. subfolders
* Copied the contents of the gcc4.8.1-x86-qnx6.5.0-bld1.tar.bz2 archive directly into the /usr folder

But in this way I only got a half-functional compiler:
•	Gfortran and other new compilers were now accessible by the command line, but to build any fortran program I need to 
include the following library path to the linker: -L /usr/qnx650/host/qnx6/x86/usr/i486-pc-nto-qnx6.5.0/lib , otherwise 
I get a “libgfortran.spec: No such file or directory” error at linking time.
•	To actually execute a compiled fortran program, I must add this path to the LD_LIBRARY_PATH env. variable: /usr/
qnx650/target/qnx6/x86/lib. The only workaround would be to include all required libraries as static during link time, 
but I feel that neither is the correct one.
•	Simple “hello world” type programs do work, but I get a lot of runtime errors and segfaults with anything using 
formatted output, in particular. I suspect that this is more due to my manual “copy files” installation, than anything
.

I wonder if anyone can help me with the proper installation steps to follow, what environment variables to set, what 
symlinks to change etc. in order to get a properly functional environment.

Thanks in advance
Re: GCC 4.8.1 with gfortran installation  
Hi Victor.
You correct install gcc4.8.1 compiler and libraries.
1. libgfortran.spec problem:
a) you can use -L /usr/qnx650/host/qnx6/x86/usr/i486-pc-nto-qnx6.5.0/lib
b) or copy libgfortran.spec from /usr/qnx650/host/qnx6/x86/usr/i486-pc-nto-qnx6.5.0/lib to /usr/qnx650/host/qnx6/x86/usr
/lib/gcc/i486-pc-nto-qnx6.5.0/4.8.1
2. LD_LIBRARY_PATH must be set to LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/qnx650/target/qnx6/x86/lib I do it in my .
profile file

Sample Program

# pwd
/root
# cd gfortran/
# gfortran --version
GNU Fortran (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

# cat helloworld.f

program hello
print *,"Hello World!"
end program hello
# gfortran -ffree-form -o helloworld helloworld.f
# ls -l
total 47
drwxrwxr-x  2 root      root           1024 May 11 18:21 .
drwx------ 12 root      root           1024 May 11 20:32 ..
-rwxrwxr-x  1 root      root           6791 May 11 18:10 helloworld
-rw-rw-r--  1 root      root             55 May 11 16:55 helloworld.f
........................................
# ldd helloworld
./helloworld:
        libgfortran.so.3 => /usr/qnx650/target/qnx6/x86/lib/libgfortran.so.3.0.0 (0xb8200000)
        libm.so.2 => /lib/libm.so.2 (0xb8315000)
        libquadmath.so.0 => /usr/qnx650/target/qnx6/x86/lib/libquadmath.so.0.0.0 (0xb8348000)
        libc.so.3 => /usr/lib/ldqnx.so.2 (0xb0300000) 
# ./helloworld
 Hello World
#
Re: GCC 4.8.1 with gfortran installation  
Hello Bogdan, and thank you for your replies.

It seems that the libraries and paths issues can be easily be sorted out, however there are still problems with 
formatted I/O statements. For example, the attached program "hellowrite.f95" uses a print* statement (which works) as 
well as two simple formatted write statements, which however fail on runtime with a "missing left parenthesis" error, 
while other times it causes a segfault.

# ./hellowrite
 Hello World
At line 10 of file hellowrite.f95 (unit = 6, file = 'stdout')
Fortran runtime error: Missing initial left parenthesis in format

However, this seems to be solved if the program is compiled (not just linked) with -malign-double
Attachment: Text hellowrite.f95 257 bytes