Cross compiling for 32 bit


#1

Hi there!

is there any way for me to cross compile a 32 bit binary from the openframeworks 64 bit on my 64 bit install of ubuntu? I would really like to avoid spinning up another vm if I can.


#2

i think:

  
  
make PLATFORM_ARCH=i686 PLATFORM_CFLAGS=-m32  
  

should work if you edit libs/openFrameworksCompiled/project/makefileCommon/config.linux.common.mk and change line 114 to:

  
  
PLATFORM_CFLAGS += -Wall   
  

usually you need to install the 32bits system libraries for crosscompiling to 32bits, i think it’s something like:

  
  
sudo apt-get install gcc-multilib ia32-libs  
  

but i might be missing some package


#3

cool, will give it a shot and let you know how I get on.


#4

so this doesn’t work because it either bails on:

  
/usr/include/ft2build.h:56:38: fatal error: freetype/config/ftheader.h: No such file or directory  

if I have run install_dependencies.sh or it fails with

  
couldn't find some pkg-config packages, did you run the latest install_dependencies.sh?  

if I (e.g.) run

  
sudo apt-get install libfreetype6-dev:i386  

or

  
 sudo apt-get install gcc-multilib ia32-libs  

I tried commenting out the chunk of config.shared.mk that is causing that, but it seems to be doing something else… Perhaps I am doing the apt-gets in the wrong order, or perhaps the system doesn’t like having multiple sets of libs in place?


#5

oh, yeah didn’t realized there’s several libraries you need to install in the system. probably you also need to set the pkg-config database to point to the correct one for i386 but not sure how to do it. i plan to add this at some point but i would say that it’ll probably be easier for you right now to install a vm with ubuntu 32bits


#6

ok, cool that is what I kinda figured. No worries, it is funny how easy it is to spin up a new OS these days.


#7

Hi,

I was trying to do the same and wondering if there was any improvements made in this direction.

I started to install 32-bit version of some libs but then I was getting message

“lib_blablabla not installed. Did you run the latest install_dependencies.sh?”

If I run again the dependency script, it will replace the 32-bit library I manually installed with 64-bit version. Also I don’t really want to go through every library this script is installing to get the 32-bit version.
Is there an easy way to do that somehow?

I could just use a version of Ubuntu 32-bit but I want to use QtCreator and the version 4.1.0 is now only available as 64-bit version.


#8

Do you still suggest using a vm with ubuntu 32bits?
Thanks.


#9

0.9.8 was the last version to support 32bit, from 0.10 on there will only be 64bit as most distros don’t support 32bits anymore


#10

Thanks for your answer.


#11

Hi Arturo, so, what will be the suggested scenario to make programs for old (but updated) linux 32bit machines? I.e. I have a machine with an Ubuntu 18.04, but I can’t install 0.98, it says that there are some troubles compiling:

src/CipherImpl.cpp:80:21: error: field '_ctx' has incomplete type 'EVP_CIPHER_CTX {aka evp_cipher_ctx_st}'

As I see these errors were fixed on nightly builds, but now we just have the 0.10 versions, so they can’t be run on a 32bit machine. Is there a workaround for this?

Thanks a lot, F.


#12

using apothecary on that machine you should be able to compile the required libraries for 32 bits and use them with a 0.10 download or from github


Compiling of 0.10 in a 32 bit linux
#13

I manage to compile everything with apothecary with

apothecary update core

but I can’t find anywhere a way to compile the examples. I even tried to download and proceed with the projectGenerator but it doesn’t compile, it seems to need some things that are in the apothecary directory but not in the main openFrameworks, i.e. a missing tesselator.h.

Is there any doc or written workaround for installing OF with apothecary?


#14

apothecary will compile all the libraries and leave them in it’s root folder. you need to move or copy those to the libs folder of openframeworks and some of them (opencv, poco…) to their respective addons libs folders.

this is not an officially supported workflow or platform so there’s no documentation or scripts to make it easier but if everything compiled without errors once you put the libraries in the correct places it should work.