cmake or gcc issue; filesystem not found

Hopefully this isn’t a repost since I can’t find my message. (Yeah I used the FAQ and found other messages.)

I just upgraded from 15.2 to 15.3 and I am having issues with GCC or perhaps CMAKE Two different programs pulled from github (as in should be good code) have the same type of error.

Example from SDRplusplus:


Building CXX object core/CMakeFiles/sdrpp_core.dir/src/config.cpp.o
/usr/local/src/SDRPlusPlus/core/src/config.cpp:5:10: fatal error: filesystem: No such file or directory
 #include <filesystem>
          ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [core/CMakeFiles/sdrpp_core.dir/build.make:80: core/CMakeFiles/sdrpp_core.dir/src/config.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:800: core/CMakeFiles/sdrpp_core.dir/all] Error 2
make: *** [Makefile:147: all] Error 2

Example from gnuradio:


Building CXX object gnuradio-runtime/lib/CMakeFiles/gnuradio-runtime.dir/constants.cc.o
In file included from /usr/include/boost/dll/runtime_symbol_info.hpp:11:0,
                 from /usr/local/src/gnuradio/build/gnuradio-runtime/lib/constants.cc:16:
/usr/include/boost/dll/config.hpp:42:10: fatal error: filesystem: No such file or directory
 #include <filesystem>
          ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [gnuradio-runtime/lib/CMakeFiles/gnuradio-runtime.dir/build.make:100: gnuradio-runtime/lib/CMakeFiles/gnuradio-runtime.dir/constants.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2336: gnuradio-runtime/lib/CMakeFiles/gnuradio-runtime.dir/all] Error 2
make: *** [Makefile:158: all] Error 2

This stackoverflow sort of expalins the solution except it doesn’t specifically explain how to do so:
https://stackoverflow.com/questions/39231363/fatal-error-filesystem-no-such-file-or-directory
Basically an explanation for a coder which I am not.

I did an unconditional upgrade of cmake and cmake-full just for yucks.

Hi
Should inform you in the cmake output, before it starts compiling on what’s missing… There should be documentation on the requirement with the source? That error is normally a missing boost requirement,… as in libboost_filesystem-devel.

Push comes to shove, look at the OBS Development project (which is just updated and built for Leap) https://build.opensuse.org/package/show/hamradio/gnuradio

Do you have this file on your system? /usr/include/c++/11/filesystem

In my case (on tumbleweed 20220109):

find /usr/include/ -name filesystem
/usr/include/c++/11/filesystem
/usr/include/c++/11/experimental/filesystem

For me it’s from this package:


rpm -qf /usr/include/c++/11/filesystem
libstdc++6-devel-gcc11-11.2.1+git1173-1.2.x86_64

Weird, from https://software.opensuse.org/package/libstdc++6 it seems the package exists for 15.2 but not 15.3 which might explain your problem if you were able to compile on 15.2.
It does seem to be in the experimental 15.3 packages if you want to try that.

