Error when building root

I am very new to this. I was asked to install ROOT but I wasn’t given any more instructions. I used the CMAKE method. When I ran the command
cmake --build .
I got the following error:

[ 88%] Linking CXX shared library ../../lib/
/usr/bin/ld: cannot find -l/usr/lib/x86_64-linux-gnu/
collect2: error: ld returned 1 exit status
make[2]: *** [lib/] Error 1
make[1]: *** [graf2d/asimage/CMakeFiles/ASImage.dir/all] Error 2
make: *** [all] Error 2

Does anyone know why this happened? What can I do about it?
Thank you for your help.

libjpeg “devel” package missing.

That’s what I thought, but when I tried installing it I got the error

it can be that you need something like “libjpeg-turbo8-dev” or “libjpeg-turbo-devel”.

According to Software Manager I have all of those packages installed.

check that you have the “devel” package versions for the “amd64” / “x86_64” architecture, and not for “i[3456]86”.

I think I have the “i[3456]86”, how do I install the other one? I can’t find it.

What do you get from “uname -a” … is there “x86_64” or “i[3456]86”?

I would try “sudo yum install some-package-name” or “sudo apt-get install some-package-name” and this should install the appropriate version of “some-package-name”.

I get x86_64
That’s what I tried initially when I got “libjpeg-dev is already the newest version.”

Try to install “libjpeg8-dev” or “libjpeg-turbo8-dev” or “libjpeg-turbo-devel”.
And maybe try tu “purge” the “libjpeg-dev” first.

I tried it but I’m still getting the same error when I use cmake.

I don’t know if anyone had solved this already, but I encountered this same error buiding 6.08.06 on a BunsenLabs (Debian) machine. I was able to fix it, though I don’t know how the error arose.

In two files in my root_build directory, I had to make the same edit. In


There was a random -l in front of


in those files, but not in front of any of the other listings of the shared libraries. Once I deleted that -l, things compiled and linked.

FWIW, here’s my cmake configure command.

cmake …/root/

I have no idea how that -l got in there. Hope this helps someone!


1 Like

@mattbellis thanks a lot! I had the exact same issue and your workaround helped me as well. However, I am using a slightly different setup:

ROOT 6.10.08
Ubuntu 17.10

Looks like a ROOT bug then?