编译命令:
./build.sh amd64 release clean
错误信息:
Building ASM object src/vm/wks/CMakeFiles/cee_wks.dir/__/amd64/virtualcallstubamd64.S.o Linking CXX static library libcee_wks.a /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcee_wks.a(jithelpers_slow.S.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcee_wks.a(jithelpers_slow.S.o) has no symbols [ 39%] Built target cee_wks make: *** [all] Error 2 Failed to build coreclr components.
上面只是警告,实际错误是:
Undefined symbols for architecture x86_64: "_DBG_CheckStackAlignment", referenced from: _DuplicateHandle in libCoreClrPal.a(handleapi.cpp.o) _CloseHandle in libCoreClrPal.a(handleapi.cpp.o) _CreateFileA in libCoreClrPal.a(file.cpp.o) _CreateFileW in libCoreClrPal.a(file.cpp.o) _CopyFileW in libCoreClrPal.a(file.cpp.o) _CopyFileA in libCoreClrPal.a(file.cpp.o) _DeleteFileA in libCoreClrPal.a(file.cpp.o) ... ld: symbol(s) not found for architecture x86_64
请问如何解决这个问题?
运行下面的命令:
sudo xcode-select --switch /Library/Developer/CommandLineTools brew install libtool
错误变成:
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libcee_wks.a(jithelpers_slow.S.o) has no symbols /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libcee_wks.a(jithelpers_slow.S.o) has no symbols
解决方法:在 src/pal/src/arch/i386/context.S 中,将 #if defined(_DEBUG) 改为 #if defined(__APPLE__)