I am trying to build Qt 5 on a Nitrogen6x board powered by an *i.MX6Q`.
I've installed Debian/wheezy on the board and am using an Ubuntu 12.10 machine for cross-compiling.
Configuring Qt works like a charm but I am stuck in the make step.
This is the configure script I run:
./configure -v -opensource -confirm-license -reduce-relocations -no-pch -no-xcb -no-opengl -opengl es2 -qt-libpng -qt-zlib -qt-xkbcommon -qt-xcb -qt-pcre -qt-libjpeg -qt-sql-mysql -optimized-qmake\
-make libs -device imx6 \
-compile-examples \
-device-option CROSS_COMPILE=/home/finn/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabi- \
-sysroot /media/finn/d72e3b65-b529-4e5c-9d30-872e1b0c9973 \
-prefix /opt/qt5
And this is the error I receive about 5 minutes into the make process:
/home/finn/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld:
/media/finn/d72e3b65-b529-4e5c-9d30-872e1b0c9973/usr/lib/libm.a(mpa.o): relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/media/finn/d72e3b65-b529-4e5c-9d30-872e1b0c9973/usr/lib/libm.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
I've run into the same error before, when it was trying to access libz.a but adding the qt-zlib parameter to the configure command fixed that issue.
Many articles state that affected applications/libraries should be recompiled, however I don't think that's possible as libm is part of libc6.
I already tried reinstalling it using aptitude remove libc6-dev zlib1g-dev g++-4.6
and apt-get install gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev build-essential
Sadly this did not fix the problem.
Debian has been installed using the official network installer as well as a Kernel and an Overlay provided by Boundarydevices, the manufacturer of the board.
Does anyone has an idea how to fix this?
My next step would be to install a completely new Debian system but I would really like to avoid that.
Edit
Compiling qtbase with -static option works for me, however I am running into this error when trying to build qtdeclarative during the make step:
/home/finn/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o: No such file or directory
/home/finn/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find crti.o: No such file or directory
/home/finn/qt/qtbase/lib/libQt5Core.a(qlibrary_unix.o): In function `QLibraryPrivate::load_sys()':
qlibrary_unix.cpp:(.text+0xaac): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/finn/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lqxcb
/home/finn/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find /lib/arm-linux-gnueabihf/libpthread.so.0
/home/finn/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find /usr/lib/arm-linux-gnueabihf/libpthread_nonshared.a
collect2: error: ld returned 1 exit status
Edit 2 - Solution
I fixed the problem and successfully compiled Qt.
All I needed to do was reinstall Ubuntu. It sure isn't an elegant solution but it works for me.
A litte late, but I found the problem/solution:
The problem is the sysroot. Normally gcc links to shared libraries. But when it cant find it, gcc uses the static libraries (.a). When you look in [sysroot]/usr/lib/arm-linux-gnueabihf the shared libraries are not in this place. There are only symlinks to /lib/arm-linux-gnueabihf. So gcc looks for the shared libraries on you host-pc, where it can not find them.
Solution
Create just the right symlink. (Here's an example for libglib, the X is the version number)
ln -s [sysroot]/lib/arm-linux-gnueabihf/libglib.so.X \
[sysroot]/usr/lib/arm-linux-gnueabihf/libglib.so
(Dont forget to remove the old symlink and create it after compiling successfully; i just do the following before compiling:
mv file.so file.so.backup
another solution
Another solution is to change the absolut symlinks to relative ones.
For Example, if your library is /lib/arm-linux-gnueabihf/libglib.so.X and you need a link in /usr/lib/arm-linux-gnueabihf/, you just do:
ln -s ../../../lib/arm-linux-gnueabihf/libglib.so.X \
[sysroot]/usr/lib/arm-linux-gnueabihf/libglib.so
libm.a(mpa.o): relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object
Translation: you are trying to link non--fPIC compiled object file (mpa.o from libm.a) into a shared library. You can't do that.
You need to either find/install libm.so for your target, or configure qt5 to not build shared library (possibly with --disable-shared option).
Related
I am installing Qt6 using this guide on my fresh raspberry pi 4 running the latest official 32bit OS
https://www.tal.org/tutorials/building-qt-62-raspberry-pi
and i am stuck in the Configure the Qt 6.2 build portion where it asks me to execute this line
/opt/cmake/bin/cmake -G Ninja \
-DCMAKE_INSTALL_PREFIX=/opt/Qt/6.2.3-armv7l \
-DQT_FEATURE_opengles2=ON \
-DQT_FEATURE_opengles3=ON \
-DCMAKE_TOOLCHAIN_FILE=tc.cmake \
-DQT_AVOID_CMAKE_ARCHIVING_API=ON ../qtbase-everywhere-src-6.2.3
but i am getting an error
bash: /opt/cmake/bin/cmake: No such file or directory
I followed every step behore hand and there were no problems, everthing went smoothly exempt this part. Can anybody help me with this problem ?
If you have installed Cmake through apt, the default path should be
/usr/bin/cmake
Try to see if is there. If yes, you might want to replace
/opt/cmake/bin/cmake
with
/usr/bin/cmake
Another way to find if you have cmake installed somewhere else would be to run the command:
whereis cmake
I trying to compile a native build of Qt 5.7 (I've yet to do a cross-compilation of that thing...) on the Raspberry Pi 2. I have followed the tutorial on the official Qt wiki. The configure step I have is:
./configure -v -opengl es2 -tslib -force-pkg-config -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/usr/bin/ \
-opensource -confirm-license -optimized-qmake -reduce-exports -release -qt-pcre -make libs \
-prefix /usr/local/qt5 2>&1 | tee config.out
And my setup is similar to the one in the tutorial - I'm using an external USB stick with ext4 file system mounted at /media/USB and that a mount --bind from /media/USB/build/QT_SRC to /opt/QT_SRC. Prerequirements have been installed (including the libxcb-xinerama0 and libxcb-xinerama0-dev which the article points out as necessary for Qt5.6 and later). A !1GB swapfile was added to USB drive too.
After I executed ./configure I did
time make -j3 2>&1 | tee make.out
I've also tried plain make (without support of parallel compilation and linking). The result is the same:
/opt/QT_SRC/qtbase/bin/qmake -qtconf /opt/QT_SRC/qtbase/bin/qt.conf -o Makefile qt.pro
/opt/QT_SRC/qtbase/bin/qmake -qtconf /opt/QT_SRC/qtbase/bin/qt.conf -o Makefile qt.pro
/opt/QT_SRC/qtbase/bin/qmake -qtconf /opt/QT_SRC/qtbase/bin/qt.conf -o Makefile qt.pro
/opt/QT_SRC/qtbase/bin/qmake -qtconf /opt/QT_SRC/qtbase/bin/qt.conf -o Makefile qt.pro
/opt/QT_SRC/qtbase/bin/qmake -qtconf /opt/QT_SRC/qtbase/bin/qt.conf -o Makefile qt.pro
/opt/QT_SRC/qtbase/bin/qmake -qtconf /opt/QT_SRC/qtbase/bin/qt.conf -o Makefile qt.pro
...
...
...
/opt/QT_SRC/qtbase/bin/qmake -qtconf /opt/QT_SRC/qtbase/bin/qt.conf -o Makefile qt.pro
This is all that I'm getting. It repeats and repeats itself A LOT OF TIMES and for a LONG PERIOD OF TIME. I wanted to do part of the build while I was sleeping so I just ran make before I went to bed...6.5 hours ago. Now that I'm awake I found this...result. I obviously have the qmake in there otherwise an error would have been triggered but I have no idea what is happening here.
Has anyone tried to build Qt 5.7 on Raspberry Pi 2 and encountered this weird issue?
For some reason the top level configure is not working properly (at least in my case...). I had to go inside qtbase and run it from there. You can follow most of the instructions from the official guide on building Qt 5 natively on the Pi but it appears that not everything will be compiled and installed. The solution of this problem came from this post where it says:
cd to the top level directory of the Qt 5's sources
$ cd QT_SRC_ROOT_DIRECTORY
Choose which modules you would like to build and install and do
$ for module in qtcharts qtdatavis3d qtimageformats qtsvg ...;
> do
> cd QT_SRC_ROOT_DIRECTORY/$module
> QT_SRC_ROOT_DIRECTORY/qtbase/bin/qmake
> make
> sudo make install
> done
This basically loops through each module by going inside, running qmake (that is why you first have to compile what's inside qtbase so that you can have the qmake binary - except for the qtbase all other modules are based on pro files that is Qt project files which can be used only with a qmake tool), then make and finally sudo make install.
I used absolute paths (unlike in the mentioned blog post) since the ../$module inside the for loop didn't actually work but using absolute paths worked like a charm. So in my case I had /opt/QT_SRC as my QT_SRC_ROOT_DIRECTORY so I added it in that loop for accessing each $module. The qmake in my case was at /opt/QT_SRC/qtbase/bin/qmake.
Hope this helps someone else. I now have fully functional Qt 5.7 on my Raspberry Pi 2 including the GPL modules QtCharts and QtDataVisualization. Just tested the touch examples as well as the OpenGL Qt cube example - wonderful!
PS: The documenation on both native and cross-compile builds for the Pi needs serious updates and fixing...And research how to do things properly.
I ran into the same problem building Qt 5.7 on Raspberry Pi 3. I solved it by building and installing all modules individually, starting with qtbase like this:
$ .../qtbase/bin/qmake
$ make
$ make install
The order of building is important. I can't remember the order I followed but, some of the Qt modules yield an error if they need another module built first. Error messages are like this:
Some of the required modules (qtHaveModule(???)) are not available
I didn't build a few modules like qtwayland, qtwebview or qtwebengine because they need some other stuff installed and I don't need them.
After building Qt 5.7 and configuring my Raspberry Pi, I can run all my Qt applications successfully.
My machine use Ubuntu OS.
I built Qt 5.5.1 manually against static linking. Configuring the built, specified a path to install to:
$ ./configure -static -prefix /home/myname/qt_src/installed/
Then I moved the built stuff to another Ubuntu machine and tried call qmake from a shell:
$ qmake CONFIG+=release CONFIG-=debug /home/othername/project/q_panorama.pro -r -spec linux-g++
But I stucked with error
Could not find qmake configuration file linux-g++
Trying to fix it, I discovered that qmake's QTDIR (is it?) is incorrect:
$ qmake -v
QMake version 3.0
Using Qt version 5.5.1 in /home/myname/qt_src/installed/
Okay. Try to change special var with qmake -set option (here consider only one of vars - QT_INSTALL_PREFIX, - for simplicity). First, check it's consistency:
$ qmake -query QT_INSTALL_PREFIX
/home/myname/qt_src/installed/
Perform:
$ qmake -set QT_INSTALL_PREFIX "/home/othername/qt_static/"
Check again:
$ qmake -query QT_INSTALL_PREFIX
/home/myname/qt_src/installed/
Why the variable does not modify?
How can I make Manually Built static version of Qt work? Please, help.
Did not find the way to resolve the issue, and thus decided to act with brute force:
Created a user othername in my machine;
Run full build cycle for the path desired (under the user created).
Copied the built stuff to the target machine
PROFIT.
I try to compile Qt from sources, everything goes ok(more or less), except dbus part.
./configure -v -opensource -dbus-linked -arch i386
Configure shows this error:
1 error generated.
make: * [dbus.o] Error 1
D-Bus disabled.
The QtDBus module cannot be enabled because libdbus-1 version 0.93 was not found.
Turn on verbose messaging (-v) to ./configure to see the final report.
If you believe this message is in error you may use the continue
switch (-continue) to ./configure to continue.
I installed dbus 1.6 with Homebrew, but configure tool can't see it. Lib and headers are located in /usr/local/Cellar/d-bus/1.6.18. How to point configure to this location?
Platform is OS X.
Well the problem seems to be that, its not finding the dbus libraries.
Set the path of the library and the includes when you configure, something like this, assuming your dbus libraries and includes are in
/usr/local/Cellar/d-bus/1.6.18
./configure -v -opensource -arch i386 -dbus-linked -L/usr/local/Cellar/d-bus/1.6.18/lib -I/usr/local/Cellar/d-bus/1.6.18/include
where -I will tell qmake to include headers from that path and -L to link to the dbus libraries.
I want to use Matlab's C API within QT (http://www.mathworks.com/help/techdoc/matlab_external/f39876.html#bsfvqhp-1) under Windows for opening a .mat file. In my .pro file I have included
INCLUDEPATH += "C:\Program Files\MATLAB\R2010b\extern\include"
which works fine (the code compiles). But when trying to link the libmat.lib file (I have read the .dll files cannot be linked directly) using
LIBS += -L"C:\Program Files\MATLAB\R2010b\extern\lib\win32\microsoft" -llibmat
the application crashes on execution. The error given says [file].exe exited with code -1073741515
I'm neither a QT nor a Windows expert but for this project I am forced to use both (I guess it would be easier to fix this in GNU/Linux) so any help would be appreciated. Using Windows XP, QT version 4.7.0 with Qt Creator 2.0.1, and Matlab R2010b.
The last output from the compiler just in case it is useful:
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug/MainUI.exe debug/main.o debug/maingui.o debug/matparser.o debug/matutils.o debug/moc_maingui.o -L'c:/Qt/2010.05/qt/lib' -lmingw32 -lqtmaind "-LC:\Program Files\MATLAB\R2010b\extern\lib\win32\microsoft" -llibmat -lQtGuid4 -lQtCored4
I just tested building a simple C program that uses the MAT-File Interface Library with no problems. The example file is located in: matlabroot/examples/eng_mat/matcreat.c. I am compiling using MinGW on a Windows XP 32-bit machine. Here is the Makefile I used:
# root directory of MATLAB installation
MATLABROOT="/c/Program Files/MATLAB/R2010b"
.PHONY : all clean run
all: matcreat
matcreat:
gcc ${MATLABROOT}/extern/examples/eng_mat/matcreat.c -o matcreat \
-I${MATLABROOT}/extern/include \
-L${MATLABROOT}/extern/lib/win32/microsoft -llibmat -llibmx
clean:
rm -rf matcreat *.exe *.mat
run:
# UNIX uses LD_LIBRARY_PATH to find libs at runtime, Windows/MinGW uses PATH
#PATH=${MATLABROOT}/bin/win32:"${PATH}" ./matcreat
I suspect that the Matlab library will have been compiled with MSVC and since you say you are compiling your own code with MingW I would imagine the two are incompatible.
Have a look at the MingW page on mixing compilers for more information.