mold icon indicating copy to clipboard operation
mold copied to clipboard

Manual: compile mold on Ubuntu 18.04

Open roelofvandijk opened this issue 3 years ago • 4 comments

It took a while to get this right. Maybe someone else wants to compile mold on Ubuntu 18.04, if so, this seems to work on a fresh Ubuntu 18.04 docker

apt update
apt install -y --no-install-recommends software-properties-common
add-apt-repository -y ppa:ubuntu-toolchain-r/test
apt install -y --no-install-recommends build-essential git clang-10 cmake libstdc++-10-dev libssl-dev libxxhash-dev zlib1g-dev
ln -s /usr/bin/clang-10 /usr/bin/clang
ln -s /usr/bin/clang++-10 /usr/bin/clang++
git clone https://github.com/rui314/mold.git
cd mold
git checkout v1.0.0
make -j$(nproc)
make install

roelofvandijk avatar Dec 17 '21 17:12 roelofvandijk

Thanks! I'm not sure if I can recommend this to everybody because it adds a new apt repo to the system, though.

Didn't my ./build-static.sh script work for you?

rui314 avatar Dec 18 '21 02:12 rui314

The script worked, but I wanted to run this within a docker based on 18.04 and avoid docker-in-docker.

Regarding ./build-static.sh script: you could shed some docker build time (170s ->100s) and weight (1Gb -> 650Mb) by:

  • not installing git
  • using --no-install-recommends in the apt install calls
  • using apt clean before rm -rf /var/lib/apt/lists/*

roelofvandijk avatar Dec 18 '21 10:12 roelofvandijk

I installed additionally xxhsum and libxxhash-dev probably only the last was missing. (got an xxh3.h not found error)

EmTee70 avatar Dec 21 '21 13:12 EmTee70

@roelofvandijk Thank you for the suggestion. I made a commit as you suggested in 358464d5adb4c382d7441e49c57c7a93fa4688fa.

rui314 avatar Dec 22 '21 05:12 rui314