-
Notifications
You must be signed in to change notification settings - Fork 153
Closed
Description
I almost successfully build FreeBasic on macOS 13.1, record the steps for your reference, hope FreeBasic can support macOS soon.
- patch FreeBASIC-1.09.0-source:
diff --git a/src/compiler/fbc.bas b/src/compiler/fbc.bas
index 975b60a..ecb11d3 100644
--- a/src/compiler/fbc.bas
+++ b/src/compiler/fbc.bas
@@ -1114,10 +1114,6 @@ private function hLinkFiles( ) as integer
end select
- if( fbGetOption( FB_COMPOPT_TARGET ) = FB_COMPTARGET_DARWIN ) then
- ldcline += " -macosx_version_min 10.4"
- end if
-
'' extra options
ldcline += " " + fbc.extopt.ld
@@ -3745,7 +3741,6 @@ private sub hAddDefaultLibs( )
end if
case FB_COMPTARGET_DARWIN
- fbcAddDefLib( "gcc" )
fbcAddDefLib( "System" )
fbcAddDefLib( "pthread" )
fbcAddDefLib( "ncurses" )
- generate
bootstrap/darwin-x86_64
on Linux and copy this directory to macOS
# on Linux
fbc src/compiler/*.bas -m fbc -i inc -e -r -v -target darwin-x86_64
mkdir -p bootstrap/darwin-x86_64
mv src/compiler/*.c bootstrap/darwin-x86_64
- fix non-local goto, notice non-local goto is undefined behaviour even in GCC.
# this is a very rude hack, turn "goto *p" to "p()". there is no following "return"
# because the caller functions don't always return void.
perl -i -pe 's/goto \*(vr\S+);/((void (*)())(\1))();/' bootstrap/darwin-x86_64/*.c
- bootstrap on macOS
gmake V=1 bootstrap
- try the bootstrap fbc on macOS
bin/fbc -v -Wl -L`xcrun --show-sdk-path`/usr/lib examples/hello.bas
To fully build the final fbc, subroutines rtlErrorCheck
and rtlErrorThrow
in src/compiler/rtl-error.bas
must be changed to not use non-local goto, I'm not familiar with FreeBasic code, don't have enough skill to patch that.
pengyuwei, polluks and rversteegen
Metadata
Metadata
Assignees
Labels
No labels