superg / redumper

Low level CD dumper utility
GNU General Public License v3.0
200 stars 18 forks source link

Cannot build latest version #54

Closed Tatsh closed 1 year ago

Tatsh commented 1 year ago

Latest version I can build is 161. 166 gives an error regarding format not being in the std namespace:

 $ ninja
[0/1] Re-running CMake...
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/tatsh/dev/overlay/redumper/build
[15/122] Building CXX object tests/CMakeFiles/tests.dir/__/cd/cd.ixx.o
warning: unknown warning option '-Wno-read-modules-implicitly'; did you mean '-Wno-module-conflict'? [-Wunknown-warning-option]
1 warning generated.
warning: unknown warning option '-Wno-read-modules-implicitly'; did you mean '-Wno-module-conflict'? [-Wunknown-warning-option]
1 warning generated.
[16/122] Building CXX object tests/CMakeFiles/tests.dir/__/cd/cdrom.ixx.o
warning: unknown warning option '-Wno-read-modules-implicitly'; did you mean '-Wno-module-conflict'? [-Wunknown-warning-option]
1 warning generated.
warning: unknown warning option '-Wno-read-modules-implicitly'; did you mean '-Wno-module-conflict'? [-Wunknown-warning-option]
1 warning generated.
[17/122] Building CXX object CMakeFiles/generate_offsets.dir/generate_offsets.cc.o
FAILED: CMakeFiles/generate_offsets.dir/generate_offsets.cc.o
/usr/lib/llvm/16/bin/clang++ -DREDUMPER_VERSION_BUILD=LOCAL -DREDUMPER_VERSION_MAJOR=2023 -DREDUMPER_VERSION_MINOR=06 -DREDUMPER_VERSION_PATCH=12  -ggdb -march=native -mtune=native -pipe -ftree-vectorize -g -std=c++20 -stdlib=libc++ -Wno-read-modules-implicitly -MD -MT CMakeFiles/generate_offsets.dir/generate_offsets.cc.o -MF CMakeFiles/generate_offsets.dir/generate_offsets.cc.o.d @CMakeFiles/generate_offsets.dir/generate_offsets.cc.o.modmap -o CMakeFiles/generate_offsets.dir/generate_offsets.cc.o -c /home/tatsh/dev/overlay/redumper/generate_offsets.cc
warning: unknown warning option '-Wno-read-modules-implicitly'; did you mean '-Wno-module-conflict'? [-Wunknown-warning-option]
/home/tatsh/dev/overlay/redumper/generate_offsets.cc:21:35: error: no member named 'format' in namespace 'std'
                                throw std::runtime_error(std::format("unable to open input file [{}]", p.string()));
                                                         ~~~~~^
/home/tatsh/dev/overlay/redumper/generate_offsets.cc:27:35: error: no member named 'format' in namespace 'std'
                                throw std::runtime_error(std::format("unable to create output file [{}]", h.string()));
                                                         ~~~~~^
/home/tatsh/dev/overlay/redumper/generate_offsets.cc:55:17: error: no member named 'format' in namespace 'std'
                                ofs << std::format("{{\"{}\", {}}}, ", drive, offset) << std::endl;
                                       ~~~~~^
/home/tatsh/dev/overlay/redumper/generate_offsets.cc:58:22: error: no member named 'format' in namespace 'std'
                        std::cout << std::format("offset min: {}, offset max: {:+}", offset_min, offset_max) << std::endl;
                                     ~~~~~^
1 warning and 4 errors generated.
[18/122] Building CXX object tests/CMakeFiles/tests.dir/__/utils/misc.ixx.o
FAILED: tests/CMakeFiles/tests.dir/__/utils/misc.ixx.o tests/CMakeFiles/tests.dir/utils.misc.pcm
/usr/lib/llvm/16/bin/clang++ -DREDUMPER_VERSION_BUILD=LOCAL -DREDUMPER_VERSION_MAJOR=2023 -DREDUMPER_VERSION_MINOR=06 -DREDUMPER_VERSION_PATCH=12 -I/home/tatsh/dev/overlay/redumper -ggdb -march=native -mtune=native -pipe -ftree-vectorize -g -std=c++20 -stdlib=libc++ -Wno-read-modules-implicitly -MD -MT tests/CMakeFiles/tests.dir/__/utils/misc.ixx.o -MF tests/CMakeFiles/tests.dir/__/utils/misc.ixx.o.d @tests/CMakeFiles/tests.dir/__/utils/misc.ixx.o.modmap -o tests/CMakeFiles/tests.dir/__/utils/misc.ixx.o -c /home/tatsh/dev/overlay/redumper/utils/misc.ixx
warning: unknown warning option '-Wno-read-modules-implicitly'; did you mean '-Wno-module-conflict'? [-Wunknown-warning-option]
/home/tatsh/dev/overlay/redumper/utils/misc.ixx:284:3: error: no member named 'format' in namespace 'std'
                throw_line("enum_to_string failed, no such value in dictionary (possible values: {})", dictionary_values(dictionary));
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/tatsh/dev/overlay/redumper/utils/throw_line.hh:13:55: note: expanded from macro 'throw_line'
#define throw_line(...) throw std::runtime_error(std::format("{} {{{}:{}}}", std::format(__VA_ARGS__), __FILE__, __LINE__))
                                                 ~~~~~^
