title: undefined reference to `dlsym'
body: <p>I'm trying to cross compile QT for the raspberry PI 3 under Debian Stretch but when I use <code>make -j4</code> to compile QT, it gives the following error:</p>
  
  <pre><code>$ make -j4&gt;log
  /home/charlie/Rpi/qt5/qtbase/lib/libQt5EglSupport.a(qeglplatformcontext.o): In function `QEGLPlatformContext::getProcAddress(char const*)':
  qeglplatformcontext.cpp:(.text+0xa4): undefined reference to `dlsym'
  collect2: error: ld returned 1 exit status
  make[5]: *** [../../../../plugins/platforms/libqminimalegl.so] Error 1
  make[4]: *** [sub-minimalegl-make_first] Error 2
  make[4]: *** Waiting for unfinished jobs....
  /home/charlie/Rpi/qt5/qtbase/lib/libQt5EglSupport.a(qeglplatformcontext.o): In function `QEGLPlatformContext::getProcAddress(char const*)':
  qeglplatformcontext.cpp:(.text+0xa4): undefined reference to `dlsym'
  collect2: error: ld returned 1 exit status
  make[6]: *** [../../../../lib/libQt5EglFSDeviceIntegration.so.5.8.1] Error 1
  make[5]: *** [sub-eglfsdeviceintegration-pro-make_first-ordered] Error 2
  make[4]: *** [sub-eglfs-make_first] Error 2
  make[3]: *** [sub-platforms-make_first] Error 2
  make[2]: *** [sub-plugins-make_first] Error 2
  make[1]: *** [sub-src-make_first] Error 2
  make: *** [module-qtbase-make_first] Error 2
  </code></pre>
  
  <p>I have read a lot of similar posts containing the same dlsym error and I have tried the solutions given in them, but no luck so far. I have proceeded as it is shown in <a href="http://wiki.qt.io/Raspberry_Pi_Beginners_Guide" rel="nofollow noreferrer">here</a> and until now I still have doubts about the symlinks in lib directory. </p>
  
  <p>When I run <code>sudo file * | grep broken</code>, 2 symlinks are reported to be broken, even after running the script that supposedly fixes the symlinks (as sudo).</p>
  
  <pre><code>./fixQualifiedLibraryPaths /mnt/raspberry-rootfs/ ~/Rpi/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc
  </code></pre>
  
  <p>The symlinks that appear to be broken are listed below:</p>
  
  <pre><code>libblas.so.3gf:                     broken symbolic link to /etc/alternatives/libblas.so.3gf
  liblapack.so.3gf:                   broken symbolic link to /etc/alternatives/liblapack.so.3gf
  </code></pre>
  
  <p>The ./configure is executed as follows:</p>
  
  <pre><code>./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/Rpi/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/raspberry-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi
  </code></pre>
  
  <p>Do you guys can point me out what I am doing wroing?</p>
  
  <p>PD: I also installed the libncurses5 and lib32z1 and I obtained qt by git cloning. </p>