Building FreeBASIC on OpenBSD

General discussion for topics related to the FreeBASIC project or its community.
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Building FreeBASIC on OpenBSD

Post by DrV »

Just a bit more fun with porting FreeBASIC; if you're an OpenBSD enthusiast, please give it a whirl: http://drv.nu/blog/2008/08/22#building-fbc-on-openbsd

Note: Testing has been very minimal for this port, as I'm not a regular user of OpenBSD; I just got it to the point of building itself and running a simple fbgfx program, so no guarantees. :)
rmann05
Posts: 50
Joined: May 31, 2005 16:02
Location: Florida
Contact:

Mac OS 10?

Post by rmann05 »

From what I understand, Mac OS 10 is based on BSD. Since this is the case, can this also work on Mac OS 10 using Terminal?
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Post by DrV »

FreeBASIC on Mac OS X will need a bit more work, but it shouldn't be too hard now that the groundwork is laid. (FB still only has an emitter for x86, so only Intel-based Macs would work.)

One stumbling block from the last time I was working on porting to Mac is that Apple's as (assembler) uses slightly different syntax from GNU as. However, it shouldn't take too much work to get FB's x86 emitter in shape to work with it.

If anyone is interested in helping work on getting FreeBASIC ported to Mac, has the proper hardware (an Intel Mac), and can install the development tools (GCC, GNU Make, Subversion, autoconf, etc.), please let us know - I'd be willing to work with them and answer questions (from the FB side , at least; I don't know much about using or developing for Macs). If you want to help with this, the best way to get in contact would be via ##freebasic on irc.freenode.net so we could debug in real time, although something could be arranged via email or forum posts too.
krcko
Posts: 163
Joined: Jul 30, 2006 0:34
Location: Serbia
Contact:

Post by krcko »

i've just got new job and a brand new iMac (intel core 2 duo) to work on. i've never before worked on a mac and i never tried to develop a mac app (i'm working as a web designer/php developer) but i can help in debugging (while i'm at work, at home i only have pc) fbc builds for darwin. i;ve installed today xcode dev tools and i have gcc and all tools needed, and i already have subversion client...

i can help debugging but i think that my boss wouldn't like seeing me to spend my work hours on irc chatting, so you (devs) can contact me via email - krckoorascic@gmail.com

i'll be glad to help...


btw have you guys ever thought about llvm emitter? apple developed gcc-llvm which produces universal binaries (that can be run on ppc and on intel) but i'm not really sure is it c to llvm compiler or llvm to binary...
scorpion081
Posts: 3
Joined: Aug 29, 2008 21:34

How about a PPC version of FreeBASIC?

Post by scorpion081 »

I would be interested in any developments regarding a FreeBASIC for Power PC-based MACs. I would figure that if a version was in the process for MacOS X, then it should possibly work for Darwin also as both are very closely based on the same OS core. My main problem is that there doesn't seem to be a compatible BASIC language that could compile the FBC as it is coded in its own language.

If there was a version coded under GCC, this wouldn't be a big problem as MacOS and Darwin do have GCC and the entire toolchain to work with. As for the code emitter, that shouldn't be too difficult to adapt as there is literature on the PPC instruction set as well as a register map of the said chip.

The reason for my interest is I wish to teach my girlfriend some programming and Freebasic is a good beginner's choice as well as a good coding base for even advanced programming. She is more familiar with the MacOS systems from the PPC days as she grew up with a Mac in the household. Plus we want to set up an old Mac G3 with a copy of Darwin, like I previously said - it is very similar to MacOS at the core level, and provide some useful programs and utilities on it.

I am more than willing to do some learning and "port" Freebasic over to the PPC-based Mac. I am just stuck on where to begin as far as the compiler is concerned. When the compiler is "self-compiling" on a few platforms, but not your chosen target platform, and there isn't evidenced anything close enough to use a compiler from, you're kind of stuck in a hard place! I think Apple Computer did a disservice to the Apple community when they arbitrarily decided to drop support of the PPC in favor of the Intel architecture. The PPC was, IMHO, more suited for the role it played in its niche market than any Intel would ever be! I truly think a PPC version of Freebasic would do well to serve those who wish to hang on to their PPC-based computers, and there is no reason why some of the older Macs couldn't reliably run Freebasic as well.

Any suggestions as to how one might go about this "mission"?
jcfuller
Posts: 325
Joined: Sep 03, 2007 18:40

Post by jcfuller »

scorpion081,
As Drv said emitter is x86, so not possible.
Is there a VM for the Mac PPC's. That might be one way to go.

