executable from gfortran compile will not execute??

Asked by Dr. L. J. (Sam) Bledsoe on 2012-11-22

I installed gcc compilers, in order to access the gfortran option, on my new Precise Pangolin AMD64-but-32-bit-opsys system. Built a simple "Hello World" source which compiled and linked with no errors. The binary executable shows up flagged as executable ("ls -al" says so) but invoking the binary name gives "xhello: command not found" in spite of:
"...$ ls -al xhello
-rwxrwxr-x 1 sam sam 7468 Nov 20 09:44 xhello"

In "help.ubuntu.com/community/InstallingCompilers" I found "32-bit Builds on AMD64" advising installing multilib files and "lib32..." librairies. multilibs are installed and several "lib64..." files but Ubuntu software Center says there are no "lib32..." packages.

Is this some simple error or am I going to have to install the 64-bit version of PP to get the gfortran to work?
Thanks for your help --sam

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gcc-defaults Edit question
Assignee:
No assignee Edit question
Solved by:
Dr. L. J. (Sam) Bledsoe
Solved:
2012-11-25
Last query:
2012-11-25
Last reply:
2012-11-23

ok then run

./xhello

Does it run?

Well, no-- "...invoking the binary name gives "xhello: command not found"
"ls -al" says an executable file by the name of "xhello" is present in the . directory, but the command "xhello" will not execute the file. Ubuntu's execution procedure, apparently, cannot locate the executable file which is present in the current directory.

no-- "...invoking the binary name gives "xhello: command not found"
"ls -al" says an executable file by the name of "xhello" is present in the
. directory, but the command "xhello" will not execute the file. Ubuntu's
execution procedure, apparently, cannot locate the executable file which is
present in the current directory??

On Wed, Nov 21, 2012 at 5:11 PM, actionparsnip <
<email address hidden>> wrote:

> Your question #214907 on gcc-defaults in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/214907
>
> Status: Open => Needs information
>
> actionparsnip requested more information:
> ok then run
>
> ./xhello
>
> Does it run?
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/214907
>
> You received this question notification because you asked the question.
>

--
Dr. L.J. (Sam) Bledsoe <email address hidden>
Winter Creek Ranch <http://wintercreekranch.com>, N7DTW
18080 County Rd 70 (530) 796-3723, Skype I-net: sambledsoe, Cellphone
(916) 207-4086
Brooks CA 95606

Warren Hill (warren-hill) said : #4

The compiler will build both 32-bit and 64-bit versions have you built the correct version for your OS?

You may need to install additional packages see here
https://help.ubuntu.com/community/InstallingCompilers

I have tried specifying "-m32" as advised in the "InstallingCompilers" page
you suggest-- here is what hapens:

sam@Quercus:~/Projects/Tools/Fortran$ gfortran -o -m32 xhello Hello.f90
/usr/bin/ld: unrecognised emulation mode: 32
Supported emulations: elf_i386 i386linux elf32_x86_64 elf_x86_64 elf_l1om
elf_k1om
collect2: ld returned 1 exit status

"-m32" is apparently not recognized as directive to build code for a 32-bit
CPU. I can find no reference to to a "-m____" option in the gfortran or gcc
docs-- can you help?
I have also installed the relevant multilibs. The page says to install
libraries whose name begins "lib32....". Ubuntu software center does not
find any such-- but many beginning "lib64..."

On Fri, Nov 23, 2012 at 2:55 AM, Warren Hill <
<email address hidden>> wrote:

> Your question #214907 on gcc-defaults in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/214907
>
> Status: Open => Answered
>
> Warren Hill proposed the following answer:
> The compiler will build both 32-bit and 64-bit versions have you built
> the correct version for your OS?
>
> You may need to install additional packages see here
> https://help.ubuntu.com/community/InstallingCompilers
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
>
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/214907/+confirm?answer_id=3
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/214907
>
> You received this question notification because you asked the question.
>

--
Dr. L.J. (Sam) Bledsoe <email address hidden>
Winter Creek Ranch <http://wintercreekranch.com>, N7DTW
18080 County Rd 70 (530) 796-3723, Skype I-net: sambledsoe, Cellphone
(916) 207-4086
Brooks CA 95606

I have found "-m32" as a directive to gcc, but it is not accepted for a call to gfortran. Since gfortran is a subset of gcc, maybe there is a way to specify -m32 to gcc when calling via gfortran?? Anyone got an idea on this??

Found it-- stupid mistake! Thanks everyone!