Re: [hatari-devel] Compiling with SDL2 without osx-bundle on OSX fails

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Thomas,

Changing the -Dmain=SDL_main to -DSDL_MAIN_NEEDED=1 in the ENABLE_OSX_BUNDLE if block fixed the problem. I was able to compile Hatari using configure —disable-osx-bundle, configure —enable-sdl2, and cmake -G Xcode -DENABLE_SDL2=1. I may have messed up my CLI syntax here since I usually end up looking at configure —help or CMakeLists.txt to remember the exact parameter names.

Thanks again for your work on this. Now, I am off to beat my head against the wall on the magically appearing New Floppy Image window (sigh).


Bob C


On Sep 12, 2014, at 11:00 AM, Thomas Huth <th.huth@xxxxxx> wrote:

> 
> Hi Bob,
> 
> Am Thu, 11 Sep 2014 21:20:07 -0500
> schrieb Bob Carpenter <hatari@xxxxxxxxxx>:
>> 
>> I tried your change this evening. The good news is that it now works
>> when you compile Hatari without using an OS X bundle. The bad news is
>> you now get the exact “Undefined symbol _main” error if you compile
>> it as an OS X bundle. On the endif for ENABLE_SDL2, you spelled it as
>> ENDABLE_SDL2. I have attached a diff file if you prefer that.
>> 
>> However, even after fixing the typing error, I get an error that main
>> is undefined. I am wondering if the add_definitions statement
>> redefines both main functions (the one in main.c and SDLMain.m) as
>> SDL_main. I could be completely wrong since I do not know anything
>> about CMake other than cmake -G Xcode -DENABLE_SDL2=1. :) Your
>> previous #define would only affect the main in main.c.
> 
> You're right by assuming that main now gets redefined everywhere ...
> howver, in SDMain.m, there is the following sequence:
> 
> #ifdef main
> #  undef main
> #endif
> 
> That _should_ remove the definition in this file ... I wonder what's
> going wrong here?
> Could you maybe try to replace the "-Dmain=SDL_main" in CMakeLists.txt
> with "-DSDL_MAIN_NEEDED=1" instead? Then the header SDL_main.h of the
> libSDL should take care of the renaming... maybe that works better?
> 




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/