FreeBASIC for Apple OS

General discussion for topics related to the FreeBASIC project or its community.
exagonx
Posts: 318
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

FreeBASIC for Apple OS

Post by exagonx »

Hello my friend

Today I have a little question, because some people ask me for a simple language where can do some experiment without learning everythings and step by step learn enough to become a better programmer, but he use a MAC and in the download area is not available the version for MAC.

From what I read, the first version of FreeBASIC was written in C, consequently any operating system that has the GCC (GNU Compiler Collection) is able to compile FreeBASIC until generating the autocompilable version written in FreeBASIC, if this is correct Why isn't there a Mac OS version ready for download?

I ave non Mac and I cant make the executable but someone can confirm that are possible make a compiler for MAC ?
If are possible I can download the source code from beginning and compile each version until last one.

Thank you.
angros47
Posts: 2339
Joined: Jun 21, 2005 19:04

Re: FreeBASIC for Apple OS

Post by angros47 »

The first version of FreeBasic was written in Visual Basic for DOS, until it became self compiling. Only the runtime library was written in C

And actually there was an unofficial version of FreeBasic for Apple OS: viewtopic.php?t=28640
exagonx
Posts: 318
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

Re: FreeBASIC for Apple OS

Post by exagonx »

angros47 wrote: Sep 23, 2023 22:35 The first version of FreeBasic was written in Visual Basic for DOS
Thank you , that explain many things
angros47 wrote: Sep 23, 2023 22:35 And actually there was an unofficial version of FreeBasic for Apple OS
I must admit that using Apple systems creates a big stomach ache, to the point that I installed Linux on 6 older Macs and Windows on the recent ones. From my point of view it is not a pleasant operating system to use.
exagonx
Posts: 318
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

Re: FreeBASIC for Apple OS

Post by exagonx »

do you think the BSD version work on mac os too ?
caseih
Posts: 2166
Joined: Feb 26, 2007 5:32

Re: FreeBASIC for Apple OS

Post by caseih »

That's where the person who did the port started if I recall correctly. Used the GCC backend, and compiled from the bootstrap C sources. I can't remember it used X11 for graphics or not. Since SDL runs natively on macOS, and FB has an SDL-based graphics library backend, it might be possible to generate "native" apps. And once there's a running version, it can be used to compile FB from .bas sources, rather than bootstrap C sources.

Since macOS is unix, it's usually possible to compile unix software on it and it should run with few changes. Not always easy for the uninitiated, though. I used to run all sorts of unix software on my powerbook back in the day. Apps from Gnome, KDE, etc.
srvaldez
Posts: 3513
Joined: Sep 25, 2005 21:54

Re: FreeBASIC for Apple OS

Post by srvaldez »

don't know if this will help, here's TeeEmCee's old build from 2016 viewtopic.php?p=263759#p263759
and my own build for Mojave [edit] I had hell uploading that archive without the binaries being deleted, will try again and post a link
note that TeeEmCee is the expert on this, I barely know enough to open a terminal and then build FB with the command: make FBFLAGS="-asm att" ENABLE_XQUARTZ=1 all
provided that you already have a version of FB installed
my mac is from 2012 and is barely able to run MacOS Mojave and the OS has changed a lot since that version
srvaldez
Posts: 3513
Joined: Sep 25, 2005 21:54

Re: FreeBASIC for Apple OS

Post by srvaldez »

srvaldez
Posts: 3513
Joined: Sep 25, 2005 21:54

Re: FreeBASIC for Apple OS

Post by srvaldez »

in MacOS Mojave when trying to build the latest Git repo I get unknown ld option --eh-frame-hdr at the stage of linking fbc, have no idea why
exagonx
Posts: 318
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

Re: FreeBASIC for Apple OS

Post by exagonx »

