苹果M芯片编译错误
cool2528 opened this issue · comments
- The C compiler identification is AppleClang 15.0.0.15000040
-- The CXX compiler identification is AppleClang 15.0.0.15000040
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE
-- Found OpenGL: /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/OpenGL.framework
-- Found WrapOpenGL: TRUE
-- Configuring done (1.1s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/hotpixel/workspace/open_source_project/framelesshelper/build_arm64_osx
[4/54] Building CXX object src/core/CMakeFiles/Core.dir/chromepalette.cpp.o
clang: warning: optimization flag '-funroll-all-loops' is not supported [-Wignored-optimization-argument]
[5/54] Building CXX object src/core/CMakeFiles/Core.dir/framelesshelpercore_global.cpp.o
clang: warning: optimization flag '-funroll-all-loops' is not supported [-Wignored-optimization-argument]
/Users/hotpixel/workspace/open_source_project/framelesshelper/src/core/framelesshelpercore_global.cpp:112:27: warning: unused function 'lcCoreGlobal' [-Wunused-function]
static Q_LOGGING_CATEGORY(lcCoreGlobal, "wangwenx190.framelesshelper.core.global")
^
1 warning generated.
[6/54] Building CXX object src/core/CMakeFiles/Core.dir/Core_autogen/mocs_compilation.cpp.o
clang: warning: optimization flag '-funroll-all-loops' is not supported [-Wignored-optimization-argument]
[7/54] Building CXX object src/core/CMakeFiles/Core.dir/windowborderpainter.cpp.o
clang: warning: optimization flag '-funroll-all-loops' is not supported [-Wignored-optimization-argument]
[8/54] Building CXX object src/core/CMakeFiles/Core.dir/utils.cpp.o
clang: warning: optimization flag '-funroll-all-loops' is not supported [-Wignored-optimization-argument]
/Users/hotpixel/workspace/open_source_project/framelesshelper/src/core/utils.cpp:48:27: warning: unused function 'lcUtilsCommon' [-Wunused-function]
static Q_LOGGING_CATEGORY(lcUtilsCommon, "wangwenx190.framelesshelper.core.utils.common")
^
1 warning generated.
[9/54] Building CXX object src/core/CMakeFiles/Core.dir/framelessconfig.cpp.o
clang: warning: optimization flag '-funroll-all-loops' is not supported [-Wignored-optimization-argument]
/Users/hotpixel/workspace/open_source_project/framelesshelper/src/core/framelessconfig.cpp:34:27: warning: unused function 'lcFramelessConfig' [-Wunused-function]
static Q_LOGGING_CATEGORY(lcFramelessConfig, "wangwenx190.framelesshelper.core.framelessconfig")
^
1 warning generated.
[10/54] Building CXX object src/core/CMakeFiles/Core.dir/framelessmanager.cpp.o
clang: warning: optimization flag '-funroll-all-loops' is not supported [-Wignored-optimization-argument]
/Users/hotpixel/workspace/open_source_project/framelesshelper/src/core/framelessmanager.cpp:47:27: warning: unused function 'lcFramelessManager' [-Wunused-function]
static Q_LOGGING_CATEGORY(lcFramelessManager, "wangwenx190.framelesshelper.core.framelessmanager")
^
1 warning generated.
[11/54] Building CXX object src/core/CMakeFiles/Core.dir/.rcc/qrc_framelesshelpercore.cpp.o
clang: warning: optimization flag '-funroll-all-loops' is not supported [-Wignored-optimization-argument]
[12/54] Building CXX object src/core/CMakeFiles/Core.dir/sysapiloader.cpp.o
clang: warning: optimization flag '-funroll-all-loops' is not supported [-Wignored-optimization-argument]
/Users/hotpixel/workspace/open_source_project/framelesshelper/src/core/sysapiloader.cpp:60:27: warning: unused function 'lcSysApiLoader' [-Wunused-function]
static Q_LOGGING_CATEGORY(lcSysApiLoader, "wangwenx190.framelesshelper.core.sysapiloader")
^
1 warning generated.
[13/54] Building CXX object src/core/CMakeFiles/Core.dir/framelesshelper_qt.cpp.o
clang: warning: optimization flag '-funroll-all-loops' is not supported [-Wignored-optimization-argument]
[14/54] Building CXX object src/core/CMakeFiles/Core.dir/micamaterial.cpp.o
clang: warning: optimization flag '-funroll-all-loops' is not supported [-Wignored-optimization-argument]
/Users/hotpixel/workspace/open_source_project/framelesshelper/src/core/micamaterial.cpp:47:27: warning: unused function 'lcMicaMaterial' [-Wunused-function]
static Q_LOGGING_CATEGORY(lcMicaMaterial, "wangwenx190.framelesshelper.core.micamaterial")
^
1 warning generated.
[15/54] Building CXX object src/core/CMakeFiles/Core.dir/utils_mac.mm.o
clang: warning: optimization flag '-funroll-all-loops' is not supported [-Wignored-optimization-argument]
/Users/hotpixel/workspace/open_source_project/framelesshelper/src/core/utils_mac.mm:68:27: warning: unused function 'lcUtilsMac' [-Wunused-function]
static Q_LOGGING_CATEGORY(lcUtilsMac, "wangwenx190.framelesshelper.core.utils.mac")
^
1 warning generated.
[16/54] Linking CXX shared library lib64/libFramelessHelperCore.2.4.2.dylib
FAILED: lib64/libFramelessHelperCore.2.4.2.dylib
: && /Library/Developer/CommandLineTools/usr/bin/c++ -Wall -Wextra -frtti -fexceptions -DNDEBUG -Ofast -flto=thin -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk -mmacosx-version-min=13.5 -dynamiclib -Wl,-headerpad_max_install_names -Wl,-fatal_warnings -Wl,-undefined,error -Wl,-dead_strip -Wl,-no_data_in_code_info -Wl,-no_function_starts -compatibility_version 2.0.0 -current_version 2.4.2 -o lib64/libFramelessHelperCore.2.4.2.dylib -install_name @rpath/libFramelessHelperCore.2.dylib src/core/CMakeFiles/Core.dir/Core_autogen/mocs_compilation.cpp.o src/core/CMakeFiles/Core.dir/utils.cpp.o src/core/CMakeFiles/Core.dir/framelesshelper_qt.cpp.o src/core/CMakeFiles/Core.dir/framelessmanager.cpp.o src/core/CMakeFiles/Core.dir/framelessconfig.cpp.o src/core/CMakeFiles/Core.dir/sysapiloader.cpp.o src/core/CMakeFiles/Core.dir/chromepalette.cpp.o src/core/CMakeFiles/Core.dir/framelesshelpercore_global.cpp.o src/core/CMakeFiles/Core.dir/micamaterial.cpp.o src/core/CMakeFiles/Core.dir/windowborderpainter.cpp.o src/core/CMakeFiles/Core.dir/utils_mac.mm.o src/core/CMakeFiles/Core.dir/.rcc/qrc_framelesshelpercore.cpp.o -iframework /Applications/qt/6.5.2/macos/lib -Wl,-rpath,/Applications/qt/6.5.2/macos/lib -framework Foundation -framework Cocoa -framework AppKit /Applications/qt/6.5.2/macos/lib/QtGui.framework/Versions/A/QtGui -framework AppKit /Applications/qt/6.5.2/macos/lib/QtCore.framework/Versions/A/QtCore -framework IOKit -framework DiskArbitration -Xlinker -framework -Xlinker OpenGL -Xlinker -framework -Xlinker AGL -framework ImageIO -framework Metal && :
ld: warning: -undefined error is deprecated
ld: fatal warning(s) induced error (-fatal_warnings)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
这个是什么原因造成的?如何让其正常编译?
apple clang 编译器问题,解决办法在cmake 脚本中增加 如下设置
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-ld_classic")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-ld_classic")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-ld_classic")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -Wl,-ld_classic")