New comment by cinerea0 on void-packages repository https://github.com/void-linux/void-packages/pull/31706#issuecomment-1012736780 Comment: Currently attempting to build mold using a very similar template to the one in this PR and I think I'm getting the compilation errors mentioned earlier that disappeared on their own:
Build Output ``` => mold-1.0.1_1: running do_build ... mkdir -p out/elf touch out/elf/.keep mkdir -p out/macho touch out/macho/.keep g++ -DMOLD_VERSION=\"1.0.1\" -DLIBDIR="\"/usr/local/lib\"" -Ithird-party/tbb/include -Ithird-party/xxhash -fstack-clash-protection -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -pipe -fdebug-prefix-map=/builddir/mold-1.0.1=. -c -o out/compress.o compress.cc In file included from compress.cc:15: mold.h:27:32: error: 'string_view_literals' is not a namespace-name; did you mean 'string_literals'? 27 | using namespace std::literals::string_view_literals; | ^~~~~~~~~~~~~~~~~~~~ | string_literals mold.h:41:1: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17' 41 | inline char *output_tmpfile; | ^~~~~~ mold.h:42:1: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17' 42 | inline char *socket_tmpfile; | ^~~~~~ mold.h:43:1: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17' 43 | inline thread_local bool opt_demangle; | ^~~~~~ mold.h:47:6: error: 'string_view' in namespace 'std' does not name a type 47 | std::string_view errno_string(); | ^~~~~~~~~~~ mold.h:47:1: note: 'std::string_view' is only available from C++17 onwards 47 | std::string_view errno_string(); | ^~~ mold.h:72:10: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17' 72 | static inline std::mutex mu; | ^~~~~~ mold.h: In destructor 'mold::SyncOut::~SyncOut()': mold.h:63:21: error: missing template arguments before 'lock' 63 | std::lock_guard lock(mu); | ^~~~ mold.h: At global scope: mold.h:202:39: error: 'std::string_view' has not been declared 202 | inline i64 write_string(u8 *buf, std::string_view str) { | ^~~~~~~~~~~ mold.h: In function 'mold::i64 mold::write_string(mold::u8*, int)': mold.h:203:19: error: request for member 'data' in 'str', which is of non-class type 'int' 203 | memcpy(buf, str.data(), str.size()); | ^~~~ mold.h:203:31: error: request for member 'size' in 'str', which is of non-class type 'int' 203 | memcpy(buf, str.data(), str.size()); | ^~~~ mold.h:204:11: error: request for member 'size' in 'str', which is of non-class type 'int' 204 | buf[str.size()] = '\0'; | ^~~~ mold.h:205:14: error: request for member 'size' in 'str', which is of non-class type 'int' 205 | return str.size() + 1; | ^~~~ mold.h: At global scope: mold.h:255:6: error: 'string_view' in namespace 'std' does not name a type 255 | std::string_view save_string(C &ctx, const std::string &str) { | ^~~~~~~~~~~ mold.h:255:1: note: 'std::string_view' is only available from C++17 onwards 255 | std::string_view save_string(C &ctx, const std::string &str) { | ^~~ mold.h:295:36: error: 'std::string_view' has not been declared 295 | std::pair insert(std::string_view key, u64 hash, const T &val) { | ^~~~~~~~~~~ mold.h: In member function 'std::pair mold::ConcurrentMap::insert(int, mold::u64, const T&)': mold.h:316:26: error: request for member 'size' in 'key', which is of non-class type 'int' 316 | sizes[idx] = key.size(); | ^~~~ mold.h:317:25: error: request for member 'data' in 'key', which is of non-class type 'int' 317 | keys[idx] = key.data(); | ^~~~ mold.h:321:15: error: request for member 'size' in 'key', which is of non-class type 'int' 321 | if (key.size() == sizes[idx] && memcmp(ptr, key.data(), sizes[idx]) == 0) | ^~~~ mold.h:321:55: error: request for member 'data' in 'key', which is of non-class type 'int' 321 | if (key.size() == sizes[idx] && memcmp(ptr, key.data(), sizes[idx]) == 0) | ^~~~ mold.h: At global scope: mold.h:436:31: error: 'string_view' is not a member of 'std' 436 | std::string get_realpath(std::string_view path); | ^~~~~~~~~~~ mold.h:436:31: note: 'std::string_view' is only available from C++17 onwards mold.h:437:23: error: 'string_view' is not a member of 'std' 437 | bool path_is_dir(std::string_view path); | ^~~~~~~~~~~ mold.h:437:23: note: 'std::string_view' is only available from C++17 onwards mold.h:438:6: error: 'string_view' in namespace 'std' does not name a type 438 | std::string_view path_dirname(std::string_view path); | ^~~~~~~~~~~ mold.h:438:1: note: 'std::string_view' is only available from C++17 onwards 438 | std::string_view path_dirname(std::string_view path); | ^~~ mold.h:439:6: error: 'string_view' in namespace 'std' does not name a type 439 | std::string_view path_filename(std::string_view path); | ^~~~~~~~~~~ mold.h:439:1: note: 'std::string_view' is only available from C++17 onwards 439 | std::string_view path_filename(std::string_view path); | ^~~ mold.h:440:6: error: 'string_view' in namespace 'std' does not name a type 440 | std::string_view path_basename(std::string_view path); | ^~~~~~~~~~~ mold.h:440:1: note: 'std::string_view' is only available from C++17 onwards 440 | std::string_view path_basename(std::string_view path); | ^~~ mold.h:441:35: error: 'string_view' is not a member of 'std' 441 | std::string path_to_absolute(std::string_view path); | ^~~~~~~~~~~ mold.h:441:35: note: 'std::string_view' is only available from C++17 onwards mold.h:442:29: error: 'string_view' is not a member of 'std' 442 | std::string path_clean(std::string_view path); | ^~~~~~~~~~~ mold.h:442:29: note: 'std::string_view' is only available from C++17 onwards mold.h:448:6: error: 'string_view' in namespace 'std' does not name a type 448 | std::string_view demangle(std::string_view name); | ^~~~~~~~~~~ mold.h:448:1: note: 'std::string_view' is only available from C++17 onwards 448 | std::string_view demangle(std::string_view name); | ^~~ mold.h:456:34: error: expected ')' before 'input' 456 | ZlibCompressor(std::string_view input); | ~ ^~~~~~ | ) mold.h:467:34: error: expected ')' before 'input' 467 | GzipCompressor(std::string_view input); | ~ ^~~~~~ | ) mold.h:484:27: error: expected ')' before 'name' 484 | Counter(std::string_view name, i64 value = 0) : name(name), values(value) { | ~ ^~~~~ | ) mold.h:504:10: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17' 504 | static inline bool enabled = false; | ^~~~~~ mold.h:509:8: error: 'string_view' in namespace 'std' does not name a type 509 | std::string_view name; | ^~~~~~~~~~~ mold.h:509:3: note: 'std::string_view' is only available from C++17 onwards 509 | std::string_view name; | ^~~ mold.h:512:10: warning: inline variables are only available with '-std=c++17' or '-std=gnu++17' 512 | static inline std::vector instances; | ^~~~~~ mold.h:568:38: error: 'std::string_view' has not been declared 568 | void append(std::string path, std::string_view data); | ^~~~~~~~~~~ mold.h:578:43: error: 'string_view' is not a member of 'std' 578 | std::vector> contents; | ^~~~~~~~~~~ mold.h:578:43: note: 'std::string_view' is only available from C++17 onwards mold.h:578:43: error: 'string_view' is not a member of 'std' mold.h:578:43: note: 'std::string_view' is only available from C++17 onwards mold.h:578:43: error: template argument 2 is invalid mold.h:578:54: error: template argument 1 is invalid 578 | std::vector> contents; | ^~ mold.h:578:54: error: template argument 2 is invalid mold.h:598:8: error: 'string_view' in namespace 'std' does not name a type 598 | std::string_view get_contents() { | ^~~~~~~~~~~ mold.h:598:3: note: 'std::string_view' is only available from C++17 onwards 598 | std::string_view get_contents() { | ^~~ mold.h: In static member function 'static mold::MappedFile* mold::MappedFile::open(C&, std::string)': mold.h:617:12: error: 'std::string' {aka 'class std::__cxx11::basic_string'} has no member named 'starts_with' 617 | if (path.starts_with('/') && !ctx.arg.chroot.empty()) | ^~~~~~~~~~~ mold.h:618:50: error: no match for call to '(std::string {aka std::__cxx11::basic_string}) (std::string&)' 618 | path = ctx.arg.chroot + "/" + path_clean(path); | ^ mold.h:626:10: error: missing template arguments before '(' token 626 | Fatal(ctx) << path << ": fstat failed: " << errno_string(); | ^ mold.h:626:49: error: there are no arguments to 'errno_string' that depend on a template parameter, so a declaration of 'errno_string' must be available [-fpermissive] 626 | Fatal(ctx) << path << ": fstat failed: " << errno_string(); | ^~~~~~~~~~~~ mold.h:626:49: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) mold.h:639:12: error: missing template arguments before '(' token 639 | Fatal(ctx) << path << ": mmap failed: " << errno_string(); | ^ mold.h:639:50: error: there are no arguments to 'errno_string' that depend on a template parameter, so a declaration of 'errno_string' must be available [-fpermissive] 639 | Fatal(ctx) << path << ": mmap failed: " << errno_string(); | ^~~~~~~~~~~~ mold.h: In static member function 'static mold::MappedFile* mold::MappedFile::must_open(C&, std::string)': mold.h:650:8: error: missing template arguments before '(' token 650 | Fatal(ctx) << "cannot open " << path; | ^ compress.cc: At global scope: compress.cc:24:25: error: 'string_view' is not a member of 'std' 24 | static std::vector split(std::string_view input) { | ^~~~~~~~~~~ compress.cc:24:25: note: 'std::string_view' is only available from C++17 onwards compress.cc:24:25: error: 'string_view' is not a member of 'std' compress.cc:24:25: note: 'std::string_view' is only available from C++17 onwards compress.cc:24:36: error: template argument 1 is invalid 24 | static std::vector split(std::string_view input) { | ^ compress.cc:24:36: error: template argument 2 is invalid compress.cc:24:49: error: 'string_view' is not a member of 'std' 24 | static std::vector split(std::string_view input) { | ^~~~~~~~~~~ compress.cc:24:49: note: 'std::string_view' is only available from C++17 onwards compress.cc:36:41: error: 'string_view' is not a member of 'std' 36 | static std::vector do_compress(std::string_view input) { | ^~~~~~~~~~~ compress.cc:36:41: note: 'std::string_view' is only available from C++17 onwards compress.cc:36:60: error: expected ',' or ';' before '{' token 36 | static std::vector do_compress(std::string_view input) { | ^ compress.cc:66:31: error: expected constructor, destructor, or type conversion before '(' token 66 | ZlibCompressor::ZlibCompressor(std::string_view input) { | ^ compress.cc:114:31: error: expected constructor, destructor, or type conversion before '(' token 114 | GzipCompressor::GzipCompressor(std::string_view input) { | ^ make: *** [Makefile:126: out/compress.o] Error 1 => ERROR: mold-1.0.1_1: do_build: '${make_cmd} CC="$CC" CXX="$CXX" LD="$LD" AR="$AR" RANLIB="$RANLIB" CPP="$CPP" AS="$AS" OBJCOPY="$OBJCOPY" OBJDUMP="$OBJDUMP" CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" ${makejobs} ${make_build_args} ${make_build_target}' exited with 2 => ERROR: in do_build() at common/build-style/gnu-makefile.sh:9 ```