rui314 / mold

Mold: A Modern Linker 🦠
MIT License
13.69k stars 448 forks source link

Fix build on FreeBSD #1251

Closed wahjava closed 2 months ago

wahjava commented 2 months ago

It's broken on FreeBSD 14.0-RELEASE:

FAILED: CMakeFiles/mold.dir/common/filepath.cc.o 
/usr/bin/c++ -DTBB_USE_DEBUG -DUSE_SYSTEM_MIMALLOC -Imold-2.31.0/third-party/blake3/c -I.build -pipe -g -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -pipe -g -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -std=gnu++20 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wall -Wextra -Wno-sign-compare -Wno-unused-function -Wno-unused-parameter -Wno-missing-field-initializers -ggnu-pubnames -D_GLIBCXX_ASSERTIONS -pthread -fpch-preprocess -MD -MT CMakeFiles/mold.dir/common/filepath.cc.o -MF CMakeFiles/mold.dir/common/filepath.cc.o.d -o CMakeFiles/mold.dir/common/filepath.cc.o -c mold-2.31.0/common/filepath.cc
mold-2.31.0/common/filepath.cc:47:12: error: use of undeclared identifier 'CTL_KERN'
  mib[0] = CTL_KERN;
           ^
mold-2.31.0/common/filepath.cc:48:12: error: use of undeclared identifier 'KERN_PROC'
  mib[1] = KERN_PROC;
           ^
mold-2.31.0/common/filepath.cc:49:12: error: use of undeclared identifier 'KERN_PROC_PATHNAME'
  mib[2] = KERN_PROC_PATHNAME;
           ^
mold-2.31.0/common/filepath.cc:53:3: error: use of undeclared identifier 'sysctl'
  sysctl(mib, 4, NULL, &size, NULL, 0);
  ^
mold-2.31.0/common/filepath.cc:57:3: error: use of undeclared identifier 'sysctl'
  sysctl(mib, 4, path.data(), &size, NULL, 0);
  ^
5 errors generated.
rui314 commented 2 months ago

Thanks!

rui314 commented 2 months ago

@wahjava By the way, https://cgit.freebsd.org/ports/tree/devel/mold/Makefile says that mold is licensed under AGPLv3, which is no longer the case. Our license is MIT. Can you fix it as well?

wahjava commented 2 months ago

@wahjava By the way, https://cgit.freebsd.org/ports/tree/devel/mold/Makefile says that mold is licensed under AGPLv3, which is no longer the case. Our license is MIT. Can you fix it as well?

My apologies. Fixed in freebsd/freebsd-ports@751037df31b827555a2d74df4879d03ea684f01a and freebsd/freebsd-ports@b3834bbbeef96fc9974fc960884bd340a852bf3a.