clang++38 -fsanitize=address -std=c++1z -stdlib=libc++ -I../ -I/usr/local/include/ -c foo.cc -o foo.o clang++38 -fsanitize=address -std=c++1z -stdlib=libc++ -o foo foo.o /usr/bin/ld: /usr/local/llvm38/bin/../lib/clang/3.8.0/lib/freebsd/libclang_rt.asan-x86_64.a: No such file: No such file or directory clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation) clang++37 works perfectly with -fsanitize=address/undefined % freebsd-version 10.2-RELEASE-p11 % uname -a FreeBSD aria 10.2-RELEASE-p9 FreeBSD 10.2-RELEASE-p9 #0: Thu Jan 14 01:32:46 UTC 2016 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
Sanitizers aren't being build for llvm38 or llvm-devel because the in-tree build stopped working some time after llvm37 and the out of tree build later started to depend on std*.h files we don't install because they break FreeBSD builds. I'm probably building compiler-rt wrong some how, but I've not had time to try very hard to find a fix.
*** Bug 208923 has been marked as a duplicate of this bug. ***
A commit references this bug: Author: brooks Date: Sun Apr 24 16:14:09 UTC 2016 New revision: 413948 URL: https://svnweb.freebsd.org/changeset/ports/413948 Log: Upgrade to a new snapshot. Build compiler-rt alongside LLVM. It requires clang headers that we don't install because they are incompatible with FreeBSD headers. To make this work, configure and build compiler-rt in the post-build phase against the built, but not yet installed llvm tree. PR: 208900, 208923 Changes: head/MOVED head/devel/Makefile head/devel/compiler-rt-devel/ head/devel/llvm-devel/Makefile head/devel/llvm-devel/Makefile.snapshot head/devel/llvm-devel/distinfo head/devel/llvm-devel/pkg-plist
A commit references this bug: Author: brooks Date: Sun Apr 24 17:44:55 UTC 2016 New revision: 413953 URL: https://svnweb.freebsd.org/changeset/ports/413953 Log: Build compiler-rt on i386 and amd64. It should be possible to enable on other other architectures, but I have no way to build the PLIST_FILES variables. PR: 208900, 208923 Changes: head/devel/llvm38/Makefile head/devel/llvm38/distinfo head/devel/llvm38/files/compiler-rt-patch-svn-261229 head/devel/llvm38/pkg-plist
I'm still having this problem with Clang 3.8.1. I was waiting for 3.9 to see if this would be resolved, but it wasn't. % clang37 --version clang version 3.7.1 (tags/RELEASE_371/final) Target: x86_64-unknown-freebsd10.2 Thread model: posix % clang++37 -march=native -fsanitize=address -fsanitize=undefined -std=c++1z -stdlib=libc++ -Weverything -pedantic -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -I../ -I/usr/local/include/ -c san.test.cc -o san.test.o % clang++37 -march=native -fsanitize=address -fsanitize=undefined -std=c++1z -stdlib=libc++ -Weverything -pedantic -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -o san.test san.test.o Works. % clang38 --version clang version 3.8.1 (tags/RELEASE_381/final) Target: x86_64-unknown-freebsd10.2 Thread model: posix InstalledDir: /usr/local/llvm38/bin % clang++38 -march=native -fsanitize=address -fsanitize=undefined -std=c++1z -stdlib=libc++ -Weverything -pedantic -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -o san.test san.test.o /usr/bin/ld: /usr/local/llvm38/bin/../lib/clang/3.8.1/lib/freebsd/libclang_rt.asan-x86_64.a: No such file: No such file or directory % clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1 % clang39 --version clang version 3.9.0 (tags/RELEASE_390/rc1) Target: x86_64-unknown-freebsd10.2 Thread model: posix InstalledDir: /usr/local/llvm39/bin % clang++39 -march=native -fsanitize=address -fsanitize=undefined -std=c++1z -stdlib=libc++ -Weverything -pedantic -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -I../ -I/usr/local/include/ -c san.test.cc -o san.test.o % clang++39 -march=native -fsanitize=address -fsanitize=undefined -std=c++1z -stdlib=libc++ -Weverything -pedantic -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -o san.test san.test.o /usr/bin/ld: /usr/local/llvm39/bin/../lib/clang/3.9.0/lib/freebsd/libclang_rt.asan-x86_64.a: No such file: No such file or directory clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1
Hi, I built Clang/LLVM 3.9.0 RC2 today and I saw that needed libraries gets built, but I still get the same error: /usr/bin/ld: /usr/local/llvm39/bin/../lib/clang/3.9.0/lib/freebsd/libclang_rt.asan-x86_64.a: No such file: No such file or directory clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1 Here's the quick fix: # cd /usr/local/llvm39/lib # mkdir clang/3.9.0/lib # cp -R freebsd clang/3.9.0/lib Thanks, Mikael
Could you try making /usr/local/llvm39/lib/clang/3.9.0/lib a symlink to /usr/local/llvm39/lib? If that works it would be an easy fix.
That works! Didn't think about that since it points back up the tree, but I guess that's okay.
A commit references this bug: Author: brooks Date: Fri Aug 26 21:40:09 UTC 2016 New revision: 420952 URL: https://svnweb.freebsd.org/changeset/ports/420952 Log: Put santizers where clang expects to find them. Thanks to Mikael Simonsson <m@mikaelsimonsson.com> for suggestions and testing. PR: 208900 Changes: head/devel/llvm39/Makefile
A commit references this bug: Author: brooks Date: Sat Aug 27 00:09:51 UTC 2016 New revision: 420953 URL: https://svnweb.freebsd.org/changeset/ports/420953 Log: Put santizers where clang expects to find them. Thanks to Mikael Simonsson <m@mikaelsimonsson.com> for suggestions and testing. PR: 208900 Changes: head/devel/llvm38/Makefile
Thanks Brooks, unfortunately it looks like this broke the llvm39 port (the only one I tried). This is the makefile that doesn't build: https://svnweb.freebsd.org/ports/head/devel/llvm39/Makefile?revision=420988&view=markup To confirm I reverted to: https://svnweb.freebsd.org/ports/head/devel/llvm39/Makefile?revision=420806&view=markup Which builds, but while doing so I lost the first build error in my tmux history, let me know if you need me to do any more testing.
Fired of another build to get the error message, here's what I'm seeing when trying to build the latest llvm39: [2064/3818] Linking CXX executable bin/llvm-ar /usr/bin/ld: warning: libLLVMAArch64Utils.so, needed by lib/libLLVMAArch64CodeGen.so, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libLLVMAnalysis.so, needed by lib/libLLVMAArch64CodeGen.so, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libLLVMAsmPrinter.so, needed by lib/libLLVMAArch64CodeGen.so, not found (try using -rpath or -rpath-link) ... [2308/3818] Linking CXX executable bin/clang-format /usr/bin/ld: warning: libLLVMCore.so, needed by lib/libclangBasic.so, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libLLVMMC.so, needed by lib/libclangBasic.so, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libclangLex.so, needed by lib/libclangFormat.so, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libclangAST.so, needed by lib/libclangToolingCore.so, not found (try using -rpath or -rpath-link) ... [3752/3818] Linking CXX executable bin/lldb-argdumper FAILED: bin/lldb-argdumper : && /usr/bin/c++ -O2 -pipe -isystem /usr/local/include -fstack-protector -fno-strict-aliasing -isystem /usr/local/include -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wdelete-non-virtual-dtor -std=c++11 -fcolor-diagnostics -fdata-sections -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -O2 -pipe -isystem /usr/local/include -fstack-protector -fno-strict-aliasing -isystem /usr/local/include -L/usr/local/lib -fstack-protector -Wl,-z,origin -Wl,-allow-shlib-undefined -Wl,-O3 -Wl,--gc-sections tools/lldb/tools/argdumper/CMakeFiles/lldb-argdumper.dir/argdumper.cpp.o -o bin/lldb-argdumper -lpthread lib/liblldb.so.3.9.0 -Wl,--start-group lib/liblldbBase.a lib/liblldbBreakpoint.a lib/liblldbCommands.a lib/liblldbDataFormatters.a lib/liblldbHost.a lib/liblldbCore.a lib/liblldbExpression.a lib/liblldbInitialization.a lib/liblldbInterpreter.a lib/liblldbSymbol.a lib/liblldbTarget.a lib/liblldbUtility.a lib/liblldbPluginDisassemblerLLVM.a lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a lib/libLLVMDebugInfoPDB.so lib/liblldbPluginSymbolFileSymtab.a lib/liblldbPluginDynamicLoaderStatic.a lib/liblldbPluginDynamicLoaderPosixDYLD.a lib/liblldbPluginDynamicLoaderHexagonDYLD.a lib/liblldbPluginDynamicLoaderWindowsDYLD.a lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginGoLanguage.a lib/liblldbPluginJavaLanguage.a lib/liblldbPluginObjCLanguage.a lib/liblldbPluginObjCPlusPlusLanguage.a lib/liblldbPluginObjectFileELF.a lib/liblldbPluginObjectFileJIT.a lib/liblldbPluginSymbolVendorELF.a lib/liblldbPluginObjectContainerBSDArchive.a lib/liblldbPluginObjectContainerMachOArchive.a lib/liblldbPluginProcessGDBRemote.a lib/liblldbPluginProcessUtility.a lib/liblldbPluginPlatformAndroid.a lib/liblldbPluginPlatformGDB.a lib/liblldbPluginPlatformFreeBSD.a lib/liblldbPluginPlatformKalimba.a lib/liblldbPluginPlatformLinux.a lib/liblldbPluginPlatformNetBSD.a lib/liblldbPluginPlatformPOSIX.a lib/liblldbPluginPlatformWindows.a lib/liblldbPluginPlatformMacOSX.a lib/liblldbPluginDynamicLoaderMacOSXDYLD.a lib/liblldbPluginUnwindAssemblyInstEmulation.a lib/liblldbPluginUnwindAssemblyX86.a lib/liblldbPluginAppleObjCRuntime.a lib/liblldbPluginRenderScriptRuntime.a lib/liblldbPluginLanguageRuntimeGo.a lib/liblldbPluginLanguageRuntimeJava.a lib/liblldbPluginCXXItaniumABI.a lib/liblldbPluginABIMacOSX_arm.a lib/liblldbPluginABIMacOSX_arm64.a lib/liblldbPluginABIMacOSX_i386.a lib/liblldbPluginABISysV_arm.a lib/liblldbPluginABISysV_arm64.a lib/liblldbPluginABISysV_i386.a lib/liblldbPluginABISysV_x86_64.a lib/liblldbPluginABISysV_hexagon.a lib/liblldbPluginABISysV_ppc.a lib/liblldbPluginABISysV_ppc64.a lib/liblldbPluginABISysV_mips.a lib/liblldbPluginABISysV_mips64.a lib/liblldbPluginABISysV_s390x.a lib/liblldbPluginInstructionARM.a lib/liblldbPluginInstructionARM64.a lib/liblldbPluginInstructionMIPS.a lib/liblldbPluginInstructionMIPS64.a lib/liblldbPluginObjectFilePECOFF.a lib/liblldbPluginOSGo.a lib/liblldbPluginOSPython.a lib/liblldbPluginMemoryHistoryASan.a lib/liblldbPluginInstrumentationRuntimeAddressSanitizer.a lib/liblldbPluginInstrumentationRuntimeThreadSanitizer.a lib/liblldbPluginSystemRuntimeMacOSX.a lib/liblldbPluginProcessElfCore.a lib/liblldbPluginJITLoaderGDB.a lib/liblldbPluginExpressionParserClang.a lib/liblldbPluginExpressionParserGo.a lib/liblldbPluginProcessFreeBSD.a lib/liblldbPluginProcessPOSIX.a -Wl,--end-group lib/libclangAnalysis.so lib/libclangAST.so lib/libclangBasic.so lib/libclangCodeGen.so lib/libclangDriver.so lib/libclangEdit.so lib/libclangFrontend.so lib/libclangLex.so lib/libclangParse.so lib/libclangRewrite.so lib/libclangRewriteFrontend.so lib/libclangSema.so lib/libclangSerialization.so -Wl,-rpath,"\$ORIGIN/../lib" -Wl,-rpath-link,/usr/ports/devel/llvm39/work/.build/lib && : /usr/bin/ld: undefined reference to symbol `_ZN4llvm25llvm_unreachable_internalEPKcS1_j' (try adding -lLLVMSupport) /usr/ports/devel/llvm39/work/.build/lib/libLLVMSupport.so: could not read symbols: Bad value c++: error: linker command failed with exit code 1 (use -v to see invocation) [3763/3818] Building CXX object tools/lldb/tools/lldb-mi/CMakeFiles/lldb-mi.dir/MICmdCmdMiscellanous.cpp.o ninja: build stopped: subcommand failed. ===> Compilation failed unexpectedly. Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to the maintainer. *** Error code 1 Stop. make[1]: stopped in /usr/ports/devel/llvm39 *** Error code 1 Stop. make: stopped in /usr/ports/devel/llvm39
llvm38 builds, but the libraries ends up in: /usr/local/llvm38/lib/clang/3.8.1/lib Not: /usr/local/llvm38/lib/clang/3.8.1/lib/freebsd Fixed by: # cd /usr/local/llvm38/lib/clang/3.8.1/lib # mkdir freebsd # mv *.* freebsd
Sorry, stupid mistake on my part. I made an intended change and an untended change whose diff I'd sent to someone else. Will fix shortly.
A commit references this bug: Author: brooks Date: Mon Aug 29 18:11:59 UTC 2016 New revision: 421085 URL: https://svnweb.freebsd.org/changeset/ports/421085 Log: Revert enabling of shared libraries in r420988. It was committed by mistake and did not work. PR: 208900 Changes: head/devel/llvm39/Makefile
A commit references this bug: Author: brooks Date: Tue Aug 30 21:04:31 UTC 2016 New revision: 421134 URL: https://svnweb.freebsd.org/changeset/ports/421134 Log: Actually install sanatizers in the right place. PR: 208900, 212252 Changes: head/devel/llvm38/Makefile head/devel/llvm39/Makefile
Should actually work now. I've tested build this time.