Configure error linking qt Ubuntu 16.04

installation
linux
#1

Sorry for this basic installation question, see configure.log below.
Has anyone come across this already?

Is it to do with my qt-installation? Already tried it with both qt4 and qt5. The latest version seems to be 5.8, which I also downloaded and installed, but configure doesn’t seem to recognize it? Anyway, maybe it’s not qt?

Thanks for your help, Samuel

REPORT: 
MRtrix build type requested:

REPORT: release

REPORT: 

REPORT: Detecting OS: linux

REPORT: Checking for C++11 compliant compiler [g++]:
EXEC <<
CMD: g++ -dumpversion
EXIT: 0
STDOUT:
5.4.0
>>


REPORT: 5.4.0

COMPILE /tmp/tmpS3LJ9e.cpp:
---

struct Base {
    Base (int);
};
struct Derived : Base {
    using Base::Base;
};

int main() {
  Derived D (int); // check for contructor inheritance
  return (0);
}

---
EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native /tmp/tmpS3LJ9e.cpp -o /tmp/tmpS3LJ9e.o
EXIT: 0
>>

EXEC <<
CMD: g++ /tmp/tmpS3LJ9e.o -pthread -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
>>


REPORT:  - tested ok

REPORT: Detecting pointer size:

COMPILE /tmp/tmp8PbqLK.cpp:
---

#include <iostream>
int main() {
  std::cout << sizeof(void*);
  return (0);
}

---
EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native /tmp/tmp8PbqLK.cpp -o /tmp/tmp8PbqLK.o
EXIT: 0
>>

EXEC <<
CMD: g++ /tmp/tmp8PbqLK.o -pthread -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
STDOUT:
8
>>


REPORT: 64 bit

REPORT: Detecting byte order:

REPORT: little-endian

REPORT: Checking for variable-length array support:

COMPILE /tmp/tmpSL1MIc.cpp:
---


int main(int argc, char* argv[]) {
  int x[argc];
  return 0;
}

---
EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native -DMRTRIX_WORD64 /tmp/tmpSL1MIc.cpp -o /tmp/tmpSL1MIc.o
EXIT: 0
>>

EXEC <<
CMD: g++ /tmp/tmpSL1MIc.o -pthread -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
>>


REPORT: yes

REPORT: Checking for non-POD variable-length array support:

COMPILE /tmp/tmpCHtXtj.cpp:
---

#include <string>

class X {
  int x;
  double y;
  std::string s;
};

int main(int argc, char* argv[]) {
  X x[argc];
  return 0;
}

---
EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native -DMRTRIX_WORD64 /tmp/tmpCHtXtj.cpp -o /tmp/tmpCHtXtj.o
EXIT: 0
>>

EXEC <<
CMD: g++ /tmp/tmpCHtXtj.o -pthread -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
>>


REPORT: yes

REPORT: Checking for zlib compression library:

COMPILE /tmp/tmpp9KOCA.cpp:
---

#include <iostream>
#include <zlib.h>

int main() {
  std::cout << zlibVersion();
  return (0);
}

---
EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native -DMRTRIX_WORD64 /tmp/tmpp9KOCA.cpp -o /tmp/tmpp9KOCA.o
EXIT: 0
>>

EXEC <<
CMD: g++ /tmp/tmpp9KOCA.o -pthread -lz -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
STDOUT:
1.2.8
>>


REPORT: 1.2.8

REPORT: Checking for Eigen 3 library:
EXEC <<
CMD: pkg-config --cflags eigen3
EXIT: 0
STDOUT:
-I/usr/include/eigen3
>>


COMPILE /tmp/tmpscNVO9.cpp:
---

#include <Eigen/Core>
#include <iostream>

int main (int argc, char* argv[]) {
  std::cout << EIGEN_WORLD_VERSION << "." << EIGEN_MAJOR_VERSION << "." << EIGEN_MINOR_VERSION << "\n";
  return 0;
}

---
EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native -DMRTRIX_WORD64 -isystem /usr/include/eigen3 /tmp/tmpscNVO9.cpp -o /tmp/tmpscNVO9.o
EXIT: 0
>>

EXEC <<
CMD: g++ /tmp/tmpscNVO9.o -pthread -lz -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
STDOUT:
3.2.92
>>


