On Wed, Jun 23, 2021 at 9:25 AM Yaakov Selkowitz <yselkowi@redhat.com> wrote:
On Wed, 2021-06-23 at 08:56 -0700, Troy Dawson wrote:
> I'm updating/ rebuilding KDE Plasma Desktop on CentOS Stream 8, for the
> updated qt5 that is there.  I am using what is in F34 for the update.
> I've got all the qt5 5.15.2 and kf5 5.83.0 packages built and in the
> buildroot.
> For libksysguard I believe I have all other dependencies built and in the
> buildroot.
> But it just keeps failing, despite everything I've tried.[1][2]
> I get the same error on all arches.  The same error on version 5.22.1,
> 5.22.2 and even 5.21.4.
> I've tried passing build parameters that I thought went along with the
> error, but nothing changed.
>
> I think this is the critical error, but it's possible I'm wrong
>
> CMakeFiles/processcore.dir/cgroup_data_model.cpp.o: In function
> `KSysGuard::CGroupDataModel::update(KSysGuard::CGroup*) [clone
> .localalias.209]':
> /usr/include/c++/8/bits/fs_path.h:185: undefined reference to
> `std::filesystem::__cxx11::path::_M_split_cmpts()'
> CMakeFiles/processcore.dir/cgroup_data_model.cpp.o: In function
> `KSysGuard::CGroupDataModel::update(KSysGuard::CGroup*) [clone
> .localalias.209]':
> /usr/include/c++/8/bits/fs_dir.h:371: undefined reference to
> `std::filesystem::__cxx11::directory_iterator::directory_iterator(std::filesys
> tem::__cxx11::path
> const&, std::filesystem::directory_options, std::error_code*)'
> CMakeFiles/processcore.dir/cgroup_data_model.cpp.o: In function
> `KSysGuard::CGroupDataModel::update(KSysGuard::CGroup*)':
> /builddir/build/BUILD/libksysguard-
> 5.22.2.1/processcore/cgroup_data_model.cpp:447:
> undefined reference to
> `std::filesystem::__cxx11::directory_iterator::operator*() const'
> /builddir/build/BUILD/libksysguard-
> 5.22.2.1/processcore/cgroup_data_model.cpp:447:
> undefined reference to
> `std::filesystem::__cxx11::directory_iterator::operator++()'
> CMakeFiles/processcore.dir/cgroup_data_model.cpp.o: In function
> `KSysGuard::CGroupDataModel::update(KSysGuard::CGroup*) [clone
> .localalias.209]':
> /usr/include/c++/8/bits/fs_dir.h:260: undefined reference to
> `std::filesystem::status(std::filesystem::__cxx11::path const&)'
> collect2: error: ld returned 1 exit status

std::filesystem was originally added as an experimental extension to C++, and
at first required explicitly linking with -lstdc++fs.  GCC 9 removed the
requirement for the additional link library [1], but RHEL 8's default compiler
is GCC 8.  Therefore, for EPEL 8, you would have to create a patch which adds
stdc++fs to the target_link_libraries of the processcore target.

[1] https://gcc.gnu.org/gcc-9/changes.html

HTH,

My cmake skills are not up to snuff.  A little more help is needed.
I seems -lstdc++fs needs to be added at the end of the compile command
  /usr/bin/c++ <options and other stuff> -lstdc++fs
instead of at the beginning or middle of the options
  /usr/bin/c++ -lstdc++fs <options and other stuff>

I can do that manually, and it compiles correctly.

But getting cmake to do it, I'm clearly missing something.
Is there a cmake command line option to put -lstdc++fs at the end?
There are several cmake and cmake.in files.  Would I put it in one, and if so, what is the syntax?

Thanks
Troy