Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Jan 2002 13:21:37 -0600
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Rahul Siddharthan <rsidd@online.fr>
Cc:        ports@FreeBSD.ORG, hackers@FreeBSD.ORG
Subject:   Re: Port: Intel Fortran (and C++?) compilers
Message-ID:  <20020124192136.GG87583@dan.emsphone.com>
In-Reply-To: <20020124184506.B87867@lpt.ens.fr>
References:  <20020124184506.B87867@lpt.ens.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jan 24), Rahul Siddharthan said:
> I have the Intel Fortran compiler[1] for Linux (Red Hat 7.1) working
> on my FreeBSD box, and (barring as-yet-unseen glitches) would like to
> submit a port by the weekend or so.  I'd like some advice on how to
> proceed with the following issues. 

I actually did the same thing you did, but with the C compiler :)  I
never write a port though.  
 
> 1. The compiler and its libraries are installed in
>       /compat/linux/opt/intel/compiler50/ia32/bin/ifc
>    and requires some environment variables pointing to a license file to
>    be set before it runs.  I do that with a script called "ifc" in
>    /usr/local/bin, which does the right things.  Is there a better way?
> 
> #!/bin/sh
> LD_LIBRARY_PATH=/compat/linux/opt/intel/compiler50/ia32/lib/
> LM_LICENSE_FILE=/compat/linux/opt/intel/licenses/l_for.lic
> export LD_LIBRARY_PATH LM_LICENSE_FILE
> /compat/linux/opt/intel/compiler50/ia32/bin/ifc $@

I did this instead.  I installed into /compat/linux/usr/local/intel,
since no-one uses /opt, and put the following script in
/usr/local/bin/icc:

 #! /bin/sh
 if [ -z "${IA32ROOT}" ] ; then
 . /compat/linux/usr/local/intel/compiler50/ia32/bin/iccvars.sh
 fi
 exec /compat/linux/usr/local/intel/compiler50/ia32/bin/icc "$@"

Then simply running (for example) "icc test.c -o test" generates a
Linux executable.

> 2. Though the install script (with patches) installs everything to
>    /compat/linux/opt/intel, the compiler tends to complain of not finding
>    the file /usr/intel/ia32/lib/crtxn.o . I fixed this by making
>    a directory /compat/linux/usr/intel and symlinking
>    /compat/linux/opt/intel/compiler50/ia32 to /compat/linux/usr/intel/ia32. 
>    This works but I'm wondering whether there's a "cleaner" solution. 

I didn't have this problem.  Could be a difference in how we installed
it.
 
> 3. The compiler by itself compiles, but does not link; it complains
>    about lots of undefined symbols.  To get around this, I use the linux
>    ld, which is not part of linux_base-7 or any other port as far as I
>    see (the linux_devtools seems to be for linux_base-6), so I installed 
>    that separately (I could make a separate port of it).  Again, lots 
>    of options need to be specified properly on the linker command line, 
>    so I made a script to do all that called ifclink.  
> 
>    So the end-user's instructions to compile, say, test.f would be
>    /usr/local/bin/ifc -c test.f
>    /usr/local/bin/ifclink -o test test.o
>
>    Among the things the linker script needs to do are: specify the
>    entry symbol (-e main as command line option to ld); specify the Intel
>    libraries to link against; and brand the binary as linux.

You could simply use /compat/linux/bin/ld here :)
 
> 4. After all this, the binary still complains saying
> 
> ELF interpreter /compat/linux/usr/lib/libc.so.1 not found
> Abort
> 
>    I solve this with a symlink from /compat/linux/ld-2.2.2.so to
>    /compat/linux/usr/lib/libc.so.1
>    Is there a "cleaner" solution?

I didn't have this problem either.

> Do I go ahead with the above as it is, or does anyone have better
> ideas?  In particular it will be very nice if someone can get the
> Intel compiler to link the code properly.
>
> I think the Intel C++ compiler should be portable along the above
> lines too.  In fact I got it to compile C code into .o files quite
> easily, which could then be linked with FreeBSD's native ld and
> libraries to produce a working native FreeBSD binary.  It didn't work
> with C++, but the above approach may have a better chance.

This is definitely dependant on what you're building.  icc will try and
use the Linux headers, so if you use FILE, or pretty much any system
struct, it's not going to run right.  Actually, what might work is "icc
-X -I /usr/include", and then link with the freebsd ld.  But icc
doesn't understand all gcc-isms, which is why Intel had to rewrite a
lot of them and put them in intel/compiler50/ia32/substitute_headers. 
You'de have to do the same for any offending FreeBSD headers.

-- 
	Dan Nelson
	dnelson@allantgroup.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020124192136.GG87583>