Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal error: filesystem: No such file or directory #197

Closed
thekendalmiller opened this issue Jan 15, 2024 · 2 comments · Fixed by #201
Closed

fatal error: filesystem: No such file or directory #197

thekendalmiller opened this issue Jan 15, 2024 · 2 comments · Fixed by #201

Comments

@thekendalmiller
Copy link

thekendalmiller commented Jan 15, 2024

I'm seeing this compilation issue on on Amazon Linux 2 (redhat like) with gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-17).

From googling a bit, it looks like it might be because some gcc have filesystem as experimental. It looks like there are macros to detect the namespace https://stackoverflow.com/a/53366603

[root@ip-REDACTED]# cat /etc/os-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
SUPPORT_END="2025-06-30"
[root@ip-REDACTED]# gcc --version
gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-17)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
"g++ -o conftest -I/opt/rubies/ruby-3.0.6/include/ruby-3.0.0/x86_64-linux -I/opt/rubies/ruby-3.0.6/include/ruby-3.0.0/ruby/backward -I/opt/rubies/ruby-3.0.6/include/ruby-3.0.0 -I. -I/opt/rubies/ruby-3.0.6/include     conftest.cc  -L. -L/opt/rubies/ruby-3.0.6/lib -Wl,-rpath,/opt/rubies/ruby-3.0.6/lib -L. -L/opt/rubies/ruby-3.0.6/lib  -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,/opt/rubies/ruby-3.0.6/lib -L/opt/rubies/ruby-3.0.6/lib -lruby  -lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

"g++ -E -I/opt/rubies/ruby-3.0.6/include/ruby-3.0.0/x86_64-linux -I/opt/rubies/ruby-3.0.6/include/ruby-3.0.0/ruby/backward -I/opt/rubies/ruby-3.0.6/include/ruby-3.0.0 -I. -I/opt/rubies/ruby-3.0.6/include    -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable  -fPIC  conftest.cc -o conftest.i"
cc1plus: warning: command line option '-Wimplicit-function-declaration' is valid for C/ObjC but not for C++
cc1plus: warning: command line option '-Wimplicit-int' is valid for C/ObjC but not for C++
conftest.cc:3:10: fatal error: rice/rice.hpp: No such file or directory
 #include <rice/rice.hpp>
          ^~~~~~~~~~~~~~~
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <rice/rice.hpp>
/* end */

"g++ -E -I/opt/rubies/ruby-3.0.6/include/ruby-3.0.0/x86_64-linux -I/opt/rubies/ruby-3.0.6/include/ruby-3.0.0/ruby/backward -I/opt/rubies/ruby-3.0.6/include/ruby-3.0.0 -I. -I/opt/rubies/ruby-3.0.6/include    -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable  -fPIC -I/var/app/bundle/ruby/3.0.0/gems/rice-4.1.0/include conftest.cc -o conftest.i"
cc1plus: warning: command line option '-Wimplicit-function-declaration' is valid for C/ObjC but not for C++
cc1plus: warning: command line option '-Wimplicit-int' is valid for C/ObjC but not for C++
In file included from conftest.cc:3:0:
/var/app/bundle/ruby/3.0.0/gems/rice-4.1.0/include/rice/rice.hpp:1208:10: fatal error: filesystem: No such file or directory
 #include <filesystem>
          ^~~~~~~~~~~~
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <rice/rice.hpp>
/* end */

I can confirm for these servers that filesystem is in /usr/include/c++/7/experimental/filesystem

@jasonroelofs
Copy link
Collaborator

Thanks for the links! Adding the testing macros should be simple enough. Looks like we only pull that in for the possibility of catching std::filesystem::filesystem_error.

@thekendalmiller
Copy link
Author

I also needed to change this line to have_library('stdc++fs')
https://github.com/jasonroelofs/rice/blob/59b03953e91f681849a20121614bcdb1114c86d8/lib/mkmf-rice.rb#L129

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment