| 
 | 
 | 
 
Home » Community » Coffee corner » Compile to 32 bit on Linux 64 bit 
	| 
		
 |  
	| 
		
 |  
	
		
		
			| Re: Compile to 32 bit on Linux 64 bit [message #49185 is a reply to message #49169] | 
			Wed, 03 January 2018 22:03    | 
		 
		
			
				
				
				
					
						  
						Zbych
						 Messages: 328 Registered: July 2009 
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		forlano wrote on Sat, 30 December 2017 17:12 
has anybody tried to compile a U++ program for 32 bit from a 64 bit machine? 
What package should I install?
  
 
I did - just simple console app (no GUI) and all I had to install was some multilib package. 
I found in my notes for ubuntu 14.04: 
sudo apt-get install gcc-multilib 
sudo apt-get install gcc-4.9-multilib g++-4.9-multilib 
sudo apt-get install gcc-5-multilib g++-5-multilib 
 
And don't forget to add -m32 to compiler options. 
		
		
		[Updated on: Wed, 03 January 2018 22:36] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	
		
		
			| Re: Compile to 32 bit on Linux 64 bit [message #49204 is a reply to message #49185] | 
			Sun, 07 January 2018 14:20    | 
		 
		
			
				
				
				  | 
					
						  
						forlano
						 Messages: 1215 Registered: March 2006  Location: Italy
						
					 | 
					Senior Contributor  | 
					 | 
		 
		 
	 | 
 
	
		Zbych wrote on Wed, 03 January 2018 22:03forlano wrote on Sat, 30 December 2017 17:12 
has anybody tried to compile a U++ program for 32 bit from a 64 bit machine? 
What package should I install?
  
 
I did - just simple console app (no GUI) and all I had to install was some multilib package. 
I found in my notes for ubuntu 14.04: 
sudo apt-get install gcc-multilib 
sudo apt-get install gcc-4.9-multilib g++-4.9-multilib 
sudo apt-get install gcc-5-multilib g++-5-multilib 
 
And don't forget to add -m32 to compiler options. 
  
 
Hello Zbych, 
 
thanks for the answer. Can you post the .bm file you have used to compile the U++ package? 
I have installed multilib and used -m32 option but still getting complain from the compiler. 
Perhaps even the .h and lib used should be addressed properly. 
 
thanks, 
Luigi
		
		
		[Updated on: Sun, 07 January 2018 14:21] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	
		
		
			| Re: Compile to 32 bit on Linux 64 bit [message #49223 is a reply to message #49204] | 
			Mon, 08 January 2018 21:23    | 
		 
		
			
				
				
				
					
						  
						Zbych
						 Messages: 328 Registered: July 2009 
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		forlano wrote on Sun, 07 January 2018 14:20Can you post the .bm file you have used to compile the U++ package? 
I have installed multilib and used -m32 option but still getting complain from the compiler. 
Perhaps even the .h and lib used should be addressed properly. 
  
 
I just made a copy of GCC.bm and added -m32 to both compile and link options. My GCC32.bm: 
BUILDER = "GCC";
COMPILER = "g++";
COMMON_OPTIONS = "-m32";
COMMON_CPP_OPTIONS = "-std=c++14";
COMMON_C_OPTIONS = "";
COMMON_LINK = "-m32";
COMMON_FLAGS = "";
DEBUG_INFO = "2";
DEBUG_BLITZ = "1";
DEBUG_LINKMODE = "1";
DEBUG_OPTIONS = "-O0";
DEBUG_FLAGS = "";
DEBUG_LINK = "";
RELEASE_BLITZ = "0";
RELEASE_LINKMODE = "1";
RELEASE_OPTIONS = "-O3 -ffunction-sections -fdata-sections";
RELEASE_FLAGS = "";
RELEASE_LINK = "-Wl,--gc-sections";
DEBUGGER = "gdb";
ALLOW_PRECOMPILED_HEADERS = "0";
DISABLE_BLITZ = "0";
PATH = "";
INCLUDE = "/usr/include/freetype2;/usr/include/gtk-2.0;/usr/include/glib-2.0;/usr/lib/glib-2.0/include;/usr/lib/gtk-2.0/include;/usr/include/cairo;/usr/include/pango-1.0;/usr/include/atk-1.0;/usr/include/gdk-pixbuf-2.0;/usr/lib/i386-linux-gnu/glib-2.0/include;/usr/lib/x86_64-linux-gnu/glib-2.0/include;/usr/lib/i386-linux-gnu/gtk-2.0/include;/usr/lib/x86_64-linux-gnu/gtk-2.0/include;/usr/include/gtk-3.0/gdk";
LIB = "/usr/X11R6/lib";
LINKMODE_LOCK = "0";
  
 
And I made the test on ubuntu 16.04 this time. All I had to install was: 
sudo apt-get install gcc-multilib g++-multilib 
sudo apt-get install lib32z1-dev 
		
		
		[Updated on: Mon, 08 January 2018 21:26] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	
		
		
			| Re: Compile to 32 bit on Linux 64 bit [message #49247 is a reply to message #49223] | 
			Wed, 10 January 2018 15:18    | 
		 
		
			
				
				
				  | 
					
						  
						forlano
						 Messages: 1215 Registered: March 2006  Location: Italy
						
					 | 
					Senior Contributor  | 
					 | 
		 
		 
	 | 
 
	
		Zbych wrote on Mon, 08 January 2018 21:23 
 
And I made the test on ubuntu 16.04 this time. All I had to install was: 
sudo apt-get install gcc-multilib g++-multilib 
sudo apt-get install lib32z1-dev 
  
 
I confirm that this works even on lubuntu 17.10 for CONSOLE appliccation. 
 
However for GUI program it is not enough. Other libraries in :i386 version need to be installed. 
At moment I was not able to install everything. The Xft lib in 32 bit mode cannot stay with the one in 64 bit (apt-get want to remove one to accomodate the other). So I preferred to not spoil the 64 bit system. Maybe exist some way to install what is necessery. 
 
Luigi 
 
edit: today I have installed libxft-dev:i386 . The installation removed the libxft-dev at 64 bit. However I was able to compile a 32 bit application. 
Then I tried to compile the 64 bit application. Obviously the compiler complained the missing libxft-dev. I tried to install it but it removed the 32 bit version! A nightmare. 
It seems libxft-dev cannot coexist in the same machine in 32 and 64 bit mode. This prevent to compile easily a program in 32 and 64 bit... at least on lubuntu
		
		
		[Updated on: Thu, 11 January 2018 20:10] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 03:41:47 CET 2025 
 Total time taken to generate the page: 0.09886 seconds 
 |   
 |  
  |