James
scorpion081
Posts: 3
Joined: Aug 29, 2008 21:34

Post by scorpion081 »

[quote="jcfuller"]scorpion081,
As Drv said emitter is x86, so not possible.
Is there a VM for the Mac PPC's. That might be one way to go.

James[/quote]

--------------------------------------------------------------------------

Aren't the files for the code emitter also in source? What would there be to keep someone from creating something of a "cross-compiler" by supplying the opcodes for the PPC instead of x86 opcodes? Yes you have to test the new compiled image on a virtual emulator that has debug abilities. It would seem a bit of work but isn't that the fun of "porting" any application to another platform?

My main problem is that I haven't even touched assembly language for a number of years so my knowledge may be a little rusty. All of this as I am trying to do a "crash course" in PPC code.

I may have to learn GCC programming first and then convert a copy of FBC source over to 'C' or 'C++' and compile with GCC for PPC hardware at least for a start. I know it seems like going back to reinventing the wheel, but I really would like to see a Mac port of Freebasic and I know it's quite possible. NOTHING IS IMPOSSIBLE for the determined. I'm just looking at ways to accomplish what I want to see.
cha0s
Site Admin
Posts: 5319
Joined: May 27, 2005 6:42
Location: USA
Contact:

Post by cha0s »

scorpion081 wrote:I may have to learn GCC programming first and then convert a copy of FBC source over to 'C' or 'C++' and compile with GCC
I have suggested this, and I think it is a great idea. It would only help our portability, but will the BASIC purists riot? News at 11.
Lachie Dazdarian
Posts: 2338
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Post by Lachie Dazdarian »

I'll lead the lynch mob.
cha0s
Site Admin
Posts: 5319
Joined: May 27, 2005 6:42
Location: USA
Contact:

Post by cha0s »

Why does anyone care what language the compiler is written in anyways? < 1% of the userbase here even makes patches...
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Post by marcov »

DrV wrote:FreeBASIC on Mac OS X will need a bit more work, but it shouldn't be too hard now that the groundwork is laid. (FB still only has an emitter for x86, so only Intel-based Macs would work.)
I thought OS X also had a slightly different ABI? Or is that only on PPC ?
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: How about a PPC version of FreeBASIC?

Post by marcov »

scorpion081 wrote:I would be interested in any developments regarding a FreeBASIC for Power PC-based MACs. I would figure that if a version was in the process for MacOS X, then it should possibly work for Darwin also as both are very closely based on the same OS core. My main problem is that there doesn't seem to be a compatible BASIC language that could compile the FBC as it is coded in its own language.
That's the age old bootstrapping problem, which goes for all standalone compilers on a new machine. It was solved in the sixties, crosscompile :)
If there was a version coded under GCC, this wouldn't be a big problem as MacOS and Darwin do have GCC and the entire toolchain to work with. As for the code emitter, that shouldn't be too difficult to adapt as there is literature on the PPC instruction set as well as a register map of the said chip.
Also with gcc based ports this is a problem. Because a lot of tables and details need to be checked. A compiler port is never newbie work, gcc based or not.

The easy "configure; make" routine requires carefull preparation as well.
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Post by marcov »

cha0s wrote:Why does anyone care what language the compiler is written in anyways? < 1% of the userbase here even makes patches...
1) the compiler is its own best testsuite, and typically the first big program in the language
2) Expect that 1% to drop further
3) Compilers not written in itself are typically for toy languages. Apparantly the language is not suitable to write a compiler.
Sslaxx
Posts: 107
Joined: Aug 31, 2008 16:53
Location: Malvern, Worcs, UK
Contact:

Post by Sslaxx »

With regards to 3, Marcov, my understanding is that it might be a bit of a chicken-and-egg situation? That said, it may be possible to create a cross-compiler with FreeBASIC, though I have no idea how practical it would be...
scorpion081
Posts: 3
Joined: Aug 29, 2008 21:34

OOOps!

Post by scorpion081 »

I didn't realize this subject matter was going to be such a sore spot with the community. It seems that no one is even interested in entertaining the thought of a PPC port of what I consider to be a very promising programming language. It also occurs to me that there is no real interest in the undertaking of such a project!

My humble apologies for even daring to suggest a project. There is apparently a negative sentiment to the idea. I, therefore, feel no need nor desire to pursue this project any further. An unfortunate thing to trash ideas before they've even been tried, as this is the stuff that genuine "choice" comes to a free market. Ideas!

There is apparent resistance to my even asking questions on some howto's. Therefore, I will no longer be contributing to any of the discussions!

-So long!
Post Reply