FS#63651 - [gcc8] gcc8 has incorrect paths? stdc++fs not found when gcc is not installed
Attached to Project:
Community Packages
Opened by Mateusz Szychowski (muttley) - Wednesday, 04 September 2019, 09:57 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Monday, 23 September 2019, 11:22 GMT
Opened by Mateusz Szychowski (muttley) - Wednesday, 04 September 2019, 09:57 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Monday, 23 September 2019, 11:22 GMT
|
Details
Description:
When trying to build simple C++ program using stdc++fs, ld will say '/usr/sbin/ld: cannot find -lstdc++fs'. This happens when 'gcc' is not installed (only gcc8, gcc8-libs and gcc-libs are installed) Additional info: $ pacman -Qi gcc8 gcc8-libs | grep -i version Version : 8.3.0-2 Version : 8.3.0-2 Steps to reproduce: docker run --rm -it archlinux/base:latest bash pacman -Sy git gcc8 git clone https://github.com/muttleyxd/gcc_8_arch_issue.git cd gcc_8_arch_issue ./error.sh If 'gcc' is not installed: $ ./error.sh + g++-8 -g2 -O0 -std=c++17 -c main.cpp -o main.o + g++-8 main.o -o main -lstdc++fs /usr/sbin/ld: cannot find -lstdc++fs collect2: error: ld returned 1 exit status + set +x If 'gcc' is installed: $ ./error.sh + g++-8 -g2 -O0 -std=c++17 -c main.cpp -o main.o + g++-8 main.o -o main -lstdc++fs /usr/sbin/ld: main.o: in function `std::filesystem::__cxx11::operator==(std::filesystem::__cxx11::path const&, std::filesystem::__cxx11::path const&)': /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/c++/bits/fs_path.h:545: undefined reference to `std::filesystem::__cxx11::path::compare(std::filesystem::__cxx11::path const&) const' /usr/sbin/ld: main.o: in function `std::filesystem::__cxx11::path::path<char [6], std::filesystem::__cxx11::path>(char const (&) [6], std::filesystem::__cxx11::path::format)': /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/c++/bits/fs_path.h:184: undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()' /usr/sbin/ld: main.o: in function `std::filesystem::__cxx11::path::path<char [5], std::filesystem::__cxx11::path>(char const (&) [5], std::filesystem::__cxx11::path::format)': /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/c++/bits/fs_path.h:184: undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()' collect2: error: ld returned 1 exit status + set +x |
This task depends upon
Closed by Sven-Hendrik Haase (Svenstaro)
Monday, 23 September 2019, 11:22 GMT
Reason for closing: Fixed
Monday, 23 September 2019, 11:22 GMT
Reason for closing: Fixed
source for main.cpp
#include <filesystem>
int main()
{
std::filesystem::path p("/root");
std::filesystem::path p2("/usr");
if (p == p2)
return 1;
return 0;
}
I believe the issue is the lack of libstdc++fs.a which conflicts with the same file supplied by gcc.
If the file were moved to /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0 it would not conflict,
would need to test if it is used instead of the one in /usr/lib.
pacman -U https://archive.archlinux.org/packages/g/gcc8/gcc8-8.3.0-1-x86_64.pkg.tar.xz https://archive.archlinux.org/packages/g/gcc8-libs/gcc8-libs-8.3.0-1-x86_64.pkg.tar.xz
errors:
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/libmpx.spec exists in both 'gcc8-libs' and 'gcc8'
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/libstdc++.so exists in both 'gcc8-libs' and 'gcc8'
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/libstdc++.so.6 exists in both 'gcc8-libs' and 'gcc8'
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/libstdc++.so.6.0.25 exists in both 'gcc8-libs' and 'gcc8'
/usr/lib/gcc/x86_64-pc-linux-gnu/lib/libgcc_s.so exists in both 'gcc8-libs' and 'gcc8'
/usr/lib/gcc/x86_64-pc-linux-gnu/lib/libgcc_s.so.1 exists in both 'gcc8-libs' and 'gcc8'
But overwriting worked, so I can say that gcc8 8.3.0-1 works fine.
usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/libstdc++.a
usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/libstdc++fs.a
The latter file is needed to link libstdc++fs unsure on the former.
The provided test then builds successfully.