REPORT: 3.2.92

REPORT: Checking Eigen 3 memory alignment requirements:

COMPILE /tmp/tmpUCStpy.cpp:
---

#include <iostream>
#include <Eigen/Core>

int main (int argc, char* argv[]) 
{
#ifdef EIGEN_DEFAULT_ALIGN_BYTES
  size_t default_align = std::numeric_limits<size_t>::max();
  for (size_t n = 0; n < 100; ++n) {
    struct alignas(64) X { double c[8]; };
    X* x = new X;
    size_t align = reinterpret_cast<size_t>(x) & 63U;
    if (align && align < default_align)
      default_align = align;
  }
  std::cout << "allocator memory alignment: " << default_align << ", Eigen3 needs: " << EIGEN_DEFAULT_ALIGN_BYTES << "\n";

  return default_align < EIGEN_DEFAULT_ALIGN_BYTES;
#else
  return 0;
#endif
}


---
EXEC <<
CMD: g++ -c -v -std=c++11 -mno-avx -pthread -fPIC -march=native -DMRTRIX_WORD64 -isystem /usr/include/eigen3 /tmp/tmpUCStpy.cpp -o /tmp/tmpUCStpy.o
EXIT: 0
STDERR:
Using built-in specs.
COLLECT_GCC=g++
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 
COLLECT_GCC_OPTIONS='-c' '-v' '-std=c++11' '-mno-avx' '-pthread' '-fPIC' '-march=native' '-D' 'MRTRIX_WORD64' '-isystem' '/usr/include/eigen3' '-o' '/tmp/tmpUCStpy.o' '-shared-libgcc'
 /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE -D_REENTRANT -D MRTRIX_WORD64 -isystem /usr/include/eigen3 /tmp/tmpUCStpy.cpp -march=broadwell -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mmovbe -maes -mno-sha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mbmi2 -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mrtm -mhle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-clwb -mno-pcommit -mno-mwaitx --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -mtune=generic -quiet -dumpbase tmpUCStpy.cpp -mno-avx -auxbase-strip /tmp/tmpUCStpy.o -std=c++11 -version -fPIC -fstack-protector-strong -Wformat -Wformat-security -o /tmp/cc03qFRv.s
GNU C++11 (Ubuntu 5.4.0-6ubuntu1~16.04.4) version 5.4.0 20160609 (x86_64-linux-gnu)
	compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/eigen3
 /usr/include/c++/5
 /usr/include/x86_64-linux-gnu/c++/5
 /usr/include/c++/5/backward
 /usr/lib/gcc/x86_64-linux-gnu/5/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU C++11 (Ubuntu 5.4.0-6ubuntu1~16.04.4) version 5.4.0 20160609 (x86_64-linux-gnu)
	compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: c3fdb80f2154421ceaf9e22c85325a8d
COLLECT_GCC_OPTIONS='-c' '-v' '-std=c++11' '-mno-avx' '-pthread' '-fPIC' '-march=native' '-D' 'MRTRIX_WORD64' '-isystem' '/usr/include/eigen3' '-o' '/tmp/tmpUCStpy.o' '-shared-libgcc'
 as -v --64 -o /tmp/tmpUCStpy.o /tmp/cc03qFRv.s
GNU assembler version 2.26.1 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.26.1
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-c' '-v' '-std=c++11' '-mno-avx' '-pthread' '-fPIC' '-march=native' '-D' 'MRTRIX_WORD64' '-isystem' '/usr/include/eigen3' '-o' '/tmp/tmpUCStpy.o' '-shared-libgcc'
>>

EXEC <<
CMD: g++ /tmp/tmpUCStpy.o -pthread -lz -o a.out
EXIT: 0
>>

EXEC <<
CMD: ./a.out
EXIT: 0
STDOUT:
allocator memory alignment: 16, Eigen3 needs: 16
>>


REPORT: OK

REPORT: Checking shared library generation:
EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native -DMRTRIX_WORD64 -isystem /usr/include/eigen3 /tmp/tmp6AIz58.cpp -o /tmp/tmp6AIz58.o
EXIT: 0
>>

EXEC <<
CMD: g++ /tmp/tmp6AIz58.o -pthread -shared -pthread -lz -o libtest.so
EXIT: 0
>>


REPORT: yes

