Hi @t0m, sorry for the late reply, here is a bit more info.
Calling kikoo.mm
your test app above, here is are some raw findings:
$CLANG kikoo.mm
fails at link time for both $CLANG=/usr/bin/clang++
(Xcode’s latest clang) and $CLANG=/usr/local/Cellar/llvm/13.0.0_2/bin/clang++
(Homebrew’s clang).
Undefined symbols for architecture x86_64:
"_kIOMainPortDefault", referenced from:
_main in kikoo-a29ff3.o
"_kIOMasterPortDefault", referenced from:
_main in kikoo-a29ff3.o
ld: symbol(s) not found for architecture x86_64
That’s expected I guess. Adding -framework IOKit
to the command lines above solves the issue in both cases (linking succeeds).
Now compiling through this simple CMakeLists.txt
:
juce_add_gui_app(kikoo)
target_sources(kikoo PRIVATE kikoo.mm)
target_link_libraries(kikoo
PRIVATE
juce::juce_gui_extra
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags
juce::juce_recommended_config_flags
)
With Xcode’s clang selected, linking succeeds. Linking command line:
/usr/bin/clang++ -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names kikoo/CMakeFiles/kikoo.dir/kikoo.mm.o kikoo/CMakeFiles/kikoo.dir/__/extern/JUCE/modules/juce_gui_extra/juce_gui_extra.mm.o kikoo/CMakeFiles/kikoo.dir/__/extern/JUCE/modules/juce_gui_basics/juce_gui_basics.mm.o kikoo/CMakeFiles/kikoo.dir/__/extern/JUCE/modules/juce_graphics/juce_graphics.mm.o kikoo/CMakeFiles/kikoo.dir/__/extern/JUCE/modules/juce_events/juce_events.mm.o kikoo/CMakeFiles/kikoo.dir/__/extern/JUCE/modules/juce_core/juce_core.mm.o kikoo/CMakeFiles/kikoo.dir/__/extern/JUCE/modules/juce_data_structures/juce_data_structures.mm.o -o kikoo/kikoo_artefacts/RelWithDebInfo/kikoo.app/Contents/MacOS/kikoo -framework WebKit -framework Carbon -framework QuartzCore -framework Cocoa -framework Foundation -framework IOKit
Now when Homebrew’s clang is selected, linking fails as above. The command line is exactly the same, except for the executable path obviously (/usr/local/Cellar/llvm/13.0.0_2/bin/clang++
).
I realize this is quite a raw lot of info, and probably beyond the scope of JUCE per se…
Can you reproduce this at all?