superg / redumper

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

How to build the latest? #42

Closed Tatsh closed 1 year ago

Tatsh commented 1 year ago

The latest version needs C++ module support in a version 17 of LLVM/Clang it seems?

Even if I use the binary, it mentions .so files I do not have on my machine. You would either have to make all of that static or have a way to build without module support.

superg commented 1 year ago

That's work in progress.

Tatsh commented 1 year ago

Ok. Latest version I can build is 128.

Tatsh commented 1 year ago

I was able to build with Clang 16 (with libcxx installed) like so:

cmake -DCMAKE_CXX_FLAGS='-ggdb -march=native -mtune=native -pipe -ftree-vectorize' -G Ninja -Wno-dev '-DCMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE=${CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS} -format=p1689 -- <CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x c++ <SOURCE> -c -o <OBJECT> -MT <DYNDEP_FILE> > <DYNDEP_FILE>'
ninja

Do not include optimisation flags like -O2 or it will fail with the following:

[2/10] Building CXX object CMakeFiles/redumper.dir/toc.cc.o
FAILED: CMakeFiles/redumper.dir/toc.cc.o CMakeFiles/redumper.dir/cd.toc.pcm 
/usr/lib/llvm/16/bin/clang++ -DREDUMPER_VERSION_BUILD=LOCAL -DREDUMPER_VERSION_MAJOR=2023 -DREDUMPER_VERSION_MINOR=05 -DREDUMPER_VERSION_PATCH=08 -I/home/tatsh/dev/overlay/redumper -I/home/tatsh/dev/overlay/redumper/build -O2 -ggdb -march=native -mtune=native -pipe -ftree-vectorize -g -std=c++20 -fexperimental-library -stdlib=libc++ -MD -MT CMakeFiles/redumper.dir/toc.cc.o -MF CMakeFiles/redumper.dir/toc.cc.o.d @CMakeFiles/redumper.dir/toc.cc.o.modmap -o CMakeFiles/redumper.dir/toc.cc.o -c /home/tatsh/dev/overlay/redumper/toc.cc
In module 'logger' imported from /home/tatsh/dev/overlay/redumper/toc.cc:19:
/usr/include/bits/stdlib.h:37:8: error: 'realpath' has different definitions in different modules; definition in module 'logger.<global>' first difference is function body
__NTH (realpath (const char *__restrict __name, char *__restrict __resolved))
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/cdefs.h:91:35: note: expanded from macro '__NTH'
#   define __NTH(fct)   __LEAF_ATTR fct __THROW
                                    ^
/usr/include/bits/stdlib.h:37:8: note: but in '' found a different body
__NTH (realpath (const char *__restrict __name, char *__restrict __resolved))
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/cdefs.h:91:35: note: expanded from macro '__NTH'
#   define __NTH(fct)   __LEAF_ATTR fct __THROW
                                    ^
1 error generated.