[Still true of -r335385. But, based on a build of devel/llvm60 supplying the XCC/XCXX/XCPP, FreeBSD can be built, including the clang compiler. The problem is FreeBSD system-clang-building specific, not general to llvm targeting powerp64.]
On 2018-Jun-11, at 12:58 PM, Mark Millard <marklmi at yahoo.com> wrote: > On 2018-Jun-11, at 6:37 AM, Mark Millard <marklmi at yahoo.com> wrote: > >> [Note: I sometimes build for powerpc families via clang >> as part of identifying what is not yet working. Currently >> I do not have access to any powerpc system so I only build. >> This involves using devel/powerpc-binutils currently.] >> >> Despite for head -r334932: >> >> # find /usr/src/* -name altivec.h -print >> /usr/src/contrib/llvm/tools/clang/lib/Headers/altivec.h >> /usr/src/contrib/gcc/config/rs6000/altivec.h >> /usr/src/sys/powerpc/include/altivec.h > > I should have noted someplace that the correct binding for the context > is for Lex/Lexer.cpp to find: > > /usr/src/contrib/llvm/tools/clang/lib/Headers/altivec.h > > and not one of the FreeBSD headers. (Very different content.) > >> and: >> >> # find /usr/obj/powerpc64vtsc_clang_altbinutils -name altivec.h -print >> /usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/usr/include/machine/altivec.h >> /usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/usr/lib/clang/6.0.0/include/altivec.h >> /usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/obj-lib32/tmp/usr/include/machine/altivec.h >> >> and: >> >> # find /usr/local -name altivec.h -print >> /usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.4.0/include/altivec.h >> /usr/local/llvm50/lib/clang/5.0.0/include/altivec.h >> /usr/local/llvm60/lib/clang/6.0.0/include/altivec.h >> >> and use of clang/clang++: >> >> # c++ --version >> FreeBSD clang version 6.0.0 (tags/RELEASE_600/final 326565) (based on LLVM >> 6.0.0) >> Target: x86_64-unknown-freebsd12.0 >> Thread model: posix >> InstalledDir: /usr/bin >> >> my attempt to amd64 -> powerpc64 cross build (-j4) got: >> >> . . . >> Building >> /usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/lib/clang/libclang/Lex/Lexer.o >> Building >> /usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/lib/clang/libclang/Lex/LiteralSupport.o >> --- Lex/Lexer.o --- >> /usr/src/contrib/llvm/tools/clang/lib/Lex/Lexer.cpp:2401:10: fatal error: >> 'altivec.h' file not found >> #include <altivec.h> >> ^~~~~~~~~~~ >> 1 error generated. >> *** [Lex/Lexer.o] Error code 1 >> >> make[6]: stopped in /usr/src/lib/clang/libclang >> .ERROR_TARGET='Lex/Lexer.o' >> .ERROR_META_FILE='/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/lib/clang/libclang/Lex_Lexer.o.meta' >> .MAKE.LEVEL='6' >> MAKEFILE='' >> .MAKE.MODE='meta missing-filemon=yes missing-meta=yes silent=yes verbose' >> _ERROR_CMD='c++ -target powerpc64-unknown-freebsd12.0 >> --sysroot=/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp >> -B/usr/local/powerpc64-unknown-freebsd12.0/bin/ -O2 -pipe >> -I/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/lib/clang/libclang >> >> -I/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/lib/clang/libllvm >> -I/usr/src/contrib/llvm/tools/clang/lib/Basic >> -I/usr/src/contrib/llvm/tools/clang/lib/Driver >> -I/usr/src/contrib/llvm/tools/clang/include -DCLANG_ENABLE_ARCMT >> -DCLANG_ENABLE_STATIC_ANALYZER -I/usr/src/lib/clang/include >> -I/usr/src/contrib/llvm/include -DLLVM_BUILD_GLOBAL_ISEL >> -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS >> -DLLVM_DEFAULT_TARGET_TRIPLE=\"powerpc64-unknown-freebsd12.0\" >> -DLLVM_HOST_TRIPLE=\"powerpc64-unknown-freebsd12.0\" -DDEFAULT_SYSROOT=\"\" >> -ffunction-sections -fdata-sections -gline-tables-only >> -fstack-protector-strong -Qunused-arguments -std=c++11 -fno-exceptions -fno-rtti -gline-tables-only -stdlib=libc++ -Wno-c++11-extensions -c /usr/src/contrib/llvm/tools/clang/lib/Lex/Lexer.cpp -o Lex/Lexer.o;' >> .CURDIR='/usr/src/lib/clang/libclang' >> .MAKE='make' >> .OBJDIR='/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/lib/clang/libclang' >> .TARGETS='all' >> DESTDIR='/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp' >> LD_LIBRARY_PATH='' >> MACHINE='powerpc' >> MACHINE_ARCH='powerpc64' >> MAKEOBJDIRPREFIX='' >> MAKESYSPATH='/usr/src/share/mk' >> MAKE_VERSION='20180512' >> PATH='/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/legacy/usr/sbin:/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/legacy/usr/bin:/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/legacy/bin:/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/usr/sbin:/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin' >> SRCTOP='/usr/src' >> OBJTOP='/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64' >> .MAKE.MAKEFILES='/usr/src/share/mk/sys.mk /usr/src/share/mk/local.sys.env.mk >> /usr/src/share/mk/src.sys.env.mk >> /root/src.configs/src.conf.powerpc64-clang_altbinutils-bootstrap.amd64-host >> /usr/src/share/mk/bsd.mkopt.mk /usr/src/share/mk/src.sys.obj.mk >> /usr/src/share/mk/auto.obj.mk /usr/src/share/mk/bsd.suffixes.mk >> /root/src.configs/make.conf /usr/src/share/mk/local.sys.mk >> /usr/src/share/mk/src.sys.mk /dev/null /usr/src/lib/clang/libclang/Makefile >> /usr/src/share/mk/src.opts.mk /usr/src/share/mk/bsd.own.mk >> /usr/src/share/mk/bsd.opts.mk /usr/src/share/mk/bsd.cpu.mk >> /usr/src/share/mk/bsd.compiler.mk /usr/src/share/mk/bsd.linker.mk >> /usr/src/lib/clang/clang.pre.mk /usr/src/lib/clang/llvm.pre.mk >> /usr/src/lib/clang/clang.build.mk /usr/src/lib/clang/llvm.build.mk >> /usr/src/share/mk/bsd.lib.mk /usr/src/share/mk/bsd.init.mk >> /usr/src/share/mk/local.init.mk /usr/src/share/mk/src.init.mk >> /usr/src/lib/clang/libclang/../Makefile.inc >> /usr/src/share/mk/bsd.libnames.mk /usr/src/share/mk/src.libnames.mk /usr/src/share/mk/bsd.symver.mk /usr/src/share/mk/bsd.nls.mk /usr/src/share/mk/bsd.files.mk /usr/src/share/mk/bsd.incs.mk /usr/src/share/mk/bsd.confs.mk /usr/src/share/mk/bsd.links.mk /usr/src/share/mk/bsd.dep.mk /usr/src/share/mk/bsd.clang-analyze.mk /usr/src/share/mk/bsd.obj.mk /usr/src/share/mk/bsd.subdir.mk /usr/src/share/mk/bsd.sys.mk' >> .PATH='. /usr/src/lib/clang/libclang /usr/src/contrib/llvm/tools/clang/lib' >> 1 error >> >> >> I'll note that the -I's for include/'s: >> >> -I/usr/src/contrib/llvm/tools/clang/include >> -I/usr/src/lib/clang/include >> -I/usr/src/contrib/llvm/include > > So: > > /usr/src/contrib/llvm/tools/clang/lib/Headers > > is missing and is where altivec.h should be found for > the include in Lex/Lexer.cpp . > > It is too bad that the altivec.h naming matches between > clang-internal headers and FreeBSD headers, making > correct selection messier to deal with. > > The code in Lx/Lexer.cpp looks like: > > #ifdef __SSE2__ > #include <emmintrin.h> > #elif __ALTIVEC__ > #include <altivec.h> > #undef bool > #endif > > >> do not seem to match up with any of: >> >> /usr/src/contrib/llvm/tools/clang/lib/Headers/ >> /usr/src/sys/powerpc/include/ >> /usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/usr/include/machine/altivec.h >> /usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/usr/lib/clang/6.0.0/include/altivec.h >> /usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc.powerpc64/obj-lib32/tmp/usr/include/machine/altivec.h >> >> >> For reference: >> >> # more >> ~/src.configs/src.conf.powerpc64-clang_altbinutils-bootstrap.amd64-host >> TO_TYPE=powerpc64 >> TOOLS_TO_TYPE=${TO_TYPE} >> VERSION_CONTEXT=12.0 >> # >> KERNCONF=GENERIC64vtsc-NODBG >> TARGET=powerpc >> .if ${.MAKE.LEVEL} == 0 >> TARGET_ARCH=${TO_TYPE} >> .export TARGET_ARCH >> .endif >> # >> WITH_CROSS_COMPILER= >> WITHOUT_SYSTEM_COMPILER= >> # >> WITH_LIBCPLUSPLUS= >> WITHOUT_BINUTILS_BOOTSTRAP= >> WITH_ELFTOOLCHAIN_BOOTSTRAP= >> WITH_CLANG_BOOTSTRAP= >> WITH_CLANG= >> #WITH_CLANG_IS_CC= >> WITH_CLANG_FULL= >> WITH_CLANG_EXTRAS= >> WITHOUT_LLD_BOOTSTRAP= >> WITH_LLD= >> WITHOUT_LLD_IS_LD= >> WITH_LLDB= >> # >> WITH_BOOT= >> # avoid lang/gcc7 and the like attempting >> # lib32 (-m32) support that does not work. >> # (Register usage mismatch?) >> WITHOUT_LIB32= >> # >> WITHOUT_CLANG_IS_CC= >> WITHOUT_BINUTILS= >> WITHOUT_GCC_BOOTSTRAP= >> WITHOUT_GCC= >> WITHOUT_GCC_IS_CC= >> WITHOUT_GNUCXX= >> # >> NO_WERROR= >> MALLOC_PRODUCTION= >> # >> # Avoid converts between pointers to integer types with different sign >> [-Werror,-Wpointer-sign] >> # and such from blocking the build. >> WERROR= >> # >> WITH_REPRODUCIBLE_BUILD= >> WITH_DEBUG_FILES= >> # >> # >> # For TO (so-called "cross") stages . . . >> # So-called-cross via ${TO_TYPE}-xtoolchain-gcc/${TO_TYPE}-gcc. . . >> # TOOLS_TO_TYPE based on ${TO_TYPE}-xtoolchain-gcc related binutils. . . >> # >> CROSS_BINUTILS_PREFIX=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/ >> .if ${.MAKE.LEVEL} == 0 >> # >> # Note: The WITH_CROSS_COMPILER picks up the CROSS_BINUTILS_PREFIX >> # binding automatically. >> # >> XAS=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/as >> XAR=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/ar >> XNM=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/nm >> XOBJCOPY=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/objcopy >> XOBJDUMP=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/objdump >> XRANLIB=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/ranlib >> XSIZE=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/size >> #NO-SUCH: >> XSTRINGS=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/strings >> XSTRINGS=/usr/local/bin/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}-strings >> .export XAS >> .export XAR >> .export XNM >> .export XOBJCOPY >> .export XOBJDUMP >> .export XRANLIB >> .export XSIZE >> .export XSTRINGS >> XLD=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/ld >> .export XLD >> .endif >> >> # more ~/src.configs/make.conf >> CFLAGS.gcc+= -v >> >> # more >> ~/sys_build_scripts.amd64-host/make_powerpc64vtsc_nodebug_clang_altbinutils-amd64-host.sh >> >> kldload -n filemon && \ >> script >> ~/sys_typescripts/typescript_make_powerpc64vtsc_nodebug_clang_altbinutils-amd64-host-$(date >> +%Y-%m-%d:%H:%M:%S) \ >> env __MAKE_CONF="/root/src.configs/make.conf" SRCCONF="/dev/null" >> SRC_ENV_CONF="/root/src.configs/src.conf.powerpc64-clang_altbinutils-bootstrap.amd64-host" >> \ >> WITH_META_MODE=yes \ >> MAKEOBJDIRPREFIX="/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64" >> \ >> make $* >> For head -r335385 I tried again and got the same problem. Then I tried a variation to using devel/xtoolchain-llvm60 that instead used devel/powerpc64-binutils . This built. (I'm not claiming that the resultant build has no problems of note. Likely I'm not going to have access to any powerpc variant for at least a few months.) So the problem is not with using llvm60 as such, but with FreeBSD's build environment's handling of things for the system clang (V6.0). The devel/xtoolchain-llvm60 variation was based on using: # more /usr/local/share/toolchains/llvm60_altbinutils.mk XCC=/usr/local/bin/clang60 XCXX=/usr/local/bin/clang++60 XCPP=/usr/local/bin/clang-cpp60 #XLD=/usr/local/llvm60/bin/ld.lld #CROSS_BINUTILS_PREFIX=/var/empty X_COMPILER_TYPE=clang that thereby allowed me to use devel/powerpc64-binutils via: # more ~/src.configs/src.conf.powerpc64-xtoolchain-llvm.amd64-host TO_TYPE=powerpc64 TOOLS_TO_TYPE=${TO_TYPE} VERSION_CONTEXT=12.0 # KERNCONF=GENERIC64vtsc-NODBG TARGET=powerpc .if ${.MAKE.LEVEL} == 0 TARGET_ARCH=${TO_TYPE} .export TARGET_ARCH .endif # WITHOUT_CROSS_COMPILER= WITHOUT_SYSTEM_COMPILER= # WITH_LIBCPLUSPLUS= WITHOUT_BINUTILS_BOOTSTRAP= WITHOUT_ELFTOOLCHAIN_BOOTSTRAP= WITHOUT_CLANG_BOOTSTRAP= WITH_CLANG= WITH_CLANG_IS_CC= WITH_CLANG_FULL= WITH_CLANG_EXTRAS= WITHOUT_LLD_BOOTSTRAP= WITH_LLD= WITHOUT_LLD_IS_LD= WITH_LLDB= # WITH_BOOT= #WITH_LIB32= WITHOUT_LIB32= # WITHOUT_BINUTILS= WITHOUT_GCC_BOOTSTRAP= WITHOUT_GCC= WITHOUT_GCC_IS_CC= WITHOUT_GNUCXX= # NO_WERROR= # # Avoid build aborting for the likes of: # /usr/src/sys/sys/sglist.h:81:19: error: # passing 'int *' to parameter of type 'volatile u_int *' # (aka 'volatile unsigned int *') converts between # pointers to integer types with different sign # [-Werror,-Wpointer-sign] # WERROR= MALLOC_PRODUCTION= # WITH_REPRODUCIBLE_BUILD= WITH_DEBUG_FILES= # # # For TO (so-called "cross") stages . . . # TOOLS_TO_TYPE based on ${TO_TYPE}-xtoolchain-gcc related binutils. . . # CROSS_TOOLCHAIN=llvm60_altbinutils #X_COMPILER_TYPE=clang CROSS_BINUTILS_PREFIX=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin .if ${.MAKE.LEVEL} == 0 XCC=/usr/local/bin/clang60 XCXX=/usr/local/bin/clang++60 XCPP=/usr/local/bin/clang-cpp60 .export XCC .export XCXX .export XCPP XAS=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/as XAR=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/ar XLD=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/ld XNM=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/nm XOBJCOPY=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/objcopy XOBJDUMP=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/objdump XRANLIB=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/ranlib XSIZE=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/size #NO-SUCH: XSTRINGS=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/strings XSTRINGS=/usr/local/bin/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}-strings .export XAS .export XAR .export XLD .export XNM .export XOBJCOPY .export XOBJDUMP .export XRANLIB .export XSIZE .export XSTRINGS .endif # # # From based on clang (via system). . . # .if ${.MAKE.LEVEL} == 0 CC=/usr/bin/clang CXX=/usr/bin/clang++ CPP=/usr/bin/clang-cpp .export CC .export CXX .export CPP .endif and: # more ~/sys_build_scripts.amd64-host/make_powerpc64vtsc_nodebug_incl_clang_xtoolchain-llvm-amd64-host.sh kldload -n filemon && \ script ~/sys_typescripts/typescript_make_powerpc64vtsc_nodebug_incl_clang_xtoolchain-llvm-amd64-host-$(date +%Y-%m-%d:%H:%M:%S) \ env __MAKE_CONF="/root/src.configs/make.conf" SRCCONF="/dev/null" SRC_ENV_CONF="/root/src.configs/src.conf.powerpc64-xtoolchain-llvm.amd64-host" \ WITH_META_MODE=yes \ MAKEOBJDIRPREFIX="/usr/obj/powerpc64vtsc_xtoolchain-llvm/powerpc.powerpc64" \ make $* and: # more ~/src.configs/make.conf CFLAGS.gcc+= -v === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) _______________________________________________ freebsd-toolchain@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"