Never mind this, apparently a known issue that 15.3 packages don’t show up there (https://forums.opensuse.org/showthread.php/563598-There-is-no-official-package-available-for-openSUSE-Leap-15-3?p=3089625#post3089625)

Then, you’ll have to learn to read code fast – really fast …

  • You’ll have to inspect the following source files for the include statement calling “filesystem” –

[INDENT=2]‘/usr/local/src/SDRPlusPlus/core/src/config.cpp’ – It looks as if the call is being made at line #5 and character position #10
‘/usr/include/boost/dll/config.hpp’ – It looks as if the call is being made at line #42 and character position #10 …[/INDENT]

Furthermore, the culprit call seems to be of the form “#include <filesystem>” which is a C++17 feature …

Catch 22 – the default openSUSE Leap 15.3 GCC C++ compiler is GCC7-C++ – which doesn’t support C++17 by default – <https://gcc.gnu.org/projects/cxx-status.html> …

  • The C++17 features were made available with GCC 5 but, until GCC 11 one has to enable them with the “-std=c++17
    ” command-line flag … <https://gcc.gnu.org/projects/cxx-status.html#cxx17>. - There are also some GCC extensions which, until GCC 11, have to be enabled with the “-std=gnu++17
    ” command-line flag …

All of which is gobbledygook for people who can’t (yet) read code but, there you are …

When an *hpp (header) file is not found, it gemerally means to me that a *.devel (development) package is missing as that is where header files are. I looked at choices and I would add package:

“libboost_filesystem_66_0-devel” package

and give it a whirl. The 66 matches installed boost version. See if you get further.

tom kosvic

I’m using gcc10 not 11 and I have the filesystem in /usr/include/c++/10.

I tried the experimental version of libstdc++6 and it bombs. I logged all the repos it added so I should be able to undo them if they cause any problems.

Yeah everything was fine under Leap 14.2.

Note I have the include files for gcc7 but that produces the same bug.

One of the reasons I included error messages from compiling two different programs was to show the issue is with CMAKE or the compiler, not a missing library. Anyway I know about the devel libs. I’ve been building gnuradio for a few years. Until LEAP 15.3 things worked OK.

Only gnuradio wants a compiler greater than 9 something ,which is why I picked 10. The other program has the same problem. One of the reasons I showed the program was present with two different programs was to show the issue is more likely with Opensuse than the code.

I tried all sorts of way to add “-std=c++17 on the cmake command line. i guess the next step is to edit the CMakeLists.txt and try to add the flag there.

Then, you’ll have to upgrade to GCC 11 to enable the “#include <filesystem>” C++17 feature by default – without any need to use compiler options …

  • Actually, with GCC 11, you’ll also have some (experimental) support for the C++20 language features – meaning that, with GCC 11 you’ll be well placed to handle code which is using those new features …
  • And, there’s also some preliminary (experimental) support for the even newer C++23 language features …

[HR][/HR]Bottom line –

  • With GCC 11, almost all of the C++17 language features are fully supported.

Unfortunately, C++17 has a new File System library – called by the use of “#include <filesystem>” …

[INDENT=2]<https://github.com/nlohmann/json/pull/3101>
<https://github.com/nlohmann/json/issues/3090>
<https://github.com/nlohmann/json/issues/3203>.[/INDENT]

[HR][/HR]Yes, the C++ pre-processor still has the “#include <file>” syntax to search for a file named “file” in a standard list of system directories and, for GCC versions less than 11, there’s this file –

  • /usr/include/c++/7/experimental/filesystem

 > rpm --query --whatprovides /usr/include/c++/7/experimental/filesystem
libstdc++6-devel-gcc7-7.5.0+r278197-4.30.1.x86_64
 > 
 > zypper search --provides /usr/include/c++/7/experimental/filesystem
Loading repository data...
Reading installed packages...

S | Name                  | Summary                                               | Type
--+-----------------------+-------------------------------------------------------+--------
i | libstdc++6-devel-gcc7 | Include Files and Libraries mandatory for Development | package
 > 

As far as Boost is concerned, there’s a directory ‘/usr/include/boost/filesystem/’ which won’t get called by the compiler’s pre-processor because it’s a directory rather than a regular file and, there’s the regular C++ header file named ‘/usr/include/boost/filesystem.hpp’ which also will not get called because, it has an “.hpp” extension …

  • Which only leaves the pre GCC 11 bugs mentioned above …

Hi
So, again, it builds with gcc7 on Leap 15.3, see the OBS build Log…

https://build.opensuse.org/public/build/hamradio/openSUSE_Leap_15.3/x86_64/gnuradio/_log

@OP, are you adding additional options that the default build on OBS (version3.8.5.0)? How does the configure part differ from your configure output?

I had libboost_filesystem1_75_0-devel already installed.

What is the deal with the deal with the "legacy: files in the package manager?

Hi
What do you mean Legacy files? The boost 66 variant is the default for openSUSE Leap, that’s how it rolls, long term support, just like having the old version of python.

Add this patch? https://build.opensuse.org/package/view_file/hamradio/gnuradio/0001-gr-digital-glfsr.h-drop-boost-cstdint.hpp-and-use-cs.patch?expand=1

Same problem with gcc11. This is from SDRplusplus


Building CXX object core/CMakeFiles/sdrpp_core.dir/src/config.cpp.o
/usr/local/src/SDRPlusPlus/core/src/config.cpp:5:10: fatal error: filesystem: No such file or directory
 #include <filesystem>
          ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [core/CMakeFiles/sdrpp_core.dir/build.make:80: core/CMakeFiles/sdrpp_core.dir/src/config.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:800: core/CMakeFiles/sdrpp_core.dir/all] Error 2
make: *** [Makefile:147: all] Error 2



From gnuradio


Building CXX object gnuradio-runtime/lib/CMakeFiles/gnuradio-runtime.dir/constants.cc.o
In file included from /usr/include/boost/dll/runtime_symbol_info.hpp:11:0,
                 from /usr/local/src/gnuradio/build/gnuradio-runtime/lib/constants.cc:16:
/usr/include/boost/dll/config.hpp:42:10: fatal error: filesystem: No such file or directory
 #include <filesystem>
          ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [gnuradio-runtime/lib/CMakeFiles/gnuradio-runtime.dir/build.make:100: gnuradio-runtime/lib/CMakeFiles/gnuradio-runtime.dir/constants.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2336: gnuradio-runtime/lib/CMakeFiles/gnuradio-runtime.dir/all] Error 2
make: *** [Makefile:158: all] Error 2



For boost the directory does exist:


/usr/include/boost/filesystem> pwd
/usr/include/boost/filesystem



If you go in Yast’s Software Management and search for libboost, you will see files that end “in _legacy”

I’m building gnuradio 3.10.0 so the patch isn’t appropriate.

I believe the problem is either in CMAKE or gcc, not the code itself. It isn’t finding a file for two different programs.

Sorry about not being specific. I am building 3.10.0. But again the SDRplusplus code also pulled from github can’t tind the same file.

Please check and publish the following information –

  • “ gcc -dumpversion ”
  • “ gcc -print-search-dirs ”
  • “ gcc -xc++ -E -v - ”
  • “ find /usr/include/ -name ‘filesystem’ ”

The “gcc -xc++ -E -v -” command should output include search paths something like this – «the example has been executed on standard Leap 15.3 with GCC 7» –


#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/7
 /usr/include/c++/7/x86_64-suse-linux
 /usr/include/c++/7/backward
 /usr/lib64/gcc/x86_64-suse-linux/7/include
 /usr/local/include
 /usr/lib64/gcc/x86_64-suse-linux/7/include-fixed
 /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include
 /usr/include
End of search list.

Interestingly, adding “-std=c++17” and “-std=gnu++17” to the “gcc -xc++ -E -v -” command, doesn’t change the include search path –

  • Meaning that, ‘/usr/include/c++/7/experimental/filesystem
    ’ will probably not be found by the compiler …

[HR][/HR]Meaning that, you may have to create a symbolic link from the C++17filesystem’ file (located wherever the GCC RPM packet placed it) to ‘/usr/include/c++/«GCC version»’ …

Here you in in the exact order you requested. But note my default is the system default which is rev 7. If you have flags to force rev 11 let me know and I will run them as well


 gcc -dumpversion
7


gcc -print-search-dirs
install: /usr/lib64/gcc/x86_64-suse-linux/7/
programs: =/usr/lib64/gcc/x86_64-suse-linux/7/:/usr/lib64/gcc/x86_64-suse-linux/7/:/usr/lib64/gcc/x86_64-suse-linux/:/usr/lib64/gcc/x86_64-suse-linux/7/:/usr/lib64/gcc/x86_64-suse-linux/:/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/x86_64-suse-linux/7/:/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/
libraries: =/usr/lib64/gcc/x86_64-suse-linux/7/:/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/lib/x86_64-suse-linux/7/:/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/lib/../lib64/:/usr/lib64/gcc/x86_64-suse-linux/7/../../../x86_64-suse-linux/7/:/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/:/lib/x86_64-suse-linux/7/:/lib/../lib64/:/usr/lib/x86_64-suse-linux/7/:/usr/lib/../lib64/:/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/lib/:/usr/lib64/gcc/x86_64-suse-linux/7/../../../:/lib/:/usr/lib/

Note I had to control-C out of this one.


gcc -xc++ -E -v -
Using built-in specs.
COLLECT_GCC=gcc
OFFLOAD_TARGET_NAMES=hsa:nvptx-none
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,ada,go --enable-offload-targets=hsa,nvptx-none, --without-cuda-driver --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/7 --enable-ssp --disable-libssp --disable-libvtv --disable-libcc1 --disable-plugin --with-bugurl=https://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-7 --without-system-libunwind --enable-multilib --with-arch-32=x86-64 --with-tune=generic --build=x86_64-suse-linux --host=x86_64-suse-linux
Thread model: posix
gcc version 7.5.0 (SUSE Linux) 
COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64'
 /usr/lib64/gcc/x86_64-suse-linux/7/cc1plus -E -quiet -v -D_GNU_SOURCE - -mtune=generic -march=x86-64
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/7
 /usr/include/c++/7/x86_64-suse-linux
 /usr/include/c++/7/backward
 /usr/lib64/gcc/x86_64-suse-linux/7/include
 /usr/local/include
 /usr/lib64/gcc/x86_64-suse-linux/7/include-fixed
 /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include
 /usr/include
End of search list.


^C


find /usr/include/ -name 'filesystem'
/usr/include/boost/filesystem
/usr/include/c++/11/experimental/filesystem
/usr/include/c++/11/filesystem
/usr/include/c++/7/experimental/filesystem
/usr/include/c++/10/experimental/filesystem
/usr/include/c++/10/filesystem

I appreciate any help I can get here. I’m OK with popping the hood (bonnet) and checking the fluids but you guys are taking the transmission apart!