Bug 1303766 - GCC missing libasan and libubsan after installing gcc and gcc-c++
Summary: GCC missing libasan and libubsan after installing gcc and gcc-c++
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 23
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-02-01 21:58 UTC by Jeffrey Walton
Modified: 2016-02-01 22:02 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-02-01 22:02:37 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.