mold icon indicating copy to clipboard operation
mold copied to clipboard

I cannot build mold

Open inyourface34456 opened this issue 1 year ago • 1 comments

I was trying to compile mold using the following sequence of commands:

git clone https://github.com/rui314/mold.git
mkdir mold/build
cd mold/build
git checkout v1.11.0
sudo ../install-build-deps.sh
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=c++ ..
cmake --build . -j $(nproc)
sudo cmake --install .

Eventually, the complation errored out with the following error:

$ cmake --build . -j $(nproc)
[  0%] Built target mold-wrapper
[  8%] Built target tbb
[  8%] Built target git_hash
[ 16%] Built target libzstd_static
[ 21%] Built target mimalloc-static
[ 21%] Building CXX object CMakeFiles/mold.dir/cmake_pch.hxx.gch
In file included from /workspaces/codespaces-blank/mold/elf/mold.h:4,
                 from /workspaces/codespaces-blank/mold/build/CMakeFiles/mold.dir/cmake_pch.hxx:5,
                 from <command-line>:
/workspaces/codespaces-blank/mold/common/common.h:17:10: fatal error: span: No such file or directory
   17 | #include <span>
      |          ^~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/mold.dir/build.make:64: CMakeFiles/mold.dir/cmake_pch.hxx.gch] Error 1
make[1]: *** [CMakeFiles/Makefile2:873: CMakeFiles/mold.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

What went wrong, and why?

inyourface34456 avatar May 12 '23 14:05 inyourface34456

I believe your C++ compiler is not recent enough. Specifically, your c++ doesn't seems to support C++20.

rui314 avatar May 13 '23 07:05 rui314