[SOLVED] Execute i386 program on x86-64?
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 13 of 13
  1. #1
    Join Date
    Jun 2007
    Posts
    321
    Linux (Fedora) Chrome 67.0.3396.99

    Execute i386 program on x86-64?

    I archived some 32-bit gfortran and nasm code seven years ago to which I'd like to make some changes, but first I'd like to execute it as is for a starting point. All coding, compiling, and linking was done in Fedora.

    [mrice@localhost test]$ test
    [mrice@localhost test]$

    No error messages, but no output either. Is there a way to get the 32-bit code to run on a 64-bit cpu? I'm currently using Fedora 27.

    Michael

  2. #2
    Join Date
    Feb 2005
    Location
    London, UK
    Posts
    733
    Windows 7 Chrome 69.0.3497.100

    Re: Execute i386 program on x86-64?

    Most likely you're running the system "/usr/bin/test" rather than your actual binary as the output you've given is the expected behavior of it. Run "./test" to run the binary in the current path.

    If that works it should run or give errors, "ldd ./test" might help pinpoint missing libraries if needed.

  3. #3
    Join Date
    Jun 2007
    Posts
    321
    Linux (Fedora) Chrome 67.0.3396.99

    Re: Execute i386 program on x86-64?

    [mrice@localhost ~]$ cd test
    [mrice@localhost test]$ ls test
    test
    [mrice@localhost test]$ ./test
    bash: ./test: No such file or directory
    [mrice@localhost test]$

    Test is of type: executable (application/x-executable) . It's colored green in the third line above.

    [mrice@localhost test]$ ld ./test
    ld: i386 architecture of input file `./test' is incompatible with i386:x86-64 output
    ld: error in ./test(.eh_frame); no .eh_frame_hdr table will be created.
    [mrice@localhost test]$

    Perhaps install some i386 I/O libraries?

    Michael

  4. #4
    tempest766 Guest

    Re: Execute i386 program on x86-64?

    install glibc.i686 package and the i686 versions of any other required libraries.

  5. #5
    Join Date
    Jun 2007
    Posts
    321
    Linux (Fedora) Chrome 67.0.3396.99

    Re: Execute i386 program on x86-64?

    I poked around this morning and found the same suggestion.

    glibc.i686 installed.

    [mrice@localhost ~]$ cd test
    [mrice@localhost test]$ ./test
    ./test: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory

    [mrice@localhost test]$ dnf provides libgfortran.so.3
    Last metadata expiration check: 1 day, 10:34:58 ago on Mon 01 Oct 2018 08:31:18 PM EDT.
    Error: No Matches found

  6. #6
    Join Date
    Jun 2007
    Posts
    321
    Linux (Fedora) Chrome 67.0.3396.99

    Re: Execute i386 program on x86-64?

    [mrice@localhost test]$ dnf provides libgfortran.so.4
    Last metadata expiration check: 1 day, 10:50:53 ago on Mon 01 Oct 2018 08:31:18 PM EDT.
    libgfortran-7.3.1-6.fc27.i686 : Fortran runtime
    Repo : updates
    Matched from:
    Provide : libgfortran.so.4

    Superceded.

    Lost cause?

  7. #7
    Join Date
    Oct 2006
    Location
    CN99CF Agassiz BC Canada
    Posts
    401
    Linux (Fedora) Firefox 60.0

    Re: Execute i386 program on x86-64?

    If you still have the source code that was used to link the 'test' program, you could likely get to success by installing the required fortran 686 library and recompiling / linking the source code. This should result in a program that runs. Then go forward ...

    You might also consider adding ./ into your PATH.

  8. #8
    Join Date
    Jun 2007
    Posts
    321
    Linux (Fedora) Chrome 67.0.3396.99

    Re: Execute i386 program on x86-64?

    Not sure mixing two versions of the same library is a good idea, as it assumes that nothing else but that one component was changed.

    I have a a couple of paths I can take. I'm trying to avoid rewriting the 13 NASM functions for 64-bit before I do a benchmark run using the initial 32-bit NASM code. The fortran code produces initial data structures and changes them using the NASM primitives, so the match up must be perfect.

    I'll be back.

    Michael

  9. #9
    Join Date
    Feb 2005
    Location
    London, UK
    Posts
    733
    Windows 7 Chrome 69.0.3497.100

    Re: Execute i386 program on x86-64?

    Use ln to make a link called libgfortran.so.3 pointing to libgfortran.so.4, 9 times out of 10 the old functions the executable uses aren't deprecated in the new library. Alternatively recompile the source for the executable to use the new library.

  10. #10
    Join Date
    Nov 2006
    Location
    Detroit
    Posts
    6,741
    Linux (Fedora) Firefox 62.0

    Re: Execute i386 program on x86-64?

    Quote Originally Posted by mjrice
    [mrice@localhost test]$ ./test
    ./test: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory
    Not a lost cause. The libgfortran.i686 from Fedora 20 has /usr/lib/libgfortran.so.3. You can install it and its dependency (libquadmath) like this:
    Code:
    dnf install http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/20/Everything/i386/os/Packages/l/libgfortran-4.8.2-1.fc20.i686.rpm http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/20/Everything/i386/os/Packages/l/libquadmath-4.8.2-1.fc20.i686.rpm
    OS: Fedora 29 x86_64 | Machine: Lenovo ThinkCentre M91P | CPU: Intel Core i5-2500 3.30GHz | RAM: 8GB PC3-12800 DDR3 | Disk: 500GB SATA | Video: Intel HD Graphics 2000 128MB | Sound: Realtek ALC662 | Ethernet: Intel 82579LM

  11. #11
    Join Date
    Jun 2007
    Posts
    321
    Linux (Fedora) Chrome 67.0.3396.99

    Re: Execute i386 program on x86-64?

    Error: Transaction check error:
    file /usr/share/info/libquadmath.info.gz from install of libquadmath-4.8.2-1.fc20.i686 conflicts with file from package libquadmath-7.3.1-5.fc27.x86_64

    Error Summary
    -------------

    [root@localhost mrice]#

    --------------------------

    [root@localhost mrice]# dnf install http://archives.fedoraproject.org/pu....fc20.i686.rpm http://archives.fedoraproject.org/pu....fc20.i686.rpm
    Fedora 27 - x86_64 - Updates 28 kB/s | 26 MB 15:55
    google-chrome 1.5 kB/s | 3.7 kB 00:02
    Last metadata expiration check: 0:00:00 ago on Fri 05 Oct 2018 08:09:28 AM EDT.
    libgfortran-4.8.2-1.fc20.i686.rpm 13 kB/s | 258 kB 00:19
    libquadmath-4.8.2-1.fc20.i686.rpm 15 kB/s | 233 kB 00:15
    Dependencies resolved.
    ================================================== ================================================== ================================================== ================================================== ==========
    Package Arch Version Repository Size
    ================================================== ================================================== ================================================== ================================================== ==========
    Installing:
    libgfortran i686 4.8.2-1.fc20 @commandline 258 k
    libquadmath i686 4.8.2-1.fc20 @commandline 233 k

    Transaction Summary
    ================================================== ================================================== ================================================== ================================================== ==========
    Install 2 Packages

    Total size: 492 k
    Installed size: 1.5 M
    Is this ok [y/N]: y
    Downloading Packages:
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Error: Transaction check error:
    file /usr/share/info/libquadmath.info.gz from install of libquadmath-4.8.2-1.fc20.i686 conflicts with file from package libquadmath-7.3.1-5.fc27.x86_64

    Error Summary
    -------------

    [root@localhost mrice]#

  12. #12
    Join Date
    Jun 2007
    Posts
    321
    Linux (Fedora) Chrome 67.0.3396.99

    Re: Execute i386 program on x86-64?

    I viewed /usr/share/info/libquadmath.info.gz and it seems to be just a rudimentary user's guide.

    I renamed my archived folder from test to test2011, to better identify it.

    Executing the file again yields the same error as before:

    [mrice@localhost test2011]$ ./test
    ./test: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory

    Is there's something else I must do before I can proceed?

    MIchael

  13. #13
    Join Date
    Jun 2007
    Posts
    321
    Linux (Fedora) Firefox 63.0

    Re: Execute i386 program on x86-64?

    I downloaded and installed Fedora 29 (i386). Then installed gcc-gfortran and nasm. Then moved the archived test folder to home, did a new make on the contents, and executed it. Then I fell out of my chair.

    [mrice@localhost test]$ ./test
    BEGIN LIST
    1.0000
    BEGIN SUBLIST
    6.0000
    END SUBLIST
    3.0000
    END LIST
    Sublists = 1
    [mrice@localhost test]$

    --------------------------

    Here's test.f90, with some added comments:

    ! Reads list l1 linearly, counting the sublists.
    dimension space(100) !Dedicate some space for lists
    call initas(space,100)
    kount = 0
    l1 = 0 !Not sure why I had to zero out
    l2 = 0 !these two list variables.
    call list(l1) !Create two empty lists
    call list(l2)
    call newbot(1.0,l1) !Add 1.0 at the bottom of l1
    call newbot(6.0,l2) !Add 6.0 at the bottom of l2
    call newbot(l2,l1) !Add l2 at the bottom of l1
    call newbot(3.0,l1) !Add 3.0 at the bottom of l1
    call prlsts(l1,3) !Print l1. The 3 = reals; 2 = chars; 1 = ints
    k = lrdrov(l1) !Create a list reader for l1
    1 x = advlnl(k,f) !Read bottom up counting sublists
    if (f .ne. 0) goto 2
    kount = kount + 1
    go to 1
    2 continue
    write(6,999) kount !Print the sublist count.
    999 format(11hSublists = , i2)
    end

    Thanks, all.

    Michael

Similar Threads

  1. Execute a program as another user
    By tnetaji in forum Security and Privacy
    Replies: 10
    Last Post: 9th November 2017, 12:45 PM
  2. Please execute this program on your Fedora and help me
    By Prasath in forum Programming & Packaging
    Replies: 4
    Last Post: 12th February 2016, 11:42 AM
  3. Execute my program by ordinary user
    By mlyczko in forum Security and Privacy
    Replies: 8
    Last Post: 6th March 2011, 02:26 PM
  4. Need to execute a tiny DOS com program at boot
    By Areal Person in forum Using Fedora
    Replies: 5
    Last Post: 20th December 2009, 09:54 PM
  5. Using Alt+F2 to execute program from terminal
    By kjartani in forum Using Fedora
    Replies: 9
    Last Post: 21st October 2009, 01:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •