Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Building 32 bit apps on Ubuntu64
Building 32 bit apps on Ubuntu64 [message #29152] Thu, 07 October 2010 18:24 Go to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
As it costed me some effort to find it out how to do it, I'll post the results here, just in case somebody needs it Smile

1) Create a new build method, naming it, for example, GCC32

2) Copy ALL settings from GCC build method to the newly created one (ALL, including include directories, flags, etc).
You can omit the LIB directories point, see later

3) Install IA32-LIBS package, it's available on repo. You'll still miss some libs... in particular this damn'd libnotify which costed me some effort.

4) Using getlibs command (install it from repo), install libnotify 32 bit library. You may need also libdbus-1 and libdbus-glib-1, I don't remember if I had them already installed or they were in IA32-LIBS repo. If you still get linker error after last point, just install them with getlibs.

5) in GCC32 build method, Add the following :

in "Debug options" add "-m32" (without quotes !)
in "Optimize for speed" add "-m32" (without quotes !)
in "Optimize for size" add "-m32" (without quotes !)
in "Debug link options" add "-ldbus-glib-1"
in "Release link options" add "-ldbus-glib-1"

wipe all contents of "LIB Directories" and put there these 2 lines :
/lib32
/usr/lib32

That's all. If you STILL get linker errors, annotate them and install the missing 32 bit libs with getlibs command. Google for getlibs examples if you have some doubt.

If you get this linker errors starting with
"undefined reference to `dbus_g_bus_get'"
You missed to add the lines in Debug link option and/or Release link options.

Hope that's useful for somebody Smile

Ciao

Max

[Updated on: Thu, 07 October 2010 23:09]

Report message to a moderator

