Page 1 of 1

macOS High Sierra linking error

PostPosted: Sun May 13, 2018 8:24 pm
by christian776
Hi guys,

I've trying to compile the latest version of Supermodel, and I'm getting this output. Any help? I suspect there's an issue with the Makefile, maybe?

Code: Select all
--------------------------------------------------------------------------------
Linking Supermodel     : bin/supermodel
--------------------------------------------------------------------------------
ld: warning: option -s is obsolete and being ignored
Undefined symbols for architecture x86_64:
  "_fopen64", referenced from:
      _fopen64_file_func in ioapi.o
     (maybe you meant: _fill_fopen64_filefunc)
  "_fseeko64", referenced from:
      _fseek64_file_func in ioapi.o
  "_ftello64", referenced from:
      _ftell64_file_func in ioapi.o
  "_main", referenced from:
     implicit entry/start for main executable
     (maybe you meant: _SDL_main)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bin/supermodel] Error 1

Re: macOS High Sierra linking error

PostPosted: Mon May 14, 2018 8:04 pm
by Bart
In the latest SVN update, I made some changes to the Makefile because they were breaking for me. I recall removing some libraries from Makefile.inc that I assumed were unnecessary. If you were able to build a few revisions back, perhaps you could look at a diff of the two Makefiles and see what changed? I don't have access to a Mac box so I'll need your help to figure out which changes to restore.

Re: macOS High Sierra linking error

PostPosted: Tue May 15, 2018 9:27 am
by christian776
Hi Bart,

I've went back to rev706, before some changes occurred to the Makefiles. And now I only get one error

Code: Select all
Linking Supermodel     : bin/Supermodel
ld: warning: option -s is obsolete and being ignored
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
     (maybe you meant: _SDL_main)
ld: symbol(s) not found for architecture x86_64


Looking on StackOverflow, here's the issue and how they seemed to have fixed it.
https://stackoverflow.com/questions/233 ... rt1-10-5-o

Apparently there's some issue with SDLmain.m , and it's fixed by running something like this, but I'm not proficient in Makefiles, so I dont know how that will translate

Code: Select all
g++ -framework SDL -framework Cocoa -I/usr/local/include/SDL/ minimal.cpp "/Library/Application Support/Developer/Shared/Xcode/Project Templates/SDL Application/SDLMain.m"

Re: macOS High Sierra linking error

PostPosted: Fri May 18, 2018 11:44 am
by Bart
I haven't yet done any Mac development. I do have access to a Hackintosh, though, so maybe I'll be able to take a look at this at some point. No ETA, unfortunately. It would be helpful if you could try, though. Makefiles are generally pretty simple: a set of rules with a list of dependencies and then the command to execute on them. You can also log the commands that are actually run and then just create a shell script with those commands pasted in directly and play around with them. Back-porting back to the Makefile would be simple.

Re: macOS High Sierra linking error

PostPosted: Sun Jun 17, 2018 3:24 pm
by christian776
Hi Bart,

I was able to compile the macOS build using the "old" Makefile, so SDL doesn't complain anymore. Now I'm getting just one error, where the Layer parameter is being casted to an *int*.

Code: Select all
Src/Graphics/New3D/R3DFrameBuffers.cpp:162:23: error: non-constant-expression cannot be narrowed from type 'int' to 'GLenum'
      (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
        GLenum buffers[] = { GL_COLOR_ATTACHMENT0 + (int)layer };


thanks!

Re: macOS High Sierra linking error

PostPosted: Sun Jun 17, 2018 5:36 pm
by christian776
Ok, I think I made it work, just changed the int for an unsigned int instead and it compiles now. Here's the updated Makefile for anyone interested https://gist.github.com/christ776/1dfc7e21d08065d5bec1a1d014ff24f3