/home/tatsh/dev/overlay/redumper/utils/misc.ixx:284:3: error: no member named 'format' in namespace 'std'
                throw_line("enum_to_string failed, no such value in dictionary (possible values: {})", dictionary_values(dictionary));
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/tatsh/dev/overlay/redumper/utils/throw_line.hh:13:83: note: expanded from macro 'throw_line'
#define throw_line(...) throw std::runtime_error(std::format("{} {{{}:{}}}", std::format(__VA_ARGS__), __FILE__, __LINE__))
                                                                             ~~~~~^
/home/tatsh/dev/overlay/redumper/utils/misc.ixx:298:2: error: no member named 'format' in namespace 'std'
        throw_line("string_to_enum failed, no such value in dictionary (possible values: {})", dictionary_values(dictionary));
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/tatsh/dev/overlay/redumper/utils/throw_line.hh:13:55: note: expanded from macro 'throw_line'
#define throw_line(...) throw std::runtime_error(std::format("{} {{{}:{}}}", std::format(__VA_ARGS__), __FILE__, __LINE__))
                                                 ~~~~~^
/home/tatsh/dev/overlay/redumper/utils/misc.ixx:298:2: error: no member named 'format' in namespace 'std'
        throw_line("string_to_enum failed, no such value in dictionary (possible values: {})", dictionary_values(dictionary));
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/tatsh/dev/overlay/redumper/utils/throw_line.hh:13:83: note: expanded from macro 'throw_line'
#define throw_line(...) throw std::runtime_error(std::format("{} {{{}:{}}}", std::format(__VA_ARGS__), __FILE__, __LINE__))
                                                                             ~~~~~^
/home/tatsh/dev/overlay/redumper/utils/misc.ixx:462:15: error: no member named 'format' in namespace 'std'
                str += std::format("{}-{}:", r.first, r.second - 1);
                       ~~~~~^
1 warning and 5 errors generated.
ninja: build stopped: subcommand failed.
superg commented 1 year ago

Let me see what's up with that

superg commented 1 year ago

I returned "-fexperimental-library" compiler flag as this is most likely the culprit. This is a temporary solution as I will not be supporting older compilers as it requires a lot of maintenance.

Let me know if it compiles for you now.

Tatsh commented 1 year ago

Unfortunately, no. Think something else also needs to be brought back?