REPORT: Checking for Qt moc:
EXEC <<
CMD: moc -v
EXIT: 0
STDOUT:
moc 5.5.1
>>


REPORT: moc (version 5.5.1)

REPORT: Checking for Qt qmake:
EXEC <<
CMD: qmake -v
EXIT: 0
STDOUT:
QMake version 3.0
Using Qt version 5.5.1 in /usr/lib/x86_64-linux-gnu
>>


REPORT: qmake (version 5.5.1)

REPORT: Checking for Qt rcc:
EXEC <<
CMD: rcc -v
EXIT: 0
STDOUT:
rcc 5.5.1
>>


REPORT: rcc (version 5.5.1)

REPORT: Checking for Qt:

source file "qt.h":
---
#include <QObject>

class Foo: public QObject {
  Q_OBJECT;
  public:
    Foo();
    ~Foo();
  public slots:
    void setValue(int value);
  signals:
    void valueChanged (int newValue);
  private:
    int value_;
};
---

source file "qt.cpp":
---
#include <iostream>
#include "qt.h"

Foo::Foo() : value_ (42) { connect (this, SIGNAL(valueChanged(int)), this, SLOT(setValue(int))); }

Foo::~Foo() { std::cout << qVersion() << "\n"; }

void Foo::setValue (int value) { value_ = value; }

int main() { Foo f; }
---

project file "qt.pro":
---
CONFIG += c++11
QT += core gui opengl svg
HEADERS += qt.h
SOURCES += qt.cpp
---
EXEC <<
CMD: qmake
EXIT: 0
>>

EXEC <<
CMD: moc qt.h -o qt_moc.cpp
EXIT: 0
>>

EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native -DMRTRIX_WORD64 -isystem /usr/include/eigen3 -m64 -pipe -O2 -std=c++0x -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtOpenGL -isystem /usr/include/x86_64-linux-gnu/qt5/QtSvg -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 qt.cpp -o qt.o
EXIT: 0
>>

EXEC <<
CMD: g++ -c -std=c++11 -mno-avx -pthread -fPIC -march=native -DMRTRIX_WORD64 -isystem /usr/include/eigen3 -m64 -pipe -O2 -std=c++0x -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtOpenGL -isystem /usr/include/x86_64-linux-gnu/qt5/QtSvg -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 qt_moc.cpp -o qt_moc.o
EXIT: 0
>>

EXEC <<
CMD: g++ -pthread -lz qt_moc.o qt.o -o qt -m64 -Wl,-O1 -L/usr/X11R6/lib64 -lQt5OpenGL -lQt5Svg -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
EXIT: 1
STDERR:
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
>>


ERROR: error linking Qt application!

  See the file 'configure.log' for details. If this doesn't help and you need
  further assistance, please post on the MRtrix3 community forum
  (http://community.mrtrix.org/), and make sure to include the full contents of
  the 'configure.log' file.
#2

The relevant error here is:

/usr/bin/ld: cannot find -lGL

which seems similar to this issue. I reckon you need to install the right libgl-dev package - but that unfortunately depends on your graphics drivers. If you are using the open-source drivers (mesa), then the correct package would be libgl1-mesa-dev (as per the installation instructions on the MRtrix3 documentation). But if you’re using the nvidia proprietary drivers, then according to this search, these should come with one of the nvidia-361, nvidia-340, or nvidia-304 packages (depending on your hardware). Try installing (or re-installing) whichever package is the right one, see what happens…

#3

Thanks, Donald, for the quick reply!

I was using the latest nvidia driver (375.26) for my card. I have installed an older version now, ended up with 367, which seems to have solved the problem. mrtrix is now running smoothly!

Thanks a lot for your help!

Samuel

#4

Hi,
I had the same issue. Following the suggestion of jdtournier, I updated my nvidia driver, which didn’t solve the issue.
Then, following the recommendation in a stackExchange post with title " Cannot find -lGL but I’ve installed the Nvidia driver", I ran the following command line to make a symbolic link to the nvidia driver:
sudo ln -s /usr/lib/nvidia-331/libGL.so /usr/lib/libGL.so
where you should replace nvidia-331 with the driver version in your system.
This solved the problem for me.

Dropping the line in here just in case anyone stumbles upon the same issue again. Hope this helps