Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-15-2014, 08:09 PM
|
#1
|
LQ Newbie
Registered: Oct 2012
Location: Brazil
Distribution: Slackware
Posts: 9
Rep:
|
Multilib gfortran generates 64-bit output, only (14.1)
I was having trouble compiling 32-bit versions of blas (which I'd use
for atlas, then lapack) under Slackware 14.1 in a multilib system. It failed every
time.
After investigating into the issue, I realized gfortran was producing
64-bit output, even after the . /etc/profile.d/32dev.sh command. This
does not happen with gcc ou g++, only with gfortran.
For instance, you take any .c file (say, file1.c) and any .f file
(say, file2.f), and compile them with
gcc -c -o test1.o file1.c
gfortran -c -o test2.o file2.f
Issuing a file command on both will show test1.o will be 32-bit and
test2.o will be 64-bit.
I do not know if this has a necessary relation with the problem, but I
did check executables for gcc and g++ are found in /usr/bin/32/, but
one will not find any gfortran executable file over there.
|
|
|
01-16-2014, 04:05 AM
|
#2
|
Senior Member
Registered: May 2006
Location: France
Distribution: Slackware
Posts: 1,052
|
Hello,
/usr/bin/32/gcc is a shell wrapper that pass -m32 to the compiler. Since /usr/bin/g++ is a symlink to /usr/bin/32/gcc, you simply have to create a gfortran symlink to gcc in /usr/bin/32 to fix this issue, I guess :
Code:
$ su
$ cd /usr/bin/32
$ ln -s gcc gfortran
Code:
$ cd /tmp
$ echo -e "program HelloWorld\n write(*,*) \"Hello World\"\nend program HelloWorld" > HelloWorld.f90
$ gfortran HelloWorld.f90 -o HelloWorld.64bit
$ file HelloWorld.64bit
HelloWorld.64bit: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
$ . /etc/profile.d/32dev.sh
$ gfortran HelloWorld.f90 -o HelloWorld.32bit
$ file HelloWorld.32bit
HelloWorld.32bit: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
Hope this helps.
Cheers
--
SeB
|
|
|
01-16-2014, 05:06 AM
|
#3
|
Slackware Contributor
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559
|
I have replied to the OP in an email (he emailed me as well as posting here) and gave a similar workaround instruction (basically, just add "-m32" to the commandline).
I have however also updated the compat32-tools with support for fortran (a fortran wrapper and some extra lines in the 32dev.* profile scripts). I want to test this before releasing it, and that must wait until tonight when I get home.
Eric
|
|
|
01-16-2014, 08:20 AM
|
#4
|
LQ Newbie
Registered: Oct 2012
Location: Brazil
Distribution: Slackware
Posts: 9
Original Poster
Rep:
|
Thanks to both of you. I will do as instructed right now and post the results.
PS: since I thanked you here, Alien, I will not do so through e-mail, since I assume you already get a lot of e-mail every day.
This is the reply:
Quote:
Well, the basic issue is that I never provided a gfortran wrapper for 32-bit builds, like I did with the gcc wrapper in /usr/bin/32
It is easy to add though, and I will.
In the mean time, try the difference in output architecture when you add the "-m32" flag manually. Last time I used fortran was at university - and that was more than 30 years ago - so here is my test:
$ cat <<EOT > hellotest.f
program hello
print *, "Hello World!"
end program hello
EOT
$ g95 -o hello hellotest.f
$ file hello
hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
$ # ./hello
Hello World!
$ g95 -m32 -o hello32 hellotest.f
$ file hello32
hello32: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
$ # ./hello32
Hello World!
Writing a wrapper for gfortran analogous to /usr/bin/32/gcc is not hard.
Alternatively, I think you could also achieve the desired effect by defining additional variables in your environment:
export FC='gfortran -m32'
export F77='gfortran -m32'
Cheers, Eric
|
Last edited by slackj; 01-16-2014 at 08:27 AM.
|
|
|
01-16-2014, 11:11 AM
|
#5
|
LQ Newbie
Registered: Oct 2012
Location: Brazil
Distribution: Slackware
Posts: 9
Original Poster
Rep:
|
Quote:
Originally Posted by slackj
Thanks to both of you. I will do as instructed right now and post the results.
|
I copied /usr/bin/32/g++ to /usr/bin/32/gfortran. This seems to fix the fortran compilation problem.
After it was done, 32-bit output was being produced (after . /etc/profile.d/32dev.sh) and I could get blas to compile with a Slackbuild, but not atlas. Apparently, there are a few patches for further versions of atlas (read after 3.8.3, which is linked at Slackbuilds website) around that may help. All in all, I believe fortran compilation is fixed. Since I failed to get a log for the build, I'll post later if I still need help.
Thanks for the help, again.
|
|
|
All times are GMT -5. The time now is 10:02 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|