undefined reference to `dlsym' - qt

I'm trying to cross compile QT for the raspberry PI 3 under Debian Stretch but when I use make -j4 to compile QT, it gives the following error:
$ make -j4>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
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 here and until now I still have doubts about the symlinks in lib directory.
When I run sudo file * | grep broken, 2 symlinks are reported to be broken, even after running the script that supposedly fixes the symlinks (as sudo).
./fixQualifiedLibraryPaths /mnt/raspberry-rootfs/ ~/Rpi/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc
The symlinks that appear to be broken are listed below:
libblas.so.3gf: broken symbolic link to /etc/alternatives/libblas.so.3gf
liblapack.so.3gf: broken symbolic link to /etc/alternatives/liblapack.so.3gf
The ./configure is executed as follows:
./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
Do you guys can point me out what I am doing wroing?
PD: I also installed the libncurses5 and lib32z1 and I obtained qt by git cloning.

I ran into the same problem, proceeding as you did but using the gcc-5.4.1-linaro-gnueabihf toolchain. Unfortunately I did not find the root cause, but a workaround is calling configure like
LIBS=-ldl ./configure ...

with raspbian stretch egl libs has different names
/opt/vc/lib/libEGL.so -> /opt/vc/lib/libbrcmEGL.so
/opt/vc/lib/libGLESv2.so -> /opt/vc/lib/libbrcmGLESv2.so
so, I eddited this file in Qt sources:
./qtbase/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf
and changed
-lEGL -lGLESv2
to
-lbrcmEGL -lbrcmGLESv2

the symlinks was broken when mount to host,
$ cd /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/
$ sudo rm libdl.so
$ sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 libdl.so

I faced the same issue, tried to follow Miguel Angel Pons solution, but then realized that missed to update my raspberry with:
sudo rpi-update
Solution is taken from https://wiki.qt.io/RaspberryPi2EGLFS#Step_by_step. It is refferencing to https://bugreports.qt.io/browse/QTBUG-62216 and should fix the libraries exactly which compiler complains to.
After that I repeated 8 and 9 steps, cleaned up the source tree, reconfigured and finally successfully built qt for raspberry.

Related

I have a error in makefile while running xv6 in ubuntu

i have cloned the xv6-public repository in ubuntu virtual box and i have used the commands
$sudo apt-get install qemu
$git clone https://github.com/mit-pdos/xv6-public.git
$cd xv6-public
$make
$make qemu-nox
when i run make qemu-nox i am getting error like below
***
*** Error: Couldn't find a working QEMU executable.
*** Is the directory containing the qemu binary in your PATH
*** or have you tried setting the QEMU variable in Makefile?
***
nographic -drive file=fs.img,index=1,media=disk,format=raw -drive file=xv6.img,index=0,media=disk,format=raw -smp 2 -m 512
make: nographic: Command not found
make: [Makefile:231: qemu-nox] Error 127 (ignored)
can anyone give any solution for this
I've learned this solution from somebody named Amrollahi.
Try these steps, if your current step works, don't try the rest of it.
one:
make clean
make
make qemu
two:
sudo apt install qemu-system-x86
then repeat step one.
three:
try this link.
four:
you can also try this.

Eiffel 18.07 trying to get an ODBC connection running from examples

Trying to just compile Eiffel_18.07/examples/store/esql/ on Debian 9 I've got following error:
In file included from od243.c:202:0,
from big_file_C8_c.c:42:
/opt/Eiffel_18.07/library/store/dbms/rdbms/odbc/Clib/odbc.h:27:17: fatal error: sql.h: No such file or directory
#include <sql.h>
^
compilation terminated.
Makefile:36: recipe for target 'big_file_C8_c.o' failed
make[1]: *** [big_file_C8_c.o] Error 1
Makefile:72: recipe for target 'C8/Cobj8.o' failed
make: *** [C8/Cobj8.o] Error 2
make: *** Waiting for unfinished jobs....
an apt-get install unixodbc unixodbc-dev odbc-postgresql got me further to
gcc: error: /opt/Eiffel_18.07/library/store/spec/linux-x86-64/lib/libodbc.a: No such file or directory
Makefile:177: recipe for target 'esql' failed
When I try to go to /opt/Eiffel_18.07/library/store/dbms/rdbms/odbc/Clib thinking I'll be able to generate some code to get it working following the /opt/Eiffel_18.07/library/store/install into /opt/Eiffel_18.07/library/store/dbms/rdbms/odbc/Clib trying a sudo /opt/Eiffel_18.07/studio/spec/linux-x86-64/bin/finish_freezing -library
got
cp: cannot stat '/usr/include/eiffelstudio-18.07/config.sh': No such file or directory
Can't find config.sh.
Makefile.SH: 6: .: Can't open ./config.sh
Being a fan of Eiffel, it doesn't seem to be working out of the box and I didn't find enough documentation to get it working :-()
Here is a sequence of steps that allowed me to build the example on Ubuntu 16.04:
Download and unpack EiffelStudio in a new directory (let's denote the absolute path as #ES#).
Set environment variables:
export ISE_EIFFEL=#ES#
export ISE_PLATFORM=linux-x86-64
export PATH=$PATH:$ISE_EIFFEL/studio/spec/$ISE_PLATFORM/bin
These commands assume bash, replace them with equivalents when using another shell.
Install package unixodbc-dev:
sudo apt-get install unixodbc-dev
Compile C code of the Eiffel library store:
cd ${ISE_EIFFEL}/library/store/dbms/rdbms/odbc/Clib
finish_freezing -library
Note: no need to prefix finish_freezing with sudo unless EiffelStudio has been installed to a path without write permissions for ordinary users. Otherwise (e.g., for the original poster of the problem on Debian 9, where EiffelStudio has been installed under /opt), permissions have to be elevated:
sudo -i
cd ${ISE_EIFFEL}/library/store/dbms/rdbms/odbc/Clib
finish_freezing -library
exit
Compile the example esql:
cd ${ISE_EIFFEL}/examples/store/esql
ec -c_compile -config esql.ecf -target esql_odbc
Run the compiled executable:
./EIFGENs/esql_odbc/W_code/esql
Login as root changed my problem instead of only doing a sudo of the finish_freezing command
sudo -i
and then
cd ${ISE_EIFFEL}/library/store/dbms/rdbms/odbc/Clib
finish_freezing -library

gcc not found by win-builder

I've built an R package which includes C/C++ code. I am now trying to test this package on win-builder. Unfortunately, the following error is returned in 00install.out:
* installing *source* package 'mypackage' ...
** libs
running 'src/Makefile.win' ...
/usr/bin/make --directory=lib/mylib/
gcc -g -Wall -fPIC -c mycode.c
make[1]: gcc: Command not found
make[1]: *** [mycode.o] Error 127
make: *** [mylib] Error 2
Warning: running command 'make --no-print-directory -f "Makefile.win"' had status 2
ERROR: compilation failed for package 'mypackage'
* removing 'd:/RCompile/CRANguest/R-release/lib/mypackage'
Trying with gcc, gcc.exe, and cc yielded similar results.
Accordingly, I set up a testing environment on a Windows virtual machine according to these instructions. Running R CMD INSTALL . on the code from the command line within this environment resulted in the code compiling and the package installing without issue. (Running R CMD build . also yielded no errors.)
What's up with win-builder, and how can I achieve compilation on it?
Or, more importantly, is being able to build the package on Windows sufficient, regardless of whether it worked on win-builder?
My Makefile.win is as follows:
export CCOMP = gcc
export CPPCOMP = c++
export ADD_CC_FLAGS = -O3
APP_DIR = ./apps/myapp
LIB_DIR = ./lib/mylib
.PHONY: all $(APP_DIR) $(LIB_DIR)
all: $(APP_DIR) $(LIB_DIR)
$(APP_DIR) $(LIB_DIR): mylib
$(MAKE) --directory=$#
$(APP_DIR): $(LIB_DIR) mylib
mylib:
$(MAKE) --directory=lib/mylib
Inserting echo %PATH% into the make file under the mylib target yielded:
Makefile.win:24: *** missing separator. Stop.
You get an obscure error here because you included a file Makefile.win.
But the semantics of make, if such a file is found, it will be used ... which is not what you want here. R builds its own Makefile.win and you are supposed to only supply a snippet to be included -- which must be called Makevars.win.
That is rule number one. Rules number two is to not included all the material you would include in a Makefile -- as you would clobber what R already brings to the table. All this is in Writing R Extensions but could of course be clearer.
My pragmatic suggestion: take a package you know and like which has a working R build in win-builder, and modify it. You can test locally should you have access to an R system with Rtools etc pp.
Edit from OP:
I needed to compile an executable which relied on several libraries. The library codes were in src/libs and the executable's code was in src/apps. I ensured that running make within each subdirectory worked and set src/apps/Makefile to use relative paths to pull in the results of src/libs. The only problem then, was getting the whole chain running. To do so, I created a file src/Makevars.win which had the following structure:
.PHONY: all myprogram sublib1 sublib2
all: sublib1 sublib2 myprogram
myprogram: sublib1 sublib2
#(cd apps/myprogram && $(MAKE) CXX="$(CXX)" CC="$(CC)" CFLAGS="$(CFLAGS) $(CPICFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)")
sublib1:
#(cd lib/sublib1 && $(MAKE) CXX="$(CXX)" CC="$(CC)" CFLAGS="$(CFLAGS) $(CPICFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)")
sublib2:
#(cd lib/sublib2 && $(MAKE) CXX="$(CXX)" CC="$(CC)" CFLAGS="$(CFLAGS) $(CPICFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)")
As I understand it, Makevars.win gets embedded in a dynamically generated Makefile that R produces. So, $(CC) is actually referencing this hidden code.
(There are probably more clever ways to do this.)

Build QT statically ver 5.0.2

I am trying to build the QT static version by using the information from this link Qt - 4.7.3 - How to make static build. But i am using 5.0.2 as i have developed some applications using the same.
I am using windows 64 bit + MINGW32 and active-perl.
First-fix:
I had to comment the line number 45(if not exist %QTSRC%.gitignore goto sconf) in the file qt-everywhere-opensource-src-5.0.2\qtbase\configure.bat
My configuration command looks like this ..\qt-everywhere-opensource-src-5.0.2\configure -platform win32-g++ -static -release -no-opengl . This executed well without any errors.
Problem:
Now i run mingw32-make. And i get an error which says
/usr/bin/sh: c:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase/bin/qmake.exe: Invalid argument
mingw32-make[2]: *** [sub-tools-make_first] Error 126
I have pasted the entire error log below. Could any body please kindly point me the cause of this error or the solution.
Entire error log
C:\Qt\qt-everywhere-opensource-src-5.0.2\qt>mingw32-make
cd qtbase/ && ( test -e Makefile || C:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase/bin/qmake C:/Qt/qt-everywhere-ope
nsource-src-5.0.2/qt-everywhere-opensource-src-5.0.2/qtbase/qtbase.pro -o Makefile ) && mingw32-make -f Makefile
mingw32-make[1]: Entering directory `c:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase'
cd src/ && ( test -e Makefile || C:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase/bin/qmake C:/Qt/qt-everywhere-openso
urce-src-5.0.2/qt-everywhere-opensource-src-5.0.2/qtbase/src/src.pro -o Makefile ) && d:/tools/Dev-Cpp/MinGW32/bin/mingw
32-make -f Makefile
mingw32-make[2]: Entering directory `c:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase/src'
cd tools/ && ( test -e Makefile || c:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase/bin/qmake.exe C:/Qt/qt-everywhere-
opensource-src-5.0.2/qt-everywhere-opensource-src-5.0.2/qtbase/src/tools/tools.pro -o Makefile ) && d:/tools/Dev-Cpp/Min
GW32/bin/mingw32-make -f Makefile
/usr/bin/sh: c:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase/bin/qmake.exe: Invalid argument
mingw32-make[2]: *** [sub-tools-make_first] Error 126
mingw32-make[2]: Leaving directory `c:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase/src'
mingw32-make[1]: *** [sub-src-make_first] Error 2
mingw32-make[1]: Leaving directory `c:/Qt/qt-everywhere-opensource-src-5.0.2/qt/qtbase'
mingw32-make: *** [module-qtbase-make_first] Error 2
Static builds are supported from Qt 5.1, not 5.0. You might want to upgrade ;-)

Static Qt Build Cryptic Error

I am trying to do a static build of Qt (4.8.1) using mingw32-make (gcc 4.7.0) so that I can statically link my application for the sake of ease of use/delivery.
I keep getting a strange error from mingw32-make, though, which I do not understand.
../3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.h:270:103: warning: control reaches end of non-void function [-Wreturn-type]
Makefile.Release:2033: recipe for target 'obj/release/JSBase.o' failed
mingw32-make[2]: *** [obj/release/JSBase.o] Error 1
mingw32-make[2]: Leaving directory 'C:/StaticQt/qt/src/script'
Makefile:34: recipe for target 'release' failed
mingw32-make[1]: *** [release] Error 2
mingw32-make[1]: Leaving directory 'C:/StaticQt/qt/src/script'
Makefile:1360: recipe for target 'sub-script-sub_src_target_ordered' failed
mingw32-make: *** [sub-script-sub_src_target_ordered] Error 2
Looking in the associated Makefile.Release file, on the indicated lines, I find these:
Makefile.Release 2033: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/release/JSBase.o ../3rdparty/javascriptcore/JavaScriptCore/API/JSBase.cpp
Makefile.Release 1360: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/release/pcre_compile.o ../3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_compile.cpp
Makefile 34: $(MAKE) -f $(MAKEFILE).Release
I really understand very little about makefiles, so haven't a clue what these lines mean. Any help with this would be very much appreciated.
EDIT: it just occured to me it may be useful for people to know the commandline arguments I used... Well, I followed this guide: http://www.qtcentre.org/wiki/index.php?title=Building_static_Qt_on_Windows
There were syntax errors in the code for some reason. Somebody must've updated the Qt Git with the wrong code just before I downloaded it. I got the code from elsewhere and managed to get it to compile using visual studio's nmake instead... turned out it didn't really matter whether I used mingw or vc2008.

Resources