Mac OS X Support

General discussion for topics related to the FreeBASIC project or its community.
sitrucz
Posts: 7
Joined: Jun 20, 2020 16:34

Mac OS X Support

Post by sitrucz »

I am new to FreeBasic and have done a lot of VBScript on my work computers. I run Mac OS X 10.5.5 Catalina and was wondering if there was going to be support for OS X in the future? I'd love to try it out. I've gone through the manual and really like the improvements to VBScript.

Does anyone have compile instructions for OS X?

Sitrucz
sitrucz
Posts: 7
Joined: Jun 20, 2020 16:34

Re: Mac OS X Support

Post by sitrucz »

Thanks for the links. I started to compile and am getting the error below.

Code: Select all

src/rtlib/thread_call.c:33:10: fatal error: 'ffi.h' file not found
#include <ffi.h>
         ^~~~~~~
1 error generated.
make: *** [src/rtlib/obj/darwin-x86_64/thread_call.o] Error 1
I use Macports so I have Xcode installed along with the developer tools and ffi.h is in multiple places.

Code: Select all

/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/ffi/ffi.h
/opt/local/lib/libffi-3.2.1/include/ffi.h
How can I tell make where to find ffi.h?

Thanks in advance.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Mac OS X Support

Post by caseih »

Google tells me this is from a library called libffi.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Mac OS X Support

Post by srvaldez »

I ran into the same problem, don't remember how I managed to solve the issue, if you install gcc-9.2 from http://hpc.sourceforge.net/ it may solve your problem, note that I ran into permission problems trying to install gcc-9.2, I finally installed it by booting up from a different partition
what version of Mac OS are you running?
if I remember right, I had to edit fbc.bas so that it wouldn't include crt1.o because it's not needed in Mojave, I could be wrong on this but that's what I think I did.
I can upload a version for Mojave if you are interested.
Last edited by srvaldez on Jun 28, 2020 14:28, edited 1 time in total.
sitrucz
Posts: 7
Joined: Jun 20, 2020 16:34

Re: Mac OS X Support

Post by sitrucz »

I'm on 10.15.5 Catalina. I'm going through the process of uninstall Xcode and reinstalling the command line tools.
sitrucz
Posts: 7
Joined: Jun 20, 2020 16:34

Re: Mac OS X Support

Post by sitrucz »

srvaldez wrote:I ran into the same problem, don't remember how I managed to solve the issue, if you install gcc-9.2 from http://hpc.sourceforge.net/ it may solve your problem, note that I ran into permission problems trying to install gcc-9.2, I finally installed it by booting up from a different partition
what version of Mac OS are you running?
if I remember right, I had to edit fbc.bas so that it wouldn't include crt1.o because it's not needed in Mojave, I could be wrong on this but that's what I think I did.
I can upload a version for Mojave if you are interested.
First, I reinstalled Xcode and the command line tools and still had the same issue. Next, per your suggestion I installed gcc9 from macports.

Code: Select all

gcc (MacPorts gcc9 9.3.0_1) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Code: Select all

xxxx@xxx FreeBASIC-1.07.1-source % which gcc
/opt/local/bin/gcc
I still receive the same error.

Code: Select all

CC src/rtlib/obj/darwin-x86_64/thread_call.o
src/rtlib/thread_call.c:33:10: fatal error: ffi.h: No such file or directory
   33 | #include <ffi.h>
      |          ^~~~~~~
compilation terminated.
make: *** [src/rtlib/obj/darwin-x86_64/thread_call.o] Error 1
I've installed libffi using macports.

Code: Select all

xxx@xxxx FreeBASIC-1.07.1-source % port installed | grep ffi
  libffi @3.2.1_0 (active)
I see the header in multiple places.

Code: Select all

/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/ffi/ffi.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/ffi/ffi.h
/opt/local/lib/libffi-3.2.1/include/ffi.h
My make command is:

Code: Select all

make bootstrap
Thanks in advance for any help.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Mac OS X Support

Post by srvaldez »

first, I recommend that you download the fbc source from https://github.com/rversteegen/fbc/tree/mac
it has a number of patches specific to the Mac that are not in the official site
second, try installing the gcc-9.2 from http://hpc.sourceforge.net/ not macports
third try compiling with
make FBFLAGS="-asm att" ENABLE_XQUARTZ=1 all
that means you need to install xquartz, I know it's dated but hopefully it will still work
[edit]
the above command will only work if you already have a version of FB installed, I will upload a recent version of FB for mac Catalina shortly
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Mac OS X Support

Post by counting_pine »

You could try the suggestions in viewtopic.php?p=174567#p174567, which explain how to compile your own ffi, or to disable it in FB.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Mac OS X Support

Post by srvaldez »

yes, libffi compiles with no problems, anyway, just in case you are interested
fbc-mac-mojave.zip
fbc-mac-Catalina
sitrucz
Posts: 7
Joined: Jun 20, 2020 16:34

Re: Mac OS X Support

Post by sitrucz »

srvaldez wrote:yes, libffi compiles with no problems, anyway, just in case you are interested
fbc-mac-mojave.zip
fbc-mac-Catalina
Thanks I cloned your source. Put gcc 9.2 into /usr/local. I downloaded libffi source and did a ./configure then a make then a sudo make install and see it in /usr/local/*. I still receive that same error of unable to find ffi.h.

I'm not a mac developer so at this point I have a build of fbc and i'll just write some source code and see how it goes.

Thanks to all for offering suggestions. FYI.. I even tried installing brew and brew install libffi and still the same.

Hopefully down the line there will be an official darwin installation as I really do like Basic.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Mac OS X Support

Post by srvaldez »

@sitrucz
I don't know what's going on, somehow the mac fbc and libraries are not in the archive, will check
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Mac OS X Support

Post by srvaldez »

somehow the binaries are deleted while uploading, will post a google drive link shortly
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Mac OS X Support

Post by srvaldez »

try this fbc-mac-mojave.zip
hopefully everything is there
when I download to my Windows PC the binaries get deleted asap, so I can't verify
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Mac OS X Support

Post by srvaldez »

I don't know what's going on, no binaries, maybe this will work
fbc-mac-mojave.zip
should be OK now
Last edited by srvaldez on Jun 28, 2020 18:33, edited 1 time in total.
Post Reply