ninja -v -j1 -l0
[1/122] "/usr/lib/llvm/16/bin/clang-scan-deps" -format=p1689 -- /usr/lib/llvm/16/bin/clang++-16 -DREDUMPER_VERSION_BUILD=LOCAL -DREDUMPER_VERSION_MAJOR=2023 -DREDUMPER_VERSION_MINOR=06 -DREDUMPER_VERSION_PATCH=13  -ggdb -march=native -mtune=native -pipe -ftree-vectorize -Wno-unknown-warning-option -std=c++20 -stdlib=libc++ -fexperimental-library -Wno-read-modules-implicitly -x c++ /var/tmp/portage/app-cdr/redumper-168/work/redumper-build_168/generate_offsets.cc -c -o CMakeFiles/generate_offsets.dir/generate_offsets.cc.o -MT CMakeFiles/generate_offsets.dir/generate_offsets.cc.o.ddi -MD -MF CMakeFiles/generate_offsets.dir/generate_offsets.cc.o.ddi.d > CMakeFiles/generate_offsets.dir/generate_offsets.cc.o.ddi
[2/122] /usr/bin/cmake -E cmake_ninja_dyndep --tdi=CMakeFiles/generate_offsets.dir/CXXDependInfo.json --lang=CXX --modmapfmt=clang --dd=CMakeFiles/generate_offsets.dir/CXX.dd @CMakeFiles/generate_offsets.dir/CXX.dd.rsp
[3/122] /usr/lib/llvm/16/bin/clang++-16 -DREDUMPER_VERSION_BUILD=LOCAL -DREDUMPER_VERSION_MAJOR=2023 -DREDUMPER_VERSION_MINOR=06 -DREDUMPER_VERSION_PATCH=13   -ggdb -march=native -mtune=native -pipe -ftree-vectorize -Wno-unknown-warning-option -std=c++20 -stdlib=libc++ -fexperimental-library -Wno-read-modules-implicitly -MD -MT CMakeFiles/generate_offsets.dir/generate_offsets.cc.o -MF CMakeFiles/generate_offsets.dir/generate_offsets.cc.o.d @CMakeFiles/generate_offsets.dir/generate_offsets.cc.o.modmap -o CMakeFiles/generate_offsets.dir/generate_offsets.cc.o -c /var/tmp/portage/app-cdr/redumper-168/work/redumper-build_168/generate_offsets.cc
[4/122] : && /usr/lib/llvm/16/bin/clang++-16 -ggdb -march=native -mtune=native -pipe -ftree-vectorize -Wno-unknown-warning-option -Wl,-O1 -Wl,--as-needed     -stdlib=libc++ -static -fexperimental-library CMakeFiles/generate_offsets.dir/generate_offsets.cc.o -o generate_offsets   && :
FAILED: generate_offsets
: && /usr/lib/llvm/16/bin/clang++-16 -ggdb -march=native -mtune=native -pipe -ftree-vectorize -Wno-unknown-warning-option -Wl,-O1 -Wl,--as-needed     -stdlib=libc++ -static -fexperimental-library CMakeFiles/generate_offsets.dir/generate_offsets.cc.o -o generate_offsets   && :
/usr/bin/x86_64-pc-linux-gnu-ld.bfd: cannot find -lc++: No such file or directory
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

I definitely have libc++ installed as I always have for this app since the change to modules:

$ ls -la /usr/lib*/libc++* | sort -k7
-rwxr-xr-x 1 root root 259K 2023-06-04 04:59 /usr/lib64/libc++abi.so.1.0
lrwxrwxrwx 1 root root   16 2023-06-04 04:59 /usr/lib64/libc++abi.so.1 -> libc++abi.so.1.0
lrwxrwxrwx 1 root root   14 2023-06-04 04:59 /usr/lib64/libc++abi.so -> libc++abi.so.1
-rwxr-xr-x 1 root root 246K 2023-06-04 04:59 /usr/lib/libc++abi.so.1.0
lrwxrwxrwx 1 root root   16 2023-06-04 04:59 /usr/lib/libc++abi.so.1 -> libc++abi.so.1.0
lrwxrwxrwx 1 root root   14 2023-06-04 04:59 /usr/lib/libc++abi.so -> libc++abi.so.1
-rw-r--r-- 1 root root 143K 2023-06-04 05:03 /usr/lib64/libc++experimental.a
lrwxrwxrwx 1 root root   11 2023-06-04 05:03 /usr/lib64/libc++_shared.so -> libc++.so.1
-rwxr-xr-x 1 root root  123 2023-06-04 05:03 /usr/lib64/libc++.so
-rwxr-xr-x 1 root root 986K 2023-06-04 05:03 /usr/lib64/libc++.so.1.0
lrwxrwxrwx 1 root root   13 2023-06-04 05:03 /usr/lib64/libc++.so.1 -> libc++.so.1.0
-rw-r--r-- 1 root root 112K 2023-06-04 05:03 /usr/lib/libc++experimental.a
lrwxrwxrwx 1 root root   11 2023-06-04 05:03 /usr/lib/libc++_shared.so -> libc++.so.1
-rwxr-xr-x 1 root root  121 2023-06-04 05:03 /usr/lib/libc++.so
-rwxr-xr-x 1 root root 1.1M 2023-06-04 05:03 /usr/lib/libc++.so.1.0
lrwxrwxrwx 1 root root   13 2023-06-04 05:03 /usr/lib/libc++.so.1 -> libc++.so.1.0

I'm on Gentoo and we have Clang 16 and GCC 13. As soon as 17/14 are out they will be available to me and every other Gentoo user and fixes like these won't be necessary. Thanks for supporting the older compilers for the time being.

superg commented 1 year ago

There has to be a static library libc++.a. Another change that I made recently was -static linking flag that makes redumper executable self contained. Make sure you either have libc++.a or, alternatively, you can strip "-static" from: https://github.com/superg/redumper/blob/main/CMakeLists.txt#L61

Tatsh commented 1 year ago

Since it's easy I am going to just add the flag -fexperimental-library so you can remove it here.

Adding static libs fixes my issue. Thanks.