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
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.
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.
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 …
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.
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.
[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
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.
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» –
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++17 ‘filesystem’ 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