fbc icon indicating copy to clipboard operation
fbc copied to clipboard

Unable to compile FreeBASIC on OpenIndiana(OpenSolaris based)

Open fatman2021 opened this issue 5 years ago • 5 comments

"main@openindiana_1:~/fbc$ gmake FBC src/compiler/obj/solaris-i86pc/ast-gosub.o /bin/sh: line 1: fbc: not found gmake: *** [makefile:527: src/compiler/obj/solaris-i86pc/ast-gosub.o] Error 127"

fatman2021 avatar Mar 15 '19 00:03 fatman2021

I guess a bootstrap to Solaris is required. This is not something I've personally tried..

(Unless you've already got a Solaris version, in which case something like gmake FBC=/path/to/fbc might be enough to get you started.)

countingpine avatar Mar 15 '19 22:03 countingpine

I see that Solaris is supported by the makefile and there is a src/rtlib/solaris directory, but support is completely missing from the compiler (in fb.bas/fbc.bas) and there are some missing rtlib functions too (but not critical). However, it should be fairly straightforward to port FB to Solaris, speaking from experience. Primarily you just need to find out the correct linker flags and libraries to use, which you can do by invoking the system C compiler with verbose flag. I would guess that these will probably be more similar to freebsd rather than linux, so as a start, you just grep src/compiler/* for freebsd and add matching code for solaris by copying freebsd (it's not very much), then correct the linker flags/libraries and other OS attributes.

Once you've done this, bootstrap from a supported OS like freebsd or linux or windows by first recompiling fbc normally (ie "make compiler"), to produce a new fbc compiler that it accepts the "-target solaris" commandline switch which you would have just added. Next edit the "bootstrap-dist" target in makefile, deleting the lines for dos, win32, win64, linux-x86, and linux-x64 bootstrap targets, and instead adding one for solaris. I don't know whether solaris assembler is compatible with GNU gas, probably it's not, so you would make the 'gcc' backend the default for the solaris target (in fb.bas/fbc.bas), and use *.c here instead of *.asm. Then compile with "make bootstrap-dist FBC=path/to/new/fbc" (or just put the new fbc in your PATH) Then you copy the generated files to solaris and compile using the "bootstrap" make target.

rversteegen avatar Mar 16 '19 12:03 rversteegen

I met the same problem while I was compiling on MacOS 10.15.3. So how can I compile it?

scientificworld avatar Jul 25 '20 12:07 scientificworld

Two options: either create a "bootstrap" package on an OS on which you have a working copy of fbc (probably Linux or Windows) (you will have to edit the bootstrap-dist target in makefile to add a 'darwin' build**), or download an existing Mac build of fbc and use that to compile. You can use either my FB build (see here... however I can't remember whether that's a 32 or 64-bit build) or the builds srvaldez posted on the forum here.

** Also, if you compile FB yourself, I think you probably should use my mac branch although I can't remember what goes wrong if you don't.

rversteegen avatar Jul 28 '20 11:07 rversteegen

Two options: either create a "bootstrap" package on an OS on which you have a working copy of fbc (probably Linux or Windows) (you will have to edit the bootstrap-dist target in makefile to add a 'darwin' build**), or download an existing Mac build of fbc and use that to compile. You can use either my FB build (see here... however I can't remember whether that's a 32 or 64-bit build) or the builds srvaldez posted on the forum here.

** Also, if you compile FB yourself, I think you probably should use my mac branch although I can't remember what goes wrong if you don't.

Sorry, I haven't seen your reply... ~~But where is the build?~~ Now I find it...

scientificworld avatar Oct 01 '20 10:10 scientificworld