Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 417171 - sys-devel/clang installs headers that conflict with system headers on Gentoo FreeBSD
Summary: sys-devel/clang installs headers that conflict with system headers on Gentoo ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: FreeBSD (show other bugs)
Hardware: All FreeBSD
: Normal normal (vote)
Assignee: Bernard Cafarelli
URL:
Whiteboard:
Keywords: Bug
Depends on:
Blocks: systemwide-clang
  Show dependency tree
 
Reported: 2012-05-22 20:46 UTC by Richard Yao (RETIRED)
Modified: 2016-02-08 21:22 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
sys-freebsd/freebsd-ubin-9.0-r1 build failure (build.log,8.11 KB, text/plain)
2012-05-22 20:46 UTC, Richard Yao (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Yao (RETIRED) gentoo-dev 2012-05-22 20:46:34 UTC
Created attachment 312757 [details]
sys-freebsd/freebsd-ubin-9.0-r1 build failure

This causes several build failures on Gentoo FreeBSD, most being in @system components. Attached is the failure log for sys-freebsd/freebsd-ubin-9.0-r1, which is more succinct than the other failures.

# emerge --info
Portage 2.2.0_alpha107 (default/bsd/fbsd/amd64/9.0, gcc-4.4.7, freebsd-lib-9.0-r2, 9.0-Gentoo amd64)
=================================================================
System uname: FreeBSD-9.0-Gentoo-amd64-64bit-ELF
Timestamp of tree: Sun, 20 May 2012 21:00:01 +0000
app-shells/bash:         4.2_p28
dev-lang/python:         2.7.3-r2
sys-apps/baselayout:     2.1-r1
sys-apps/openrc:         0.9.9.3
sys-devel/autoconf:      2.69
sys-devel/automake:      1.9.6-r3, 1.11.5
sys-devel/binutils:      2.20.1-r1
sys-devel/gcc:           4.4.7, 4.5.3-r2, 4.6.3
sys-devel/gcc-config:    1.7.1
sys-devel/libtool:       2.4.2
sys-devel/make:          3.82-r3
sys-freebsd/freebsd-lib: 9.0-r2 (virtual/os-headers)
Repositories: gentoo zfs local_overlay
Installed sets: 
ACCEPT_KEYWORDS="amd64-fbsd ~amd64-fbsd"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-gentoo-freebsd9.0"
CFLAGS="-O2 -pipe -march=amdfam10 -mtune=amdfam10 -ggdb3"
CHOST="x86_64-gentoo-freebsd9.0"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=amdfam10 -mtune=amdfam10 -ggdb3"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs chflags config-protect-if-modified distlocks ebuild-locks fixlafiles news noinfo parallel-fetch parallel-install parse-eapi-ebuild-head preserve-libs protect-owned sfperms split-log splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--sort-common"
MAKEOPTS="-j7"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/zfs /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="acl amd64-fbsd berkdb cracklib crypt cups cxx dri gdbm iconv ipv6 java5 java6 mmx modules multilib ncurses nls oss pcre readline sse sse2 ssl tcpd unicode xorg zfs zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="FreeBSD" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse" KERNEL="FreeBSD" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_TARGETS="python2_7" RUBY_TARGETS="ruby18" USERLAND="BSD" VIDEO_CARDS="apm ark chips cirrus cyrix dummy i128 intel mach64 mga neomagic nv r128 radeon rendition s3 s3virge savage siliconmotion sis tga trident tseng fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Richard Yao (RETIRED) gentoo-dev 2012-05-22 23:11:47 UTC
Doing `rm /usr/lib/clang/3.0/include/{std,float,iso,limits,tgmath,varargs}*.h` makes this problem disappear.

It seems that FreeBSD's build system does not install those headers. Also, FreeBSD's build system installs them in /usr/include/clang/3.0 instead of /usr/lib/clang/3.0/include. It might be a good idea to mimic both behaviors.
Comment 2 Richard Yao (RETIRED) gentoo-dev 2012-05-22 23:20:42 UTC
FreeBSD has a Makefile responsible for installing these in /usr/src/lib/clang/include/Makefile that contains:

# $FreeBSD$

.PATH: ${.CURDIR}/../../../contrib/llvm/tools/clang/lib/Headers

INCSDIR=${INCLUDEDIR}/clang/3.0

INCS=   altivec.h \
        avxintrin.h \
        emmintrin.h \
        immintrin.h \
        mm3dnow.h \
        mm_malloc.h \
        mmintrin.h \
        nmmintrin.h \
        pmmintrin.h \
        smmintrin.h \
        tmmintrin.h \
        wmmintrin.h \
        x86intrin.h \
        xmmintrin.h

.include <bsd.init.mk>
.include <bsd.incs.mk>
.include <bsd.obj.mk>

It appears that moving those files into /usr/include/clang/3.0 and removing the remainder works on Gentoo FreeBSD. Given that these are includes, it might make sense to use the /usr/include/clang/3.0 location for these on both FreeBSD and Linux.
Comment 3 Bernard Cafarelli gentoo-dev 2012-05-24 11:35:45 UTC
Headers in /lib should indeed be moved, though I'm pretty sure at least some include files went in the correct /usr/include/clang. So we have to fix the buildsystem to stop installing headers all around the system :)
Comment 4 Richard Yao (RETIRED) gentoo-dev 2012-05-24 13:18:42 UTC
I have committed a fix for this in sys-devel/clang-3.0-r4. sys-devel/clang-3.1 is unaffected.

I have left the header locations alone, but their locations are not of vital importance, so I consider this issue to be resolved.
Comment 5 Richard Yao (RETIRED) gentoo-dev 2012-05-26 07:57:54 UTC
(In reply to comment #4)
> I have committed a fix for this in sys-devel/clang-3.0-r4.
> sys-devel/clang-3.1 is unaffected.
> 
> I have left the header locations alone, but their locations are not of vital
> importance, so I consider this issue to be resolved.

Correction. sys-devel/clang-3.1 was affected to a lesser extent. This is now fixed in sys-devel/clang-3.1-r2.
Comment 6 Yuta SATOH 2016-02-08 12:22:50 UTC
When using llvm-3.7.1, fails to build sys-freebsd/boot0-10.2.
I opened PR to fix this problem on github.

https://github.com/gentoo/gentoo/pull/817


clang  -O2 -pipe -fno-strict-aliasing   -ffreestanding -Wformat -fPIC -I/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libstand -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -DBZ_NO_STDIO -DBZ_NO_COMPRESS -DHAVE_MEMCPY -I/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libz -std=gnu99 -Qunused-arguments  -fno-stack-protector -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses  -c /var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libc/string/strcpy.c -o strcpy.o
clang  -O2 -pipe -fno-strict-aliasing   -ffreestanding -Wformat -fPIC -I/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libstand -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -DBZ_NO_STDIO -DBZ_NO_COMPRESS -DHAVE_MEMCPY -I/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libz -std=gnu99 -Qunused-arguments  -fno-stack-protector -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses  -c /var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libc/string/strcspn.c -o strcspn.o
/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libc/string/strcspn.c:46:31: error: use of undeclared identifier 'LONG_BIT'
        u_long tbl[(UCHAR_MAX + 1) / LONG_BIT];
                                     ^
/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libc/string/strcspn.c:60:9: error: use of undeclared identifier 'LONG_BIT'
                idx = IDX(*charset);
                      ^
/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libc/string/strcspn.c:34:31: note: expanded from macro 'IDX'
#define IDX(c)  ((u_char)(c) / LONG_BIT)
                               ^
/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libc/string/strcspn.c:61:9: error: use of undeclared identifier 'LONG_BIT'
                bit = BIT(*charset);
                      ^
/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libc/string/strcspn.c:35:45: note: expanded from macro 'BIT'
#define BIT(c)  ((u_long)1 << ((u_char)(c) % LONG_BIT))
                                             ^
/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libc/string/strcspn.c:66:9: error: use of undeclared identifier 'LONG_BIT'
                idx = IDX(*s1);
                      ^
/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libc/string/strcspn.c:34:31: note: expanded from macro 'IDX'
#define IDX(c)  ((u_char)(c) / LONG_BIT)
                               ^
/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libc/string/strcspn.c:67:9: error: use of undeclared identifier 'LONG_BIT'
                bit = BIT(*s1);
                      ^
/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand/../../../../lib/libc/string/strcspn.c:35:45: note: expanded from macro 'BIT'
#define BIT(c)  ((u_long)1 << ((u_char)(c) % LONG_BIT))
                                             ^
5 errors generated.
*** [strcspn.o] Error code 1

make: stopped in /var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand
1 error

make: stopped in /var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand
 * ERROR: sys-freebsd/boot0-10.2::gentoo failed (compile phase):
 *   make failed
 *
 * Call stack:
 *     ebuild.sh, line  133:  Called src_compile
 *   environment, line 2694:  Called freebsd_src_compile
 *   environment, line 1239:  Called bsdmk_src_compile
 *   environment, line  519:  Called die
 * The specific snippet of code:
 *       mkmake "$@" || die "make failed"
 *
 * If you need support, post the output of `emerge --info '=sys-freebsd/boot0-10.2::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-freebsd/boot0-10.2::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/sys-freebsd/boot0-10.2/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-freebsd/boot0-10.2/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot/userboot/libstand'
 * S: '/var/tmp/portage/sys-freebsd/boot0-10.2/work/sys/boot'
Comment 7 Patrice Clement gentoo-dev 2016-02-08 21:22:31 UTC
commit 396cde2 (HEAD, master)
Merge: 43979f1 7e93332
Author: Patrice Clement <monsieurp@gentoo.org>
Date:   Mon Feb 8 21:19:56 2016 +0000

    Merge remote-tracking branch 'github/pr/817'.
    
    Gentoo-Bug: 417171
    Pull-Request: https://github.com/gentoo/gentoo/pull/817