FedoraForum.org - Fedora Support Forums and Community
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2012
    Location
    middle east
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How build 32bit on 64bit?

    Hi,
    I want to create 32 bit executable of my code on 64 bit fedora.
    I know how to build 32 bit rpm with mock, but for non-rpm src I dont know?
    The other solution is chroot, but I dont know how setup 32bit chroot on my 64bit system.

    Could you help me?
    Thanks.

  2. #2
    Join Date
    Oct 2010
    Location
    Canberra
    Posts
    4,043
    Mentioned
    20 Post(s)
    Tagged
    1 Thread(s)

    Re: How build 32bit on 64bit?

    I cannot confirm that this will work as I have no need for the additional libraries, but this page describes an approach:
    http://www.cyberciti.biz/tips/compil...bit-linux.html

    I have many ideas, even some I haven't thought of yet.

  3. #3
    Join Date
    Jun 2012
    Location
    middle east
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How build 32bit on 64bit?

    Hi ocratato,
    for gcc -m32 i must install required libs one by one.

  4. #4
    Join Date
    Dec 2005
    Location
    North Carolina
    Age
    37
    Posts
    1,162
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How build 32bit on 64bit?

    Unfortunately I don't think you are going to be able to make 32 bit binaries without 32 bit libraries.
    Laptop: Lenovo ThinkPad T410, CPU: Intel Core i5 520M, Ram: 8GB DDR3, Hard Drive: 320GB, Graphics: Intel HD, OS: Windows 7 / Arch Linux x86_64
    Desktop: Motherboard: ASRock Fatal1ty AB350 Gaming K4, CPU: AMD Ryzen 3 1200, RAM: 8GB DDR4, Storage: Samsung 850 Pro 256GB, Graphics: Asus Radeon RX 550 4GB, OS: Arch Linux x86_64

  5. #5
    Join Date
    Aug 2011
    Posts
    899
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How build 32bit on 64bit?

    A couple of possibilities:
    - Create a 32bit VM in libvirt (using virt-manager is not too complicated after you get used to it) and build there

    - Use mock, I tested for a 32bit F20:
    Code:
    mock -r fedora-20-i386 --init
    mock -r fedora-20-i386 --shell
    the second command drops me into a 32bit chroot. The filesystem of the chroot is located under /var/lib/mock/fedora-20-i386/root/ ;I think you could switch to the mockbuild user 'su mockbuild', put your source tarball under /var/lib/mock/fedora-20-i386/root/builddir/ and build from source.

    Make sure to copy/backup the files in /var/lib/mock/fedora-20-i386/root/builddir/ after finishing and before exiting from the chroot (I think mock will probably overwrite /var/lib/mock/fedora-20-i386/root if you initialize the chroot again). Alternatively you can 'mount --bind' the directory where you unpacked the source tarball of the software you want to compile under e.g. /var/lib/mock/fedora-20-i386/root/builddir/unpacked_dir and be sure to unmount it before you exit the chroot.

    You can of course copy the chroot /var/lib/mock/fedora-20-i386/root/ and create a custom script to 'mount --bind' the necessary filesystems (e.g. /proc, /sys... etc) and then chroot, but if you've no problem with letting mock manage all these extra steps for you...

  6. #6
    Join Date
    Jun 2012
    Location
    middle east
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    (solved) How build 32bit on 64bit?

    Thanks Ahmad Samir

Similar Threads

  1. Replies: 0
    Last Post: 6th February 2012, 04:47 AM
  2. 64bit or 32bit ?
    By aniketv in forum Using Fedora
    Replies: 6
    Last Post: 18th November 2009, 02:03 AM
  3. 32bit vs 64bit....
    By Camberwell in forum Linux Chat
    Replies: 5
    Last Post: 14th October 2009, 11:34 PM
  4. F8 vs. F9 (and 32bit vs. 64bit)
    By Pacopag in forum Installation, Upgrades and Live Media
    Replies: 8
    Last Post: 25th June 2008, 08:49 PM
  5. 32bit or 64bit?
    By hiberphoptik in forum Hardware
    Replies: 3
    Last Post: 6th December 2005, 08:51 AM

Tags for this Thread

Posting Permissions

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