GCC cross-compiling in puppy

discuss compiling applications for Puppy
Post Reply
Message
Author
User avatar
perdido
Posts: 1528
Joined: Mon 09 Dec 2013, 16:29
Location: ¿Altair IV , Just north of Eeyore Junction.?

GCC cross-compiling in puppy

#1 Post by perdido »

Compiled new versions of 64-bit gcc 6.20 & 6.55
Am now attempting to set up a cross-compiling environment using a 64-bit xenial or bionic as I would like to compile 32-bit programs using the 64-bit gcc

I have tried using the stock gcc and also my installed compiled versions to compile a cross-compiling gcc 6.2.0 or 6.5.5 in 64-bit xenial or bionic by bootstrapping from the exact same version I was trying to build.
32-bit c headers are installed.

My question is has anyone been able to make a cross-compiling gcc in 64-bit puppy?
I suspect my error may be that i need to compile a whole new toolchain and not just a new gcc and 32-bit c headers.

enrique
Posts: 595
Joined: Sun 10 Nov 2019, 00:10
Location: Planet Earth

Re: GCC cross-compiling in puppy

#2 Post by enrique »

Lately I have been misunderstanding issues. So lets start by asking it again. This is what I understood you objective is:
perdido wrote:... I would like to compile 32-bit programs using the 64-bit gcc....

You do not need a "cross-compiling environment". to compile a 32 bit program inside a 64bit OS.

But if you 32 bit program use external libraries, and you want to execute the code in 64bit OS then you most install 32bit compatibility.

In Ubuntus/Debian deb this is done thru the use of

Code: Select all

dpkg --print-foreign-architectures
sudo dpkg --add-architecture i386
In Puppy I guess is "32bit compatibility" package.

Now going back to just compile. 32bits are build adding -m32 as cflag

Code: Select all

export CFLAGS='-m32'
export CXXFLAGS='-m32'
export LDFLAGS='-m32'
make
or simple gcc command

Code: Select all

gcc -m32 hellow.c -o hellow
I had done compilation version for extra gcc only to get an old gcc for new OS. As new oses had banned old gcc.

Or real cross-compile like ARM etc.

User avatar
perdido
Posts: 1528
Joined: Mon 09 Dec 2013, 16:29
Location: ¿Altair IV , Just north of Eeyore Junction.?

Re: GCC cross-compiling in puppy

#3 Post by perdido »

enrique wrote:Lately I have been misunderstanding issues. So lets start by asking it again. This is what I understood you objective is:
perdido wrote:... I would like to compile 32-bit programs using the 64-bit gcc....

You do not need a "cross-compiling environment". to compile a 32 bit program inside a 64bit OS.

But if you 32 bit program use external libraries, and you want to execute the code in 64bit OS then you most install 32bit compatibility.

In Ubuntus/Debian deb this is done thru the use of

Code: Select all

dpkg --print-foreign-architectures
sudo dpkg --add-architecture i386
In Puppy I guess is "32bit compatibility" package.

Now going back to just compile. 32bits are build adding -m32 as cflag

Code: Select all

export CFLAGS='-m32'
export CXXFLAGS='-m32'
export LDFLAGS='-m32'
make
or simple gcc command

Code: Select all

gcc -m32 hellow.c -o hellow
I had done compilation version for extra gcc only to get an old gcc for new OS. As new oses had banned old gcc.

Or real cross-compile like ARM etc.
Thanks for the clear answer. :) I appreciate the help.

Background:
Mozilla requires all 32-bit binaries to now be compiled in a 64-bit environment . I wish to compile a 32-bit seamonkey-2.53.1, I have compiled a 64-bit seamonkey-2.53.1 using xenial64 with the upgraded gcc 6.2 version.

Seamonkey-2.53.1 requires a gcc 6.1 or newer and glibc 2.6 or older.
Puppy xenial 64 has glibc 2.6 and gcc 5.4
Puppy bionic64 has glibc 2.7 and gcc 7.xx

Neither can be used as built. I thought it would be easier to build gcc 6.2 or gcc 6.5 and add it to xenial to make my build environment for seamonkey. I built seamonkey 2.53.1 64 bit version using xenial64 with upgraded gcc to version 6.2 with success.
When I tried building 32-bit seamonkey 2.53.1 there were m32 errors and the gcc 6.2 would not create 32-bit binaries. That same gcc had just compiled 64-bit seamonkey.
After that happened I thought that I needed a dedicated cross-compile environment and tried building gcc 6.5 as a cross compiler but it always failed to build. I could build it as x64 but not cross-compiling. I was stuck.

Now knowing the 64-bit gcc does all x86 compiling opens the door and I tried a 32-bit seamonkey in xenial64 with upgraded gcc to version 6.5
The gcc 6.5 will create 32-bit binaries and passes that check, the gcc 6.2 failed that check and I did not run the tests after compiling gcc 6.2 so something is broken in the gcc 6.2 for 32-bit compiling.
Now I am trying to compile seamonkey 2.53.1 32-bit in xenial64 with upgraded gcc 6.5
Thank you enrique :)

enrique
Posts: 595
Joined: Sun 10 Nov 2019, 00:10
Location: Planet Earth

#4 Post by enrique »

perdido

Uhhm! My posted information should work on any program You create and build for your self. Where you have control over what is included.

I see you dilemma, you do know how to compile. But you trying to hack over a decision made by the original developer. They decided ONLY 64bit support.

I am not trying to say you will not succeed. I witch you the best. But if a developer made his mind he can easily put in place mechanism to make any 32bit compilation impossible. Can be as simple as not providing a 32 bit required library. That will be to obvious as you will see the missing library output. So instead a developer can not update old 32bit libraries making the creation of a final 32 bit solution buildable but none workable. Or just simply broken.

Post Reply