srvaldez wrote: Sep 24, 2023 18:27 in MacOS Mojave when trying to build the latest Git repo I get unknown ld option --eh-frame-hdr at the stage of linking fbc, have no idea why
I believe that the system created by Apple for installing applications, made for those who understand nothing about IT, makes it the only solution for those who do not want to learn and at the same time complicates the life of those who have studied and know that with a PC you can do much more than surf the internet on social media, I was hoping for a solution like compiling a BAS file where it can use GTK libraries as happens in Windows, Linux and BSD, but it seems that the generated executable file does not work on other Macs if you do not install all the necessary software and it seems excessively cumbersome to me.

As soon as I have a break from work I will start studying it and looking for a simple solution that even those who are new to the environment do not have to carry out complicated and too many steps.
marcov
Posts: 3488
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: FreeBASIC for Apple OS

Post by marcov »

srvaldez wrote: Sep 24, 2023 18:27 in MacOS Mojave when trying to build the latest Git repo I get unknown ld option --eh-frame-hdr at the stage of linking fbc, have no idea why
eh-frame is afaik support for ELF/Dwarf exception frames. OS X' binary format however, is not ELF, but MachO. Note that therefore the binutils (LD and AS and maybe more) are different. SED also might be BSD sed rather than gsed and the default shell is often a SH variant and not bash.

BSD binaries won't run, though while porting there will be many similarities between FreeBSD and OS X in things like structures, but few guarantees.

iOS+OS X also changes CPU architecture (m68k, PPC, PPC64, x86, x86_64 and various ARM types and generations) every other years, and every so many and many years their OS X has some breaking feature that requires adjustment in the toolchain.
TeeEmCee
Posts: 375
Joined: Jul 22, 2006 0:54
Location: Auckland

Re: FreeBASIC for Apple OS

Post by TeeEmCee »

srvaldez wrote: Sep 24, 2023 18:27 in MacOS Mojave when trying to build the latest Git repo I get unknown ld option --eh-frame-hdr at the stage of linking fbc, have no idea why
Back in early 2022 the commit "Further flag required for ld on linux" mistakenly added --eh-frame-hdr to the ld commandline on all Unices. My best guess is it should be all Unices except Darwin, as marcov said. Delete FB_COMPTARGET_DARWIN from the select case in hLinkFiles in fbc.bas that adds that flag and see whether it works then? I think you'll probably have to make further fixes, I think I've heard other problems mentioned. I haven't tried to compile for Mac in a long time and can't do it any time soon, no Mac access.
srvaldez
Posts: 3513
Joined: Sep 25, 2005 21:54

Re: FreeBASIC for Apple OS

Post by srvaldez »

thank you marcov and thank you TeeEmCee for pointing me in the right direction, my Mac is retired and use a Windows PC but I occasionally fire-up the old Mac
I plan on trying your recommendation later today :)
srvaldez
Posts: 3513
Joined: Sep 25, 2005 21:54

Re: FreeBASIC for Apple OS

Post by srvaldez »

hello TeeEmCee :)
there was only one place in fbc.bas where eh-frame-hdr was added to the ld command, commenting that out solved the issue and the latest FB Git repo built without problems, many thanks :D
srvaldez
Posts: 3513
Joined: Sep 25, 2005 21:54

Re: FreeBASIC for Apple OS

Post by srvaldez »

there were 3 downloads of FB-Mojave so I updated to the latest Git repo https://u.pcloud.link/publink/show?code ... 8zh8Q8UbjV
I would be interested to know if this was in any way helpful, also, if you were able to build FB, share here your experience for others to profit from
limpingninja
Posts: 1
Joined: Sep 23, 2023 21:15

Re: FreeBASIC for Apple OS

Post by limpingninja »

srvaldez wrote: Nov 02, 2023 19:07 there were 3 downloads of FB-Mojave so I updated to the latest Git repo https://u.pcloud.link/publink/show?code ... 8zh8Q8UbjV
I would be interested to know if this was in any way helpful, also, if you were able to build FB, share here your experience for others to profit from
This was fantastic, I'm running it on an M2 Mac Arm (it runs through Rosetta fine) but it works perfectly well, you might consider uploading your code into Github and dropping this as a release. It's asked for quite often. I was working on it previously and the older version of FBC self-compiling was giving me a difficult time.
Post Reply