Open bentxt opened 3 months ago
First, please note that as per the instructions in https://aardappel.github.io/lobster/implementation.html it so far only has been tested to build with cmake
+ xcodebuild
, not with make
. There are likely subtle difference in how it generates for make
that have not been tested.
Your original build from source, how was that made?
Stuff like -disable-aligned-alloc-awareness=1
is not in our CMake or anywhere else, I presume this is something the Makefile generator inserts.. I have no idea why.
The downside of working with xcodebuild
is that there currently is no convenient way to insert the generated code, but just for testing you should be able to replace main.cpp
with compiled_lobster.cpp
in the project (using xcode).
Thank you very much for your quick answer
Your original build from source, how was that made?
cd lobster.git/dev/xcode-cmake
xcodebuild -toolchain clang -configuration Release -target lobster
that results in a lobster
binary in lobster.git/dev/lobster
Now that I have the lobster
binary I want my hello.lobster translated to C++
$ cd lobster.git
$ cat hello.lobster
print("hello")
$ rm -r dev/compiled_lobster
$ mkdir -p dev/compiled_lobster/src
$ ./bin/lobster --cpp hello.lobster
$ tree dev/compiled_lobster
dev/compiled_lobster
└── src
└── compiled_lobster.cpp
$ ??
And now I'm not sure how to procede, because all of the above ( cmake ... TOCPP ... -> make -j8 ) didn't work
The downside of working with xcodebuild is that there currently is no convenient way to insert the generated code, but just for testing you should be able to replace main.cpp with compiled_lobster.cpp in the project (using xcode).
Can you tell me how exactly does that work?
And what happens if you do something like (modified from build_osx.h
):
mkdir -p xcode-cmake-compiled
cd xcode-cmake-compiled
# FIXME make joystick stuff compile?
cmake .. -G Xcode -DLOBSTER_TOCPP=ON -DSDL_HIDAPI_JOYSTICK=OFF -DSDL_JOYSTICK=OFF -DSDL_HAPTIC=OFF
cd ..
xcodebuild -toolchain clang -configuration Release -target lobster
I am guessing that would overwrite your bin/lobster
with the compiled version, but other than that something like this should work?
Can you tell me how exactly does that work?
In the Xcode project, you'd find main.cpp
, delete it, and instead add compiled_lobster.cpp
? But maybe not needed if the above works.
Hmm ... something is not working
mkdir -p xcode-cmake-compiled
Where is this in ./dev?
lobster.git/dev/xcode-cmake-compiled
There is something wrong or a misunderstanding with the directory I'm suppose to work in because in the end there is no xcode project
Is maybe the cd ..
unnessesary?
$ mkdir -p lobster.git/dev/xcode-cmake-compiled
$ cd lobster.git/dev/xcode-cmake-compiled
$ cmake .. -G Xcode -DLOBSTER_TOCPP=ON -DSDL_HIDAPI_JOYSTICK=OFF -DSDL_JOYSTICK=OFF -DSDL_HAPTIC=OFF
> cd ..
$ pwd
[...]/lobster.git/dev
$ xcodebuild -toolchain clang -configuration Release -target lobster
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -toolchain clang -configuration Release -target lobster
User defaults from command line:
IDEPackageSupportToolchainOverrideForManifestLoading = com.apple.dt.toolchain.XcodeDefault
IDEPackageSupportUseBuiltinSCM = YES
Build settings from command line:
TOOLCHAINS = clang
2024-04-10 01:09:47.234 xcodebuild[24887:612330] Writing error result bundle to /var/folders/2f/_9380nw966jbwjbc68_bw0mw0000gw/T/ResultBundle_2024-10-04_01-09-0047.xcresult
xcodebuild: error: The directory /Users/ben/build/lobster/lobster.git/dev does not contain an Xcode project.
there is a xcode project in lobster.git/dev/xcode-cmake-compiled
, but when I run it there is also an error
$ cd xcode-cmake-compiled
$ xcodebuild -toolchain clang -configuration Release -target lobster
xcodebuild -toolchain clang -configuration Release -target lobster
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -toolchain clang -configuration Release -target lobster
User defaults from command line:
IDEPackageSupportToolchainOverrideForManifestLoading = com.apple.dt.toolchain.XcodeDefault
IDEPackageSupportUseBuiltinSCM = YES
Build settings from command line:
TOOLCHAINS = clang
2024-04-10 01:14:27.945 xcodebuild[24975:615896] Writing error result bundle to /var/folders/2f/_9380nw966jbwjbc68_bw0mw0000gw/T/ResultBundle_2024-10-04_01-14-0027.xcresult
xcodebuild: error: The project 'Lobster.xcodeproj' does not contain a target named 'lobster'.
In the Xcode project, you'd find main.cpp, delete it, and instead add compiled_lobster.cpp ? But maybe not needed if the above works.
I had a look in xcode project and yes the compiled_lobster.cpp is there and the main.cpp isnt'
It mimics what is in build_osx.h
, so yeah, that is meant to be executed from inside dev
. And yes the xcodebuild
needs to be in that new dir, sorry.
Looking at the CMakeLists.txt, the target may be called compiled_lobster
(you should also be able to see this from Xcode).
xcodebuild -toolchain clang -configuration Release -target compiled_lobster
If that doesn't work I can boot up my mac and have a look..
So, I've tried that it doesn't work, I could not solve it so I post here the entire error message:
xcodebuild -toolchain clang -configuration Release -target compiled_lobster
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -toolchain clang -configuration Release -target compiled_lobster
User defaults from command line:
IDEPackageSupportToolchainOverrideForManifestLoading = com.apple.dt.toolchain.XcodeDefault
IDEPackageSupportUseBuiltinSCM = YES
Build settings from command line:
TOOLCHAINS = clang
ComputeTargetDependencyGraph
warning: Building targets in manual order is deprecated - check "Parallelize build for command-line builds" in the project editor, or set DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING in any of the targets in the current build to suppress this warning
note: Target dependency graph (4 targets)
Target 'compiled_lobster' in project 'Lobster'
➜ Explicit dependency on target 'ZERO_CHECK' in project 'Lobster'
➜ Explicit dependency on target 'SDL2-static' in project 'Lobster'
Target 'SDL2-static' in project 'Lobster'
➜ Explicit dependency on target 'sdl_headers_copy' in project 'Lobster'
Target 'sdl_headers_copy' in project 'Lobster' (no dependencies)
Target 'ZERO_CHECK' in project 'Lobster' (no dependencies)
GatherProvisioningInputs
CreateBuildDescription
note: Using global toolchain override 'clang'.
ClangStatCache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang-stat-cache /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk /var/folders/2f/_9380nw966jbwjbc68_bw0mw0000gw/C/com.apple.DeveloperTools/15.3-15E204a/Xcode/SDKStatCaches.noindex/macosx14.4-23E208-bff231aa2d6fad98acb49de9dca18c0613f6e737bddbb37f317b3579f3535bf5.sdkstatcache
cd /Users/ben/build/lobster/lobster.git/dev/xcode-cmake-compiled/Lobster.xcodeproj
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang-stat-cache /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -o /var/folders/2f/_9380nw966jbwjbc68_bw0mw0000gw/C/com.apple.DeveloperTools/15.3-15E204a/Xcode/SDKStatCaches.noindex/macosx14.4-23E208-bff231aa2d6fad98acb49de9dca18c0613f6e737bddbb37f317b3579f3535bf5.sdkstatcache
PhaseScriptExecution Generate\ CMakeFiles/ZERO_CHECK /Users/ben/build/lobster/lobster.git/dev/xcode-cmake-compiled/build/Lobster.build/Release/ZERO_CHECK.build/Script-26003998B9B6E417929D3F0E.sh (in target 'ZERO_CHECK' from project 'Lobster')
cd /Users/ben/build/lobster/lobster.git/dev
/bin/sh -c /Users/ben/build/lobster/lobster.git/dev/xcode-cmake-compiled/build/Lobster.build/Release/ZERO_CHECK.build/Script-26003998B9B6E417929D3F0E.sh
make: `/Users/ben/build/lobster/lobster.git/dev/xcode-cmake-compiled/CMakeFiles/cmake.check_cache' is up to date.
note: Run script build phase 'Generate external/SDL/CMakeFiles/sdl_headers_copy' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'sdl_headers_copy' from project 'Lobster')
note: Using global toolchain override 'clang'. (in target 'sdl_headers_copy' from project 'Lobster')
PhaseScriptExecution Generate\ external/SDL/CMakeFiles/sdl_headers_copy /Users/ben/build/lobster/lobster.git/dev/xcode-cmake-compiled/build/Lobster.build/Release/sdl_headers_copy.build/Script-4FDCD0CCAA840851DC9AA7E0.sh (in target 'sdl_headers_copy' from project 'Lobster')
cd /Users/ben/build/lobster/lobster.git/dev
/bin/sh -c /Users/ben/build/lobster/lobster.git/dev/xcode-cmake-compiled/build/Lobster.build/Release/sdl_headers_copy.build/Script-4FDCD0CCAA840851DC9AA7E0.sh
note: Using global toolchain override 'clang'. (in target 'compiled_lobster' from project 'Lobster')
Ld /Users/ben/build/lobster/lobster.git/bin/compiled_lobster normal (in target 'compiled_lobster' from project 'Lobster')
cd /Users/ben/build/lobster/lobster.git/dev
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -Xlinker -reproducible -target x86_64-apple-macos14.4 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -O3 -L/Users/ben/build/lobster/lobster.git/dev/xcode-cmake-compiled/build/EagerLinkingTBDs/Release -L/Users/ben/build/lobster/lobster.git/bin -F/Users/ben/build/lobster/lobster.git/dev/xcode-cmake-compiled/build/EagerLinkingTBDs/Release -F/Users/ben/build/lobster/lobster.git/bin -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/System/Library/Frameworks -filelist /Users/ben/build/lobster/lobster.git/dev/xcode-cmake-compiled/build/compiled_lobster.build/Release/Objects-normal/x86_64/compiled_lobster.LinkFileList -fuse-ld\=lld -flto -framework OpenGL /Users/ben/build/lobster/lobster.git/dev/xcode-cmake-compiled/external/SDL/Release/libSDL2.a -framework OpenGL -framework OpenGL -lm -liconv -Wl,-framework,CoreVideo -Wl,-framework,Cocoa -Wl,-framework,IOKit -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AVFoundation -Wl,-framework,Foundation -Wl,-weak_framework,Metal -Wl,-weak_framework,QuartzCore -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/ben/build/lobster/lobster.git/dev/xcode-cmake-compiled/build/compiled_lobster.build/Release/Objects-normal/x86_64/compiled_lobster_dependency_info.dat -o /Users/ben/build/lobster/lobster.git/bin/compiled_lobster
ld64.lld: warning: ignoring unknown argument: -platform_version
ld64.lld: warning: ignoring unknown argument: -O3
ld64.lld: warning: ignoring unknown argument: -reproducible
ld64.lld: warning: ignoring unknown argument: -weak_framework
ld64.lld: warning: ignoring unknown argument: -weak_framework
ld64.lld: warning: ignoring unknown argument: -no_adhoc_codesign
ld64.lld: warning: -sdk_version is required when emitting min version load command. Setting sdk version to match provided min version
lld (LLVM option parsing): Unknown command line argument '-disable-aligned-alloc-awareness=1'. Try: 'lld (LLVM option parsing) --help'
lld (LLVM option parsing): Did you mean '--disable-inlined-alloca-merging=1'?
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using global toolchain override 'clang'. (in target 'SDL2-static' from project 'Lobster')
note: Run script build phase 'Generate CMakeFiles/ZERO_CHECK' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'ZERO_CHECK' from project 'Lobster')
note: Using global toolchain override 'clang'. (in target 'ZERO_CHECK' from project 'Lobster')
** BUILD FAILED **
The following build commands failed:
Ld /Users/ben/build/lobster/lobster.git/bin/compiled_lobster normal (in target 'compiled_lobster' from project 'Lobster')
(1 failure)
Btw. there is stuff built into ./build, but no executable is here
du -sh build/*
18M build/compiled_lobster.build
0B build/EagerLinkingTBDs
316K build/Lobster.build
0B build/Release
4.4M build/SDL2-static.build
9.8M build/XCBuildData
I admit, I'm not at my best today, and maybe there is something broken on my mac. But I cannot run what is described in 'The Lobster C++ Implementation' over on https://aardappel.github.io/lobster/implementation.html, despite having already sunk hours into it ....
I've been able to build lobster from source (and I even found the resulting binary in bin/lobster)
But no I try to compile a simple hello world
compiling with --cpp works
The following cmake command also runs succesfully
but the following
make
fails when I run with LLVM@17here the error witn LLVM@14
here with LLVM@12