aardappel / lobster

The Lobster Programming Language
http://strlen.com/lobster
2.24k stars 121 forks source link

Error when building generated cpp code #253

Closed bentxt closed 1 year ago

bentxt commented 1 year ago

Hi,

After building Lobster from source and after following the steps needed to compile hello.lobster to compiled_source.cpp I get this error

cmake version 3.26.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).

gcc --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: x86_64-apple-darwin22.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

clang --version
Homebrew clang version 16.0.5
Target: x86_64-apple-darwin22.5.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

Error:

make -j8
[  0%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/atomic/SDL_atomic.c.o
[  0%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/file/cocoa/SDL_rwopsbundlesupport.m.o
[  1%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/SDL.c.o
[  1%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/SDL_dataqueue.c.o
[  1%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/SDL_assert.c.o
[  2%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/SDL_hints.c.o
[  2%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/SDL_log.c.o
[  2%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/SDL_error.c.o
[  3%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/atomic/SDL_spinlock.c.o
[  3%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/audio/SDL_audio.c.o
[  3%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/audio/SDL_audiocvt.c.o
[  4%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/audio/SDL_audiodev.c.o
[  4%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/audio/SDL_audiotypecvt.c.o
[  4%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/audio/SDL_mixer.c.o
[  5%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/audio/SDL_wave.c.o
[  5%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/cpuinfo/SDL_cpuinfo.c.o
[  5%] Building C object external/SDL/CMakeFiles/SDL2-static.dir/src/dynapi/SDL_dynapi.c.o
/Users/ben/builds/lobster/lobster.git/dev/external/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m:45:20: error: mixing declarations and code is incompatible with standards before C99 [-Werror,-Wdeclaration-after-statement]
    NSFileManager* file_manager = [NSFileManager defaultManager];
                   ^
1 error generated.
make[2]: *** [external/SDL/CMakeFiles/SDL2-static.dir/src/file/cocoa/SDL_rwopsbundlesupport.m.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/Users/ben/builds/lobster/lobster.git/dev/external/SDL/src/cpuinfo/SDL_cpuinfo.c:843:16: warning: variable 'realptr' set but not used [-Wunused-but-set-variable]
        void **realptr = (void **) ptr;
               ^
1 warning generated.
make[1]: *** [external/SDL/CMakeFiles/SDL2-static.dir/all] Error 2
make: *** [all] Error 2
aardappel commented 1 year ago

Well, that has little to do with the generated cpp code, it is simply the included SDL library doesn't compile anymore with your up to date compilers.

We'll need to update the included SDL.

aardappel commented 1 year ago

The included SDL has been updated.

Should build on Mac with CMake, I needed cmake .. -G Xcode -DSDL_HIDAPI_JOYSTICK=OFF -DSDL_JOYSTICK=OFF -DSDL_HAPTIC=OFF to make it work, not yet sure why.

Included Xcode project still broken, will likely remove it in favor of cmake.