Difference between revisions of "Building 32-bit packages on a 64-bit system"

From ArchWiki
Jump to: navigation, search
(Build 32-bit packages in a 64-bit environment)
m (Build 32-bit packages in a 64-bit environment: Note about multilib repos)
(8 intermediate revisions by 7 users not shown)
Line 1: Line 1:
[[Category:Arch64 (English)]]
+
[[Category:Arch64]]
[[Category:HOWTOs (English)]]
+
 
==Build 32-bit packages in a 64-bit environment==
 
==Build 32-bit packages in a 64-bit environment==
'''Note'''
+
{{Note|{{pkg|devtools}} is needed. Because of circular dependencies, you may need to install {{pkg|arch-install-scripts}} at the same time.}}
If you are using or plan to use either [http://wiki.archlinux.org/index.php/Install_bundled_32-bit_system_in_Arch64#arch32-light| Arch32 light] or [http://wiki.archlinux.org/index.php/Install_bundled_32-bit_system_in_Arch64| Install Bundled 32-bit system in Arch64] you will need to use a different directory other than  
+
 
/opt/arch32 since this tutorial will conflict with the directory chosen in the other articles.
+
{{Note|If you are using or plan to use either [[Install_bundled_32-bit_system_in_Arch64#arch32-light|Arch32 light]] or [[Install bundled 32-bit system in Arch64]] you will need to use a different directory other than /opt/arch32 since this tutorial will conflict with the directory chosen in the other articles.}}
  
 
This example uses mkarchroot to create the chroot environment. First, create /opt/arch32 or another directory of your choice. The next steps is to copy your existing pacman.conf and makepkg.conf file to /opt/arch32 or your chosen directory. In the following tutorial, substitute /opt/arch32 with your chosen directory if you decide to use a different directory.
 
This example uses mkarchroot to create the chroot environment. First, create /opt/arch32 or another directory of your choice. The next steps is to copy your existing pacman.conf and makepkg.conf file to /opt/arch32 or your chosen directory. In the following tutorial, substitute /opt/arch32 with your chosen directory if you decide to use a different directory.
  
'''Note'''
+
{{Note|If you have customized either makepkg.conf or pacman.conf, then you will need to use the standard pacman.conf and makepkg.conf files.  Also make sure your /etc/pacman.d/mirrorlist contains the $arch variable instead of x86_64 or i686}}
If you have customized either makepkg.conf or pacman.conf, then you will need to use the standard pacman.conf and makepkg.conf files.
+
  Also make sure your /etc/pacman.d/mirrorlist contains the $arch variable instead of x86_64 or i686
+
  
 
'''Edit your /opt/arch32/pacman.conf'''
 
'''Edit your /opt/arch32/pacman.conf'''
 
  Change Architecture = auto to Architecture = i686
 
  Change Architecture = auto to Architecture = i686
  
'''Note:'''
+
You will also need to comment out any multi-lib repos.
''Thanks to Remy Oudompheng to pointing this out''
+
 
  devtools (version 0.9.10 in [testing]) contains a ready-to-use /usr/share/devtools/makepkg-i686.conf.  
+
{{Note|''Thanks to Remy Oudompheng to pointing this out.''  devtools (version 0.9.10 in [testing]) contains a ready-to-use /usr/share/devtools/makepkg-i686.conf.  If you decide to use this conf file, you can skip the next step.  You will need to copy /usr/share/devtools/makepkg-i686.conf to /opt/arch32/makepkg.conf if you decide to use devtools[from testing].}}
  If you decide to use this conf file, you can skip the next step.
+
  You will need to copy /usr/share/devtools/makepkg-i686.conf to /opt/arch32/makepkg.conf if you decide to use devtools[from testing].
+
  
 
'''Edit /opt/arch32/makepkg.conf'''
 
'''Edit /opt/arch32/makepkg.conf'''
Line 37: Line 32:
 
You will need to edit /aur/copy/etc/pacman.d/mirrorlist and select which mirrors to use.
 
You will need to edit /aur/copy/etc/pacman.d/mirrorlist and select which mirrors to use.
  
Now you can use makechrootpkg to build i686 packages
+
Now you can use makechrootpkg to build i686 packages like this:
 +
# makechrootpkg -r /aur/

Revision as of 11:50, 9 January 2013

Build 32-bit packages in a 64-bit environment

Note: devtools is needed. Because of circular dependencies, you may need to install arch-install-scripts at the same time.
Note: If you are using or plan to use either Arch32 light or Install bundled 32-bit system in Arch64 you will need to use a different directory other than /opt/arch32 since this tutorial will conflict with the directory chosen in the other articles.

This example uses mkarchroot to create the chroot environment. First, create /opt/arch32 or another directory of your choice. The next steps is to copy your existing pacman.conf and makepkg.conf file to /opt/arch32 or your chosen directory. In the following tutorial, substitute /opt/arch32 with your chosen directory if you decide to use a different directory.

Note: If you have customized either makepkg.conf or pacman.conf, then you will need to use the standard pacman.conf and makepkg.conf files. Also make sure your /etc/pacman.d/mirrorlist contains the $arch variable instead of x86_64 or i686

Edit your /opt/arch32/pacman.conf

Change Architecture = auto to Architecture = i686

You will also need to comment out any multi-lib repos.

Note: Thanks to Remy Oudompheng to pointing this out. devtools (version 0.9.10 in [testing]) contains a ready-to-use /usr/share/devtools/makepkg-i686.conf. If you decide to use this conf file, you can skip the next step. You will need to copy /usr/share/devtools/makepkg-i686.conf to /opt/arch32/makepkg.conf if you decide to use devtools[from testing].

Edit /opt/arch32/makepkg.conf

Change CARCH="x86_64" to CARCH="i686"
CHOST="x86_64-unknown-linux-gnu" to CHOST="i686-unknown-linux-gnu".
CFLAGS="-march=x86_64 -mtune=generic -O2 -pipe" to CFLAGS="-march=i686 -mtune=generic -O2 -pipe" .
CXXFLAGS="-march=x86_64 -mtune=generic -O2 -pipe" to CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe" .

After the changes have been made, you will need to create another directory, I created /aur as mine.

Next run:

sudo mkarchroot -C /opt/arch32/pacman.conf -M /opt/arch32/makepkg.conf <chrootdir>/root base base-devel sudo 

If you create the /aur directory like mine you would run

sudo mkarchroot -C /opt/arch32/pacman.conf -M /opt/arch32/makepkg.conf /aur/root base base-devel sudo

You will need to edit /aur/copy/etc/pacman.d/mirrorlist and select which mirrors to use.

Now you can use makechrootpkg to build i686 packages like this:

# makechrootpkg -r /aur/