-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS 10.15.6: Undefined symbols for architecture x86_64 #248
Comments
Where did you get your bootstrap copy of the source code? The official bootstrap package doesn't include darwin (Mac OSX). *There is an unfinished and unmerged SDL2 backend for fbgfx though, which would allow a Mac port if it gets finished. |
Oh, my mistake, you got those errors because you ran Edit |
Thanks. I'll try it. |
I just found this line:
So where is the main function? |
Thank you so much. I successfully compiled it with gcc. |
I'm sorry to bother you, but why I get an error when I was compiling an "Hello World" program?
|
Which build are you using? |
I use |
So which build of fbc are you using? Apparently you're using mine. Try using srvaldez's instead, see here. Looks like srvaldez patched it to not include crt1.o. I don't know why I didn't need to. Also, make sure that fbc is invoking the homebrew gcc you installed, not the system gcc which is a symlink to clang. You can add I hope it's not the case that Homebrew gcc has dropped -masm=intel. |
I use srvaldez's build to build commit 63d1c42 by myself. |
I add
|
I generate a C file and it seems that the main function is missing. typedef signed char int8;
typedef unsigned char uint8;
typedef signed short int16;
typedef unsigned short uint16;
typedef signed int int32;
typedef unsigned int uint32;
typedef signed long long int64;
typedef unsigned long long uint64;
typedef struct { char *data; int64 len; int64 size; } FBSTRING;
typedef int8 boolean;
void fb_PrintString( int32, FBSTRING*, int32 );
FBSTRING* fb_StrAllocTempDescZEx( uint8*, int64 );
static void fb_ctor__x( void ) __attribute__(( constructor ));
__attribute__(( constructor )) static void fb_ctor__x( void )
{
label$0:;
FBSTRING* vr$0 = fb_StrAllocTempDescZEx( (uint8*)"hello", 5ll );
fb_PrintString( 0, (FBSTRING*)vr$0, 0 );
label$1:;
} |
|
…ecent OS/GCC As suggested by srvaldez; fbc gh issue freebasic#248
Looks like FreePascal may have hardcoded Try: If that doesn't work, try finding the correct patch by doing:
Also, if you run into further problems try compiling my mac branch instead of fbc/master, it has many fixes for Mac compile problems. It's currently a year behind the upstream master, but if that's a problem I could pull upstream. However I wouldn't actually be able to test it myself, since I don't have access to a Mac for about another week. (Ignore that mention of the "don't link to crt1.o" commit I pushed; I reverted it after better understanding the problem) |
gcc:
clang:
apple clang:
I think I can link |
I compiled your mac branch and the error still exists... So I run |
So... does fbc work on Mac or not? |
Well, there are no official builds FreeBASIC builds for Mac (and Mac/darwin isn't even included in the official bootstrap package). So I would say that FB's Mac port isn't really officially supported, but it can be made to work with some effort (e.g. installing gcc and/or using the right commandline args), except that fbgfx, the builtin library for graphics, has not been ported to Mac. It certainly needs work. (BTW, Jeff merged my mac branch into this official fbc repo, except for updates to the crt headers.) However, links to srvaldez's builds seem to be dead. My ancient build of pre-release FB-1.06 for Mac is still up. Don't know if there's some other available. Unfortunately I rarely have access to a Mac, so haven't put up a new one yet, or properly tested FB 1.09 on Mac, but other people have tried FB 1.09. |
This issue is really old :D |
When I run
make
, it shows this:So I tried to run
make bootstrap
.But when linking, it tells me:
So how can I compile it on macOS?
The text was updated successfully, but these errors were encountered: