yrnkrn / zapcc

zapcc is a caching C++ compiler based on clang, designed to perform faster compilations
Other
1.25k stars 60 forks source link

Mac OSX build error: `unknown directive` `.symver memcpy` #5

Closed thejoelw closed 6 years ago

thejoelw commented 6 years ago

Compile output:

~/source> git clone https://github.com/yrnkrn/zapcc.git
...
~/source> cd zapcc
~/s/zapcc> mkdir build
~/s/zapcc> cd build
~/s/z/build> cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_WARNINGS=OFF ..
...
~/s/z/build> ninja
[2982/3139] Building C object tools/zapcc/CMakeFiles/zapcc.dir/__/zapccs/memcpy_compat.c.o
FAILED: tools/zapcc/CMakeFiles/zapcc.dir/__/zapccs/memcpy_compat.c.o
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_GLOBAL_ISEL -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/zapcc -I../tools/zapcc -I../tools/zapcc/../clang/include -Itools/zapcc/../clang/include -I../tools/zapcc/../zapccs -Iinclude -I../include -fPIC -w -fcolor-diagnostics -O3 -DNDEBUG -MD -MT tools/zapcc/CMakeFiles/zapcc.dir/__/zapccs/memcpy_compat.c.o -MF tools/zapcc/CMakeFiles/zapcc.dir/__/zapccs/memcpy_compat.c.o.d -o tools/zapcc/CMakeFiles/zapcc.dir/__/zapccs/memcpy_compat.c.o   -c ../tools/zapccs/memcpy_compat.c
<inline asm>:1:1: error: unknown directive
.symver memcpy, memcpy@GLIBC_2.2.5
^
1 error generated.
[2991/3139] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndex.cpp.o
ninja: build stopped: subcommand failed.

System details:

Mac OSX 10.13.3 (17D102)

~> uname -a
Darwin ... 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
~> /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc --version
Apple LLVM version 9.1.0 (clang-902.0.37.1)
Target: x86_64-apple-darwin17.4.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
yrnkrn commented 6 years ago

zapcc was never built on MacOS. The LLVM code will compile OK, but the client-server code in zapcc will probably fail compiling. Anyhow, does c2b11ba7d65eb36a595f8da5044e39868d8d825b solve this specific compile error?

thejoelw commented 6 years ago

Ok. In that case it's kind of impressive it's getting this far.

Yep, that fixes that error. Now I'm getting a linker error ld: unknown option: --wrap=memcpy

