Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 448244

Summary: sys-devel/clang-3.2: error when using -fsanitize=undefined - /usr/bin/x86_64-pc-linux-gnu-ld: cannot find /usr/bin/../lib/clang/3.2/lib/linux/libclang_rt.ubsan-x86_64.a: No such file or directory
Product: Gentoo Linux Reporter: Bartosz Brachaczek <b.brachaczek>
Component: [OLD] DevelopmentAssignee: Bernard Cafarelli <voyageur>
Status: RESOLVED FIXED    
Severity: normal CC: mgorny, ninuje, ryao
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: http://bugs.debian.org/697199
Whiteboard:
Package list:
Runtime testing required: ---

Description Bartosz Brachaczek 2012-12-23 00:55:38 UTC
$ echo "int main(){}" | clang -x c -fsanitize=undefined -
/usr/bin/x86_64-pc-linux-gnu-ld: cannot find /usr/bin/../lib/clang/3.2/lib/linux/libclang_rt.ubsan-x86_64.a: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Without -fsanitize=undefined it works. It used to work with clang-3.1, athough with the now-deprecated argument -fcatch-undefined-behavior, which is equivalent to the new -fsanitize=undefined. And yes, -fcatch-undefined-behavior with clang-3.2 fails.

$ emerge --info
Portage 2.1.11.38 (default/linux/amd64/10.0/desktop/kde, gcc-4.6.3, glibc-2.16.0, 3.7.1-gentoo x86_64)
=================================================================
System uname: Linux-3.7.1-gentoo-x86_64-Intel-R-_Core-TM-_i3-2310M_CPU_@_2.10GHz-with-gentoo-2.2
Timestamp of tree: Sat, 22 Dec 2012 00:45:01 +0000
ld GNU ld (GNU Binutils) 2.23.1
ccache version 3.1.8 [disabled]
app-shells/bash:          4.2_p39-r1
dev-java/java-config:     2.1.12-r1
dev-lang/python:          2.7.3-r3, 3.2.3-r2
dev-util/ccache:          3.1.8
dev-util/cmake:           2.8.10.2
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.6
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.11.6, 1.12.6
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.6.3, 4.7.2
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.7 (virtual/os-headers)
sys-libs/glibc:           2.16.0
Repositories: gentoo local roslin qt x11
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -ftracer -fno-omit-frame-pointer -g -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/polkit-1/actions /usr/share/themes/oxygen-gtk/gtk-2.0 /usr/share/themes/oxygen-gtk/gtk-3.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=native -ftracer -fno-omit-frame-pointer -g -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build=n"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync metadata-transfer news parallel-fetch protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS=" http://gentoo.mirror.pw.edu.pl http://www.ibiblio.org/pub/Linux/distributions/gentoo http://distfiles.gentoo.org"
LANG="pl_PL.utf8"
LC_ALL="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--sort-common"
MAKEOPTS="-j4"
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="/usr/local/portage /var/lib/layman/roslin /var/lib/layman/qt /var/lib/layman/x11"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 aac acpi akonadi alsa amd64 avahi avx bash-completion berkdb bluetooth bluray branding bzip2 cairo cdda cdr cli consolekit crypt cups cxx dbus declarative development dri dts dvd dvdr egl emboss encode exif fam ffmpeg fftw firefox flac fontconfig fortran gdbm gif git glib gmp gpm gstreamer iconv icu idn ios ipod ipv6 javascript jpeg jpeg2k kde kipi lame lcms libnotify lzma lzo mad mercurial mmap mmx mng modules mp3 mp4 mpeg mudflap multilib ncurses networkmanager nls nptl ogg openexr opengl openmp otr pam pango pch pcre pdf phonon plasma png policykit ppds pppd private-headers pulseaudio qt3support qt4 quicktime readline samba schroedinger sdl semantic-desktop session smp sndfile spell sse sse2 sse3 sse4 sse4_1 sse4_2 ssl ssse3 startup-notification subversion svg tcpd theora threads threadsafe tiff truetype udev udisks unicode upnp upnp-av upower usb v4l vaapi vcd vim-syntax vorbis vpx wifi wmf wxwidgets x264 xcb xcomposite xml xscreensaver xv xvid zeroconf zlib" ALSA_CARDS="hda-intel" 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="authn_core authz_core socache_shmcb unixd 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="glibc" FOO2ZJS_DEVICES="hp1020" 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="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="pl_PL pl en_US en" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby19" USERLAND="GNU" VIDEO_CARDS="i965 intel" 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, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

$ emerge -pvO llvm clang

These are the packages that would be merged, in order:

[ebuild   R    ] sys-devel/llvm-3.2  USE="gold libffi vim-syntax -debug -doc -multitarget -ocaml {-test} -udis86" 0 kB
[ebuild   R    ] sys-devel/clang-3.2  USE="static-analyzer -debug -multitarget {-test}" 0 kB

Total: 2 packages (2 reinstalls), Size of downloads: 0 kB
Comment 1 Bernard Cafarelli gentoo-dev 2013-01-21 13:10:55 UTC
Thanks for the report!

The consensus in other distros seems to point our autotools install as the cause (this missing library only comes with cmake)...

I'll see what I can convert to a cmake-base ebuild and what we will loose compared to the current autotools system, as we are getting more and more reports that can only easily be solved by switching to cmake

Hmm, the "See also" column does not accept Arch bugs, so putting the link here: https://bugs.archlinux.org/task/33208
Comment 2 Bernard Cafarelli gentoo-dev 2013-06-13 21:41:51 UTC
The autotools build system was fixed upstream and 3.3 will install the file correctly.

I tested with masked 3.3_rc3 ebuild and -fsanitize=undefined option now works