Re: Building 32 bit apps on Ubuntu64 [message #29153 is a reply to message #29152] Thu, 07 October 2010 21:04 Go to previous messageGo to next message
andrei_natanael is currently offline  andrei_natanael
Messages: 262
Registered: January 2009
Experienced Member
Hi Max,

That's useful. I've tried once but without success. Now is the time to retry. Thanks Smile

Sorry about libnotify, it was added to support "tray" notifications in Linux as there isn't a standard way to do it.

Andrei
Re: Building 32 bit apps on Ubuntu64 [message #29155 is a reply to message #29153] Thu, 07 October 2010 21:49 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
andrei_natanael wrote on Thu, 07 October 2010 21:04

Hi Max,

That's useful. I've tried once but without success. Now is the time to retry. Thanks Smile

Sorry about libnotify, it was added to support "tray" notifications in Linux as there isn't a standard way to do it.

Andrei


Yep, I remember a thread about libnotify Smile
The problem wasn't libnotify itself, but the fact that IA32-LIBS ubuntu package don't have it AND that it has many dependencies on dbus and others.

Anyways, if you try it, please tell me the results, as my PC is full of 32 bit libs downloaded in time and I'm not sure that my howto is complete.

Ciao

Max
Re: Building 32 bit apps on Ubuntu64 [message #29157 is a reply to message #29155] Thu, 07 October 2010 23:30 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
A note : libnotify is needed *only* for gui apps, I think.
On console apps it's better to omit the -ldbus-glib-1 stuffs, so if they're not present on target the app can work.

I'd like to have a way to automate this stuff... by now, if I compile a gui app without the -ldbus-glib-1 the linker complains about missing symbols from libnotify.
On console app the build process is ok in both cases but then, with -ldbus-glib-1, the app NEEDS that library even if it don't use it.....

I've succesfully built an SCGI (console) app in my ubuntu64 in 32 bit mode, sent to my web virtual 32 bit server with CENTOS installed and it worked like a charm Smile

Ciao

Max
Re: Building 32 bit apps on Ubuntu64 [message #29176 is a reply to message #29157] Fri, 08 October 2010 18:54 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
Building of 32 bit apps on Ubuntu64 also requires a "multilib" package with GCC. It is "gcc-4.4-multilib" in my case.

Regards,
Novo
Re: Building 32 bit apps on Ubuntu64 [message #29177 is a reply to message #29176] Fri, 08 October 2010 19:44 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Novo wrote on Fri, 08 October 2010 18:54

Building of 32 bit apps on Ubuntu64 also requires a "multilib" package with GCC. It is "gcc-4.4-multilib" in my case.


Ah, I've got it already installed.
It would be nice to test on a "clean" ubuntu install to see the complete list of needed packages and make a script to install them.... And maybe to make automatically a GCC32 builder.

My system is so full of installed libs that I really can't be sure of ALL the needed dependencies for 32 bit Smile

Max
Re: Building 32 bit apps on Ubuntu64 [message #29178 is a reply to message #29177] Fri, 08 October 2010 20:39 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

mdelfede wrote on Fri, 08 October 2010 19:44

It would be nice to test on a "clean" ubuntu install to see the complete list of needed packages and make a script to install them.... And maybe to make automatically a GCC32 builder.

I can add the GCC32 build method into the amd64 packages. It should be quite simple if you send me the file (GCC32.bmc).

Honza
Re: Building 32 bit apps on Ubuntu64 [message #29179 is a reply to message #29178] Fri, 08 October 2010 21:26 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
dolik.rce wrote on Fri, 08 October 2010 20:39

mdelfede wrote on Fri, 08 October 2010 19:44

It would be nice to test on a "clean" ubuntu install to see the complete list of needed packages and make a script to install them.... And maybe to make automatically a GCC32 builder.

I can add the GCC32 build method into the amd64 packages. It should be quite simple if you send me the file (GCC32.bmc).

Honza



Hi Honza,

the problem are dependencies AND the libnotify, in particular.
And adding all 32 bit dependencies to 64 bit package seems overkilling.
Maybe an additional package that provides just the GCC32 build method and all required 32 bit dependencies would be great.
That one could be an ide-version-independent package.

BTW, there's still the libnotify problem that I couldn't solve completely.... on GUI apps you need it, and you MUST include in linker option the "-ldbus-glib-1", otherwise you get linker errors.
On console apps it's not needed and, if you include by default, the console app will run just when dbus-glib-1 is present.

I really don't understand why the "-ldbus-glib-1" is needed on commandline, it should be requested automatically by libnotify, but......

Max

Edit : I'll add anyways both .bm files Smile
  • Attachment: GCC32.zip
    (Size: 0.85KB, Downloaded 247 times)

[Updated on: Fri, 08 October 2010 21:31]

Report message to a moderator

Re: Building 32 bit apps on Ubuntu64 [message #29180 is a reply to message #29179] Fri, 08 October 2010 22:02 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Yes, additional simple package is probably the best way to go. I'll look at it at the weekend.

I can't help you with the dbus-glib-1 problem, as all I know is that on regular 32b system it is linked in automatically. BTW: I don't have 64b system so you will have to do all the testing Wink

Honza
Re: Building 32 bit apps on Ubuntu64 [message #29181 is a reply to message #29179] Fri, 08 October 2010 22:14 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
I'm personally getting different linking issues including not correctly installed libz.so

$ ls -l /usr/lib32/libz.so
lrwxrwxrwx 1 root root 20 2010-10-08 16:04 /usr/lib32/libz.so -> /lib/libz.so.1.2.3.3

getlibs is not a miracle after all. Smile


Regards,
Novo
Re: Building 32 bit apps on Ubuntu64 [message #29183 is a reply to message #29181] Fri, 08 October 2010 22:41 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Novo wrote on Fri, 08 October 2010 22:14

I'm personally getting different linking issues including not correctly installed libz.so

$ ls -l /usr/lib32/libz.so
lrwxrwxrwx 1 root root 20 2010-10-08 16:04 /usr/lib32/libz.so -> /lib/libz.so.1.2.3.3

getlibs is not a miracle after all. Smile


No, getlibs isn't a miracle at all Smile

I guess the best would be to setup a clean ubuntu64 box, install IA32-LIBS and then install missing libs by hand one by one annotating them.
When the list is ready, we can create a script that to the job.

BTW, If I remember, I had to add a soft link from a .so.xx.yy to a .so library (don't remember which Sad )

IMHO it would be quite good to have a 32 bit build method, it's useful to build apps designed, for example, to run on a remote linux box.

@dolik-rce : hmmmmm.... I can't test that one reliabily, as I have my box full of 32 bit libs, mostly because of wine builds Smile
But, we could test all that on an usb stick with a clean ubuntu64....

Max
Re: Building 32 bit apps on Ubuntu64 [message #29192 is a reply to message #29183] Sat, 09 October 2010 17:38 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mdelfede wrote on Fri, 08 October 2010 16:41


BTW, If I remember, I had to add a soft link from a .so.xx.yy to a .so library (don't remember which Sad )



I added a couple.

/usr/lib32/libstdc++.so -> libstdc++.so.6
/usr/lib32/libnotify.so -> libnotify.so.1

Just run "$ls -lt /usr/lib32/lib* | less" and you will see them.

I also fixed soft link for libz.so.

Instead of "/usr/lib32/libz.so -> /lib/libz.so.1.2.3.3" I recreated it as "libz.so -> libz.so.1".

Now everything looks good in my case.


Regards,
Novo
Re: Building 32 bit apps on Ubuntu64 [message #29193 is a reply to message #29183] Sat, 09 October 2010 17:49 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mdelfede wrote on Fri, 08 October 2010 16:41


IMHO it would be quite good to have a 32 bit build method, it's useful to build apps designed, for example, to run on a remote linux box.



IMHO TheIDE has GCC32 Builder (at least in my case).

What I personally would like to see is the ability to set up a target platform for a compiler in the builder configuration UI. That would let me to set up WIN32 target for the MinGW compiler on Linux. Now it is hardcoded to LINUX, I believe. This small change would make cross-compilation much easier. Instead of installing UPP under Wine I would be able to compile everything on Linux. Smile


Regards,
Novo

[Updated on: Sat, 09 October 2010 17:52]

Report message to a moderator

Re: Building 32 bit apps on Ubuntu64 [message #29194 is a reply to message #29193] Sat, 09 October 2010 18:26 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Novo wrote on Sat, 09 October 2010 17:49

mdelfede wrote on Fri, 08 October 2010 16:41


IMHO it would be quite good to have a 32 bit build method, it's useful to build apps designed, for example, to run on a remote linux box.



IMHO TheIDE has GCC32 Builder (at least in my case).




yep, but in my case didn't work out of the box.... I don't know if it has the -m32 hardcoded. Anyways I added it as a compiler flag and it runs well

Quote:


What I personally would like to see is the ability to set up a target platform for a compiler in the builder configuration UI. That would let me to set up WIN32 target for the MinGW compiler on Linux. Now it is hardcoded to LINUX, I believe. This small change would make cross-compilation much easier. Instead of installing UPP under Wine I would be able to compile everything on Linux. Smile


Yes, that would be useful, even if mingw isn't a so reliable compiler. I use wine too, with MSC to build windows apps.

BTW... did you solve the libnotify -- -ldbus-glib-1 problem ?
I had to setup 2 builds methods, one for gui apps and one without, because of it.

Max
Re: Building 32 bit apps on Ubuntu64 [message #29195 is a reply to message #29194] Sat, 09 October 2010 21:09 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mdelfede wrote on Sat, 09 October 2010 12:26


BTW... did you solve the libnotify -- -ldbus-glib-1 problem ?
I had to setup 2 builds methods, one for gui apps and one without, because of it.



Not yet. This is actually strange because linker should drop unused dependencies by itself.

I traced loading of a console application and it actually loads and binds libdbus-glib-1.so.2. This is strange.


Regards,
Novo
Re: Building 32 bit apps on Ubuntu64 [message #29346 is a reply to message #29195] Fri, 15 October 2010 18:39 Go to previous message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
I made a couple more experiments with building of 32 bit executables on 64 bit Linux and it turned out that "-m32" option with compiler and "-ldbus-glib-1" option with linker are not necessary. It is just enough to choose a GCC32 builder. I haven't had any linking issues so far and there is no redundant dependency on dbus-glib-1.so.2 in console applications.

My release builder options look like below.

Optimize for speed: -O3 -ffunction-sections -fdata-sections
Optimize for size: -Os -finline-limit=20 -ffunction-sections -fdata-sections
Release link options: -Wl,--gc-sections


Regards,
Novo
Previous Topic: Working on new installer / makeinstall...
Next Topic: Porting SystemDraw to Frambuffer
Goto Forum:
  


Current Time: Thu Mar 28 17:45:03 CET 2024

Total time taken to generate the page: 0.01707 seconds