~/s/z/build> ninja
[83/102] Linking CXX executable bin/zapcc
FAILED: bin/zapcc
: && /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -fPIC -fvisibility-inlines-hidden -std=c++11 -w -fcolor-diagnostics -O3 -DNDEBUG -Wl,-search_paths_first -Wl,-headerpad_max_install_names -static-libstdc++ -Wl,--wrap=memcpy    -Wl,-dead_strip tools/zapcc/CMakeFiles/zapcc.dir/Client.cpp.o tools/zapcc/CMakeFiles/zapcc.dir/ErrorCouldNot.cpp.o tools/zapcc/CMakeFiles/zapcc.dir/FindBaseName.cpp.o tools/zapcc/CMakeFiles/zapcc.dir/TerminateAllCopiesOf.cpp.o tools/zapcc/CMakeFiles/zapcc.dir/tinycthread.c.o tools/zapcc/CMakeFiles/zapcc.dir/zapcc1_main.cpp.o tools/zapcc/CMakeFiles/zapcc.dir/__/clang/tools/driver/cc1_main.cpp.o tools/zapcc/CMakeFiles/zapcc.dir/__/clang/tools/driver/cc1as_main.cpp.o tools/zapcc/CMakeFiles/zapcc.dir/__/clang/tools/driver/driver.cpp.o tools/zapcc/CMakeFiles/zapcc.dir/__/zapccs/CommandLine.cpp.o tools/zapcc/CMakeFiles/zapcc.dir/__/zapccs/DisableStreamsBuffering.cpp.o tools/zapcc/CMakeFiles/zapcc.dir/__/zapccs/FindOption.cpp.o tools/zapcc/CMakeFiles/zapcc.dir/__/zapccs/GetExePath.cpp.o tools/zapcc/CMakeFiles/zapcc.dir/__/zapccs/memcpy_compat.c.o tools/zapcc/CMakeFiles/zapcc.dir/__/zapccs/StringConst.cpp.o tools/zapcc/CMakeFiles/zapcc.dir/__/zapccs/StopWatch.cpp.o tools/zapcc/CMakeFiles/zapcc.dir/__/zapccs/TextFile.cpp.o  -o bin/zapcc  -Wl,-rpath,@loader_path/../lib lib/libLLVMAArch64CodeGen.a lib/libLLVMAArch64AsmPrinter.a lib/libLLVMAArch64AsmParser.a lib/libLLVMAArch64Desc.a lib/libLLVMAArch64Info.a lib/libLLVMAArch64Disassembler.a lib/libLLVMAArch64Info.a lib/libLLVMAArch64Utils.a lib/libLLVMAMDGPUCodeGen.a lib/libLLVMAMDGPUAsmPrinter.a lib/libLLVMAMDGPUAsmParser.a lib/libLLVMAMDGPUDesc.a lib/libLLVMAMDGPUInfo.a lib/libLLVMAMDGPUDisassembler.a lib/libLLVMAMDGPUInfo.a lib/libLLVMAMDGPUUtils.a lib/libLLVMARMCodeGen.a lib/libLLVMARMAsmPrinter.a lib/libLLVMARMAsmParser.a lib/libLLVMARMDesc.a lib/libLLVMARMInfo.a lib/libLLVMARMDisassembler.a lib/libLLVMARMInfo.a lib/libLLVMBPFCodeGen.a lib/libLLVMBPFAsmPrinter.a lib/libLLVMBPFDesc.a lib/libLLVMBPFInfo.a lib/libLLVMBPFDisassembler.a lib/libLLVMBPFInfo.a lib/libLLVMHexagonCodeGen.a lib/libLLVMHexagonAsmParser.a lib/libLLVMHexagonDesc.a lib/libLLVMHexagonInfo.a lib/libLLVMHexagonDisassembler.a lib/libLLVMHexagonInfo.a lib/libLLVMLanaiCodeGen.a lib/libLLVMLanaiAsmPrinter.a lib/libLLVMLanaiAsmParser.a lib/libLLVMLanaiDesc.a lib/libLLVMLanaiInfo.a lib/libLLVMLanaiDisassembler.a lib/libLLVMLanaiInfo.a lib/libLLVMMipsCodeGen.a lib/libLLVMMipsAsmPrinter.a lib/libLLVMMipsAsmParser.a lib/libLLVMMipsDesc.a lib/libLLVMMipsInfo.a lib/libLLVMMipsDisassembler.a lib/libLLVMMipsInfo.a lib/libLLVMMSP430CodeGen.a lib/libLLVMMSP430AsmPrinter.a lib/libLLVMMSP430Desc.a lib/libLLVMMSP430Info.a lib/libLLVMMSP430Info.a lib/libLLVMNVPTXCodeGen.a lib/libLLVMNVPTXAsmPrinter.a lib/libLLVMNVPTXDesc.a lib/libLLVMNVPTXInfo.a lib/libLLVMNVPTXInfo.a lib/libLLVMPowerPCCodeGen.a lib/libLLVMPowerPCAsmPrinter.a lib/libLLVMPowerPCAsmParser.a lib/libLLVMPowerPCDesc.a lib/libLLVMPowerPCInfo.a lib/libLLVMPowerPCDisassembler.a lib/libLLVMPowerPCInfo.a lib/libLLVMRISCVCodeGen.a lib/libLLVMRISCVDesc.a lib/libLLVMRISCVInfo.a lib/libLLVMRISCVInfo.a lib/libLLVMSparcCodeGen.a lib/libLLVMSparcAsmPrinter.a lib/libLLVMSparcAsmParser.a lib/libLLVMSparcDesc.a lib/libLLVMSparcInfo.a lib/libLLVMSparcDisassembler.a lib/libLLVMSparcInfo.a lib/libLLVMSystemZCodeGen.a lib/libLLVMSystemZAsmPrinter.a lib/libLLVMSystemZAsmParser.a lib/libLLVMSystemZDesc.a lib/libLLVMSystemZInfo.a lib/libLLVMSystemZDisassembler.a lib/libLLVMSystemZInfo.a lib/libLLVMX86CodeGen.a lib/libLLVMX86AsmPrinter.a lib/libLLVMX86AsmParser.a lib/libLLVMX86Desc.a lib/libLLVMX86Info.a lib/libLLVMX86Disassembler.a lib/libLLVMX86Info.a lib/libLLVMX86Utils.a lib/libLLVMXCoreCodeGen.a lib/libLLVMXCoreAsmPrinter.a lib/libLLVMXCoreDesc.a lib/libLLVMXCoreInfo.a lib/libLLVMXCoreDisassembler.a lib/libLLVMXCoreInfo.a lib/libLLVMAnalysis.a lib/libLLVMCodeGen.a lib/libLLVMCore.a lib/libLLVMipo.a lib/libLLVMInstCombine.a lib/libLLVMInstrumentation.a lib/libLLVMMC.a lib/libLLVMMCParser.a lib/libLLVMObjCARCOpts.a lib/libLLVMOption.a lib/libLLVMScalarOpts.a lib/libLLVMSupport.a lib/libLLVMTransformUtils.a lib/libLLVMVectorize.a lib/libclangBasic.a lib/libclangCodeGen.a lib/libclangDriver.a lib/libclangFrontend.a lib/libclangFrontendTool.a lib/libLLVMAArch64Desc.a lib/libLLVMAArch64AsmPrinter.a lib/libLLVMAArch64Info.a lib/libLLVMAArch64Utils.a lib/libLLVMAMDGPUDesc.a lib/libLLVMAMDGPUAsmPrinter.a lib/libLLVMAMDGPUInfo.a lib/libLLVMAMDGPUUtils.a lib/libLLVMARMDesc.a lib/libLLVMARMAsmPrinter.a lib/libLLVMARMInfo.a lib/libLLVMBPFAsmPrinter.a lib/libLLVMHexagonDesc.a lib/libLLVMHexagonInfo.a lib/libLLVMLanaiDesc.a lib/libLLVMLanaiAsmPrinter.a lib/libLLVMLanaiInfo.a lib/libLLVMMipsAsmPrinter.a lib/libLLVMMSP430AsmPrinter.a lib/libLLVMNVPTXAsmPrinter.a lib/libLLVMPowerPCAsmPrinter.a lib/libLLVMSparcAsmPrinter.a lib/libLLVMSystemZDesc.a lib/libLLVMSystemZAsmPrinter.a lib/libLLVMSystemZInfo.a lib/libLLVMGlobalISel.a lib/libLLVMX86AsmPrinter.a lib/libLLVMX86Utils.a lib/libLLVMXCoreAsmPrinter.a lib/libLLVMAsmPrinter.a lib/libLLVMDebugInfoCodeView.a lib/libLLVMDebugInfoMSF.a lib/libLLVMSelectionDAG.a lib/libLLVMMCDisassembler.a lib/libclangCodeGen.a lib/libLLVMCoroutines.a lib/libLLVMCoverage.a lib/libLLVMLTO.a lib/libLLVMObjCARCOpts.a lib/libLLVMPasses.a lib/libLLVMCodeGen.a lib/libLLVMTarget.a lib/libLLVMipo.a lib/libLLVMBitWriter.a lib/libLLVMIRReader.a lib/libLLVMAsmParser.a lib/libLLVMLinker.a lib/libLLVMInstrumentation.a lib/libLLVMScalarOpts.a lib/libLLVMInstCombine.a lib/libLLVMVectorize.a lib/libLLVMTransformUtils.a lib/libLLVMAnalysis.a lib/libLLVMObject.a lib/libclangRewriteFrontend.a lib/libclangARCMigrate.a lib/libclangStaticAnalyzerFrontend.a lib/libclangFrontend.a lib/libclangDriver.a lib/libLLVMOption.a lib/libLLVMProfileData.a lib/libclangParse.a lib/libLLVMMCParser.a lib/libclangSerialization.a lib/libLLVMBitReader.a lib/libclangSema.a lib/libclangEdit.a lib/libclangStaticAnalyzerCheckers.a lib/libclangASTMatchers.a lib/libclangStaticAnalyzerCore.a lib/libclangAnalysis.a lib/libclangAST.a lib/libclangRewrite.a lib/libclangLex.a lib/libclangBasic.a lib/libLLVMCore.a lib/libLLVMBinaryFormat.a lib/libLLVMMC.a lib/libLLVMSupport.a -lcurses -lz -lm lib/libLLVMDemangle.a && cd /Users/tjxw4/source/zapcc/build/tools/zapcc && /usr/local/Cellar/cmake/3.11.4/bin/cmake -E create_symlink zapcc /Users/tjxw4/source/zapcc/build/./bin/zapcc++ && cd /Users/tjxw4/source/zapcc/build/tools/zapcc && /usr/local/Cellar/cmake/3.11.4/bin/cmake -E create_symlink zapcc /Users/tjxw4/source/zapcc/build/./bin/zapcc-cl
ld: unknown option: --wrap=memcpy
clang: error: linker command failed with exit code 1 (use -v to see invocation)
emlai commented 6 years ago

@JWalker1995 #6 fixes that.

yrnkrn commented 6 years ago

Actually, the whole memcpy thing was a solution to a compatibility problem when distributing a precompiled binary. Open source edition does not need this anymore, eliminated the whole mess in c74f82da81b310dace3e1b53046d7dac12d8d676.

Does zapcc work now on MacOS?

thejoelw commented 6 years ago

Yep that fixes the build! Thanks

yrnkrn commented 6 years ago

Good to know! I mean to ask, after building zapcc, does zapcc compile correctly multiple files?