Bug 1303766

Summary: GCC missing libasan and libubsan after installing gcc and gcc-c++
Product: [Fedora] Fedora Reporter: Jeffrey Walton <noloader>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 23CC: davejohansen, jakub, jwakely, law, mpolacek
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-01 22:02:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jeffrey Walton 2016-02-01 21:58:26 UTC
It appears libasan and libubsan are missing after installing gcc and gcc-c++.

g++ -o cryptest.exe -DDEBUG -g2 -O1 -std=c++03  -Wno-deprecated-declarations -fPIC -march=native -pipe -fsanitize=address -fno-omit-frame-pointer bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o ./libcryptopp.a -pthread 
/bin/ld: cannot find /usr/lib64/libasan.so.2.0.0
collect2: error: ld returned 1 exit status
make: *** [cryptest.exe] Error 1

And:

g++ -o cryptest.exe -DNDEBUG -g2 -O2 -std=c++11  -Wno-deprecated-declarations -fPIC -march=native -pipe -fsanitize=undefined -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o ./libcryptopp.a -pthread 
/bin/ld: cannot find /usr/lib64/libubsan.so.0.0.0
collect2: error: ld returned 1 exit status
make: *** [cryptest.exe] Error 1

*****

It seems GCC unconditionally advertises Asan and UBsan support, even if the binaries are not installed. For example, here is our test to determine if we should perform the actual Asan and UBsan test runs. Both of the tests returned success.

# Set to 0 if you don't have UBsan
$CXX -x c++ -fsanitize=undefined adhoc.cpp.proto -c -o $TMP/adhoc > /dev/null 2>&1
if [ "$?" -eq "0" ] && [ "$IS_X86" -ne "0" ]; then
	HAVE_UBSAN=1
else
	HAVE_UBSAN=0
fi

# Set to 0 if you don't have Asan
$CXX -x c++ -fsanitize=address adhoc.cpp.proto -c -o $TMP/adhoc > /dev/null 2>&1
if [ "$?" -eq "0" ] && [ "$IS_X86" -ne "0" ]; then
	HAVE_ASAN=1
else
	HAVE_ASAN=0
fi

*****

The fix is simple, but it makes me wonder why they are not installed in the first place.

$ sudo dnf install libasan libubsan
[sudo] password for jwalton: 
Last metadata expiration check performed 0:13:31 ago on Mon Feb  1 16:39:39 2016.
Dependencies resolved.
================================================================================
 Package           Arch            Version               Repository        Size
================================================================================
Installing:
 libasan           x86_64          5.3.1-2.fc23          updates          297 k
 libubsan          x86_64          5.3.1-2.fc23          updates          129 k

Transaction Summary
================================================================================
Install  2 Packages

Total download size: 425 k
Installed size: 1.2 M

*****

$ dnf info gcc
Last metadata expiration check performed 0:01:59 ago on Mon Feb  1 16:55:50 2016.
Installed Packages
Name        : gcc
Arch        : x86_64
Epoch       : 0
Version     : 5.3.1
Release     : 2.fc23
Size        : 46 M
Repo        : @System
From repo   : updates
Summary     : Various compilers (C, C++, Objective-C, Java, ...)
URL         : http://gcc.gnu.org
License     : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and
            : LGPLv2+ and BSD
Description : The gcc package contains the GNU Compiler Collection version 5.
            : You'll need this package in order to compile C code.

$ dnf info gcc-c++
Last metadata expiration check performed 0:00:37 ago on Mon Feb  1 16:55:50 2016.
Installed Packages
Name        : gcc-c++
Arch        : x86_64
Epoch       : 0
Version     : 5.3.1
Release     : 2.fc23
Size        : 24 M
Repo        : @System
From repo   : updates
Summary     : C++ support for GCC
URL         : http://gcc.gnu.org
License     : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and
            : LGPLv2+ and BSD
Description : This package adds C++ support to the GNU Compiler Collection.
            : It includes support for most of the current C++ specification,
            : including templates and exception handling.

Available Packages
Name        : gcc-c++
Arch        : i686
Epoch       : 0
Version     : 5.3.1
Release     : 2.fc23
Size        : 9.4 M
Repo        : updates
Summary     : C++ support for GCC
URL         : http://gcc.gnu.org
License     : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and
            : LGPLv2+ and BSD
Description : This package adds C++ support to the GNU Compiler Collection.
            : It includes support for most of the current C++ specification,
            : including templates and exception handling.

fedora23-x64q:cryptopp$

Comment 1 Jakub Jelinek 2016-02-01 22:02:37 UTC
This is intentional.  If you want to use those, just install the lib* packages, if gcc required the, you'd force them upon everybody, but most of the people are not going to use them.