bulk_extractor icon indicating copy to clipboard operation
bulk_extractor copied to clipboard

Compile on Ubuntu 20.04 LTS (g++ 9.4) error

Open sg opened this issue 2 years ago • 2 comments

When compiling be20_api it appears to be setting '-std=' twice on the command line; the first specifying c++17 and the second specifying c++11:

depbase=`echo be20_api/abstract_image_reader.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
g++ -std=c++17 -DHAVE_CONFIG_H -I. -I..  -pthread -std=c++11  -I../src/be20_api -I../src/be20_api/utfcpp/source -DUTC_OFFSET=+0000 -I/usr/local/include   -MD -O2 -O3 -Wall -Wcast-align -Wdisabled-optimization -Weffc++ -Wfloat-equal -Wmissing-noreturn -Wmultichar -Woverloaded-virtual -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-promo -Wwrite-strings -fPIC -g  -MT be20_api/abstract_image_reader.o -MD -MP -MF $depbase.Tpo -c -o be20_api/abstract_image_reader.o be20_api/abstract_image_reader.cpp &&\
mv -f $depbase.Tpo $depbase.Po
In file included from be20_api/abstract_image_reader.cpp:1:
be20_api/abstract_image_reader.h:13:18: error: ‘filesystem’ in namespace ‘std’ does not name a type
   13 |     virtual std::filesystem::path image_fname() const = 0;
      |                  ^~~~~~~~~~
make[2]: *** [Makefile:1520: be20_api/abstract_image_reader.o] Error 1
make[2]: Leaving directory '/root/bulk_extractor-2.1.0/src'
make[1]: *** [Makefile:525: all-recursive] Error 1
make[1]: Leaving directory '/root/bulk_extractor-2.1.0'
make: *** [Makefile:465: all] Error 2

root:~/bulk_extractor-2.1.0# g++ --version
g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0

It must be going with c++11 because the 'std.filesystem' is valid in c++17.

I went into the Makefile in src and changed this line to reflect c++17 instead of c++11 and the compile worked after that:

src/Makefile:AM_CPPFLAGS = -pthread -std=c++11  -I$(top_srcdir)/src/be20_api -I$(top_srcdir)/src/be20_api/utfcpp/source

sg avatar Jan 26 '24 18:01 sg

Thanks. I'll check it out and try to figure out where the c++11 is coming from.

simsong avatar Jan 26 '24 20:01 simsong

Hi. Can you try b1e500f?

simsong avatar Jan 27 '24 02:01 simsong