How to install build-essential:i386 to compile a 32-bit executable on a 64-bit system?
Solution 1
Yes, for anything that is not already packaged in Ubuntu, or in a PPA that you've added, you will have to manually install all the dependencies needed to compile it. For anything already packaged in Ubuntu, you can run apt-get build-dep $package
and it will install the build dependencies for that package, however, if there are any additional or changed dependencies from what was used in the version built in Ubuntu, you will still need to manually install those additional or changed dependencies.
Solution 2
AFAIU, an optimal way to compile 32-bit executable on a 64-bit system would be creating a chroot in the following way (you may want to replace xenial
with a needed codename):
mk-sbuild --arch=i386 xenial # Currently, first time it needs to be executed twice, unfortunately, please comment if you know how to omit this.
mk-sbuild --arch=i386 xenial
# Allowing the same home folder to be used
echo "$HOME /home/$USER none rw,bind 0 0" | sudo tee -a /etc/schroot/sbuild/fstab
Then you can use the chroot with just
schroot -c xenial-i386
Notice that it won't have sudo by default, you'll have to manage it with
sudo schroot -c source:xenial-i386 -u root
Idea found in this answer https://askubuntu.com/a/216670/20275
Related videos on Youtube
int_ua
I dream of a day when settings are written to disk only when changed and software does not freak out when $HOME is read-only.
Updated on September 18, 2022Comments
-
int_ua over 1 year
apt-get install build-essential:i386
doesn't work at all:The following packages have unmet dependencies: build-essential:i386 : Depends: gcc:i386 (>= 4:4.4.3) but it is not going to be installed Depends: g++:i386 (>= 4:4.4.3) but it is not going to be installed
Note the 14.04 tag. Answers on Trouble compiling a 32 bit binary on a 64 bit machine are outdated. Also, there are no
./configure
script to use the Compile 32 bit on 64 bitsystem answer.More details
I'm trying to complite DFHack from quietust branch: https://github.com/quietust/dfhack/
apt-get install gcc-multilib g++-multilib
removed theCMake Error at depends/protobuf/CMakeLists.txt:60 (MESSAGE): Could not find a working hash map implementation. Please install GCC >= 4.4, and all necessary 32-bit C++ development libraries.
message, but
-- Could NOT find Threads (missing: Threads_FOUND) Can't locate XML/LibXML.pm in @INC (you may need to install the XML::LibXML module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at xml/list.pl line 6. BEGIN failed--compilation aborted at xml/list.pl line 6.
is still there. Do I have to manually seek all i386 build-essential the dependencies?
-
AlexGreg over 9 yearsAFAIK you can't have 32 and 64bit build-essential at the same time..
-
int_ua over 9 yearsWell, that's sad and uncomfortable.
-
Ahmed Al-attar over 7 yearsi dont have the answer for you , but once i made a
cross-compiling
from an32bit
toarm
architecture, and it worked fine , it wasopenCV
, just shared this here to give you any help or clue.
-
-
int_ua over 9 yearsThanks, but I meant build-essential dependencies. Added it to the question. But still looks like I'll have to manually install them. In the absence of a better answer I'll accept yours in several days.
-
int_ua over 9 yearsOk, installing
gcc-multilib g++-multilib
and build-deps was enough. -
dobey over 9 yearsYes, and you asked about perl modules too, which is why my answer is more generic.