Closed KnightJun closed 1 month ago
Bot detected the issue body's language is not English, translate it automatically.
Title: The frameworks added using add_frameworks for Qt development under Macos are not added to the link command.
再试试,xmake update -s dev
Bot detected the issue body's language is not English, translate it automatically.
Try again,
xmake update -s dev
Xmake 版本
xmake v2.8.1+master.22cd7c1f7
操作系统版本和架构
macOS, Qt 5.15
描述问题
xmake脚本:
执行xmake -v后输出:
"Cocoa", "WebKit"这两个frameworks没有添加到链接命令中
期待的结果
正确添加frameworks到链接命令中
工程配置
add_rules("mode.debug", "mode.release")
targetName = "WebCallback" target(targetName) add_rules("qt.shared") add_frameworks("core", "QtNetwork", "QtGui", "QtWidgets") add_frameworks("Cocoa", "WebKit") add_files("WebView/.h") add_files("WebView/.mm")
附加信息和错误日志
[ 71%]: linking.release libWebCallback.dylib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -o build/macosx/arm64/release/libWebCallback.dylib build/.objs/WebCallback/macosx/arm64/release/WebView/webviewinqt.mm.o build/.objs/WebCallback/macosx/arm64/release/WebView/customwebview.mm.o build/.objs/WebCallback/macosx/arm64/release/gens/WebView/moc_webviewinqt.cpp.o build/.objs/WebCallback/macosx/arm64/release/gens/WebView/moc_customwebview.cpp.o -shared -target arm64-apple-macos10.14 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -stdlib=libc++ -fPIC -L/Users/knightjun/code/lib/Qt/universal/lib -F/Users/knightjun/code/lib/Qt/universal/lib -Wl,-x -Wl,-dead_strip -framework QtNetwork -framework QtGui -framework QtWidgets -framework QtCore -framework DiskArbitration -framework IOKit -framework CoreFoundation -framework CoreGraphics -framework OpenGL -framework Carbon -framework Foundation -framework AppKit -framework Security -framework SystemConfiguration -lqtlibpng -lqtfreetype -lqtlibjpeg -lz -install_name @rpath/libWebCallback.dylib Undefined symbols for architecture arm64: "_OBJCCLASS$_WebView", referenced from: _OBJCCLASS$_CustomWebView in customwebview.mm.o "_OBJCMETACLASS$_WebView", referenced from: _OBJCMETACLASS$_CustomWebView in customwebview.mm.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) error: @programdir/modules/private/async/runjobs.lua:256: @programdir/actions/build/kinds/shared.lua:89: @programdir/core/sandbox/modules/os.lua:378: execv(/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -o build/macosx/arm64/release/libWebCallback.dylib build/.objs/WebCallback/macosx/arm64/release/WebView/webviewinqt.mm.o build/.objs/WebCallback/macosx/arm64/release/WebView/customwebview.mm.o build/.objs/WebCallback/macosx/arm64/release/gens/WebView/moc_webviewinqt.cpp.o build/.objs/WebCallback/macosx/arm64/release/gens/WebView/moc_customwebview.cpp.o -shared -target arm64-apple-macos10.14 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -stdlib=libc++ -fPIC -L/Users/knightjun/code/lib/Qt/universal/lib -F/Users/knightjun/code/lib/Qt/universal/lib -Wl,-x -Wl,-dead_strip -framework QtNetwork -framework QtGui -framework QtWidgets -framework QtCore -framework DiskArbitration -framework IOKit -framework CoreFoundation -framework CoreGraphics -framework OpenGL -framework Carbon -framework Foundation -framework AppKit -framework Security -framework SystemConfiguration -lqtlibpng -lqtfreetype -lqtlibjpeg -lz -install_name @rpath/libWebCallback.dylib) failed(1) stack traceback: [C]: in function 'error' [@programdir/core/base/os.lua:913]: [@programdir/core/sandbox/modules/os.lua:378]: in function 'execv' [@programdir/modules/core/tools/gcc.lua:436]: [C]: in function 'xpcall' [@programdir/core/base/utils.lua:280]: [@programdir/core/tool/linker.lua:224]: in function 'link' [@programdir/actions/build/kinds/shared.lua:89]: in function 'callback' [@programdir/modules/core/project/depend.lua:193]: in function 'on_changed' [@programdir/actions/build/kinds/shared.lua:55]: in function '_do_link_target' [@programdir/actions/build/kinds/shared.lua:117]: [@programdir/actions/build/kinds/shared.lua:144]: in function '_link_target' [@programdir/actions/build/kinds/shared.lua:172]: in function 'jobfunc' [@programdir/modules/private/async/runjobs.lua:232]: [C]: in function 'xpcall' [@programdir/core/base/utils.lua:280]: in function 'trycall' [@programdir/core/sandbox/modules/try.lua:117]: in function 'try' [@programdir/modules/private/async/runjobs.lua:218]: in function 'cotask' [@programdir/core/base/scheduler.lua:404]:
stack traceback: [C]: in function 'error' @programdir/core/base/os.lua:913: in function 'os.raiselevel' (...tail calls...) @programdir/modules/private/async/runjobs.lua:256: in field 'catch' @programdir/core/sandbox/modules/try.lua:123: in global 'try' @programdir/modules/private/async/runjobs.lua:218: in upvalue 'cotask' @programdir/core/base/scheduler.lua:404: in function <@programdir/core/base/scheduler.lua:397>