How to made a 32 bits program with 64 bits FB?

New to FreeBASIC? Post your questions here.
Luis Babboni
Posts: 357
Joined: Mar 15, 2015 12:41

How to made a 32 bits program with 64 bits FB?

Postby Luis Babboni » Jun 20, 2021 19:25

Me again, sorry.

I did a programm that works fine in my 64 bits PC but do not work in my old 32 bits PC.

I think the problem is I used the 64 bits FB.

Is there anyway to compile my programm using the 64 bits FB in a way it runs in a 32 bits machine? I do not want to installa 32 bits FB.

Thanks.
caseih
Posts: 1737
Joined: Feb 26, 2007 5:32

Re: How to made a 32 bits program with 64 bits FB?

Postby caseih » Jun 20, 2021 20:18

No.. It's possible but a bit involved. Besides needing the compiler to emit 32-bit code, you also need the 32-bit run-time library which comes with the 32-bit compiler. I'm fairly confident you can install both the 32-bit and 64-bit FB compilers on the same machine and they won't conflict, provided you only put the version you want to use in the path (or set your IDE to use that particular version).
Last edited by caseih on Jun 21, 2021 0:19, edited 2 times in total.
srvaldez
Posts: 2734
Joined: Sep 25, 2005 21:54

Re: How to made a 32 bits program with 64 bits FB?

Postby srvaldez » Jun 20, 2021 21:57

hi Luis Babboni
download the combined 32bit and 64bit standalone version from the news section, with the combined version you can use FBx64 to produce 32-bit executable, but also have the 32-bit compiler there so this tip is worthless, nevertheless if you want to compile to 32 with the 64-bit compiler pass -arch 486 on the compile command, as caseih said you need the 32-bit libraries without them this won't work
Luis Babboni
Posts: 357
Joined: Mar 15, 2015 12:41

Re: How to made a 32 bits program with 64 bits FB?

Postby Luis Babboni » Jun 20, 2021 22:04

Thanks guys! :-)
Luis Babboni
Posts: 357
Joined: Mar 15, 2015 12:41

Re: How to made a 32 bits program with 64 bits FB?

Postby Luis Babboni » Jun 20, 2021 23:04

srvaldez wrote:hi Luis Babboni
download the combined 32bit and 64bit standalone version from the news section, with the combined version you can use FBx64 to produce 32-bit executable, but also have the 32-bit compiler there so this tip is worthless, nevertheless if you want to compile to 32 with the 64-bit compiler pass -arch 486 on the compile command, as caseih said you need the 32-bit libraries without them this won't work


Sorry. I install the standalone version for 32 and 64 bits.... but do not know how to compile a 32 bit version now from FBEdit :-(
MrSwiss
Posts: 3845
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: How to made a 32 bits program with 64 bits FB?

Postby MrSwiss » Jun 20, 2021 23:56

Luis Babboni wrote:Sorry. I install the standalone version for 32 and 64 bits.... but do not know how to compile a 32 bit version now from FBEdit :-(

Well, that's really simple:
  • Click Menu option "Options"
  • Select "Path Options"
  • In the popup, you select the path to, either the 64-bit or the 32-bit version of fbc.exe
Problem solved.
deltarho[1859]
Posts: 3127
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: How to made a 32 bits program with 64 bits FB?

Postby deltarho[1859] » Jun 21, 2021 0:56

It is worth noting that the 32-bit fbc and the 64-bit fbc emit identical *.c files. I have done it and then used a byte for byte comparison. The 64-bit fbc will not work on a 32-bit machine as no other 64-bit binary will. Passing -arch 486 on the command line will not work because 64-bit fbc will not work on a 32-bit machine. So, the answer to the opening post is no.

Having emitted a *.c file what flag/s fbc passes to gcc is another story; like what mode the target binary should be.
Luis Babboni
Posts: 357
Joined: Mar 15, 2015 12:41

Re: How to made a 32 bits program with 64 bits FB?

Postby Luis Babboni » Jun 22, 2021 14:02

MrSwiss wrote:
Luis Babboni wrote:Sorry. I install the standalone version for 32 and 64 bits.... but do not know how to compile a 32 bit version now from FBEdit :-(

Well, that's really simple:
  • Click Menu option "Options"
  • Select "Path Options"
  • In the popup, you select the path to, either the 64-bit or the 32-bit version of fbc.exe
Problem solved.


OK!! I installed just the 64 bits version no matter I saw there are two versiones, 64 and 32 bits! :-D
MrSwiss
Posts: 3845
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: How to made a 32 bits program with 64 bits FB?

Postby MrSwiss » Jun 22, 2021 15:05

Luis Babboni wrote:OK!! I installed just the 64 bits version no matter I saw there are two versiones, 64 and 32 bits! :-D
Then you've got the combined 32/64 version (with fbc32.exe and fbc64.exe), which is NOT what you want.
With FBEdit it's better to NOT change the compilers name (simpler to handle).
(2 x standalone versions, using different path's: e.g. ...\FreeBASIC\1080_32\fbc.exe and ...\FreeBASIC\1080_64\fbc.exe)
Btw: 1080 = "1.08.0" (fbc's version number simplified) followed by it's bitness.
Luis Babboni
Posts: 357
Joined: Mar 15, 2015 12:41

Re: How to made a 32 bits program with 64 bits FB?

Postby Luis Babboni » Jun 22, 2021 17:03

Mmmm, no, I have the two versions in the same folder.

sorry, may be for my poor english, but i do not understand how to compile irt in 32 bits yet.
Luis Babboni
Posts: 357
Joined: Mar 15, 2015 12:41

Re: How to made a 32 bits program with 64 bits FB?

Postby Luis Babboni » Jun 22, 2021 17:15

Image
Luis Babboni
Posts: 357
Joined: Mar 15, 2015 12:41

Re: How to made a 32 bits program with 64 bits FB?

Postby Luis Babboni » Jun 22, 2021 17:16

I left just the 32.exe and this is what happens

In fact I downlaod just a 1.07 version with just 32 bits compiler and a new FBEdit and use the code i wrote
MrSwiss
Posts: 3845
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: How to made a 32 bits program with 64 bits FB?

Postby MrSwiss » Jun 22, 2021 17:21

Luis Babboni wrote:Mmmm, no, I have the two versions in the same folder.
And exactly that is the main problem.
(best is to delete it all)
Make 2 different folders, then unzip the 32-bit (only) version to one and,
the 64-bit (only) version into the other ...
(therafter you can switch compilers as described already)
Last edited by MrSwiss on Jun 22, 2021 17:23, edited 1 time in total.
Luis Babboni
Posts: 357
Joined: Mar 15, 2015 12:41

Re: How to made a 32 bits program with 64 bits FB?

Postby Luis Babboni » Jun 22, 2021 17:22

I did that to put the 32 and 64 in differents folders and no work.
Now I return the 64 bits to the orginal folder and do not works anymore :-D
Luis Babboni
Posts: 357
Joined: Mar 15, 2015 12:41

Re: How to made a 32 bits program with 64 bits FB?

Postby Luis Babboni » Jun 22, 2021 17:23

MrSwiss wrote:
Luis Babboni wrote:Mmmm, no, I have the two versions in the same folder.
And exactly that is the main problem.
Make 2 different folders, then unzip the 32-bit (only) version to one and,
the 64-bit (only) version into the other ...
(therafter you can switch compilers as described already)


OK. Let me try

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 5 guests