Qt 5.8 Cross Compile by arm-none-linux-gnueabi faild? - qt

I downloaded arm-none-linux-gnueabi from CodeSourcery version 2011, after set path and config with this command
sudo ./configure \
-opengl es2 -no-xcb\
-release -silent \
-continue \
-opensource -confirm-license \
-prefix $DEVICE_PREFIX \
-hostprefix $HOST_PREFIX \
-sysroot $SYSTEM_ROOT \
-device $TARGET_DEVICE \
-device-option CROSS_COMPILE=${CC} \
-qt-libpng \
-qt-libjpeg \
-nomake examples \
-nomake tests
Get this Error :
executing config test use_gold_linker
+ cd /home/amin/EMA/qt-everywhere-opensource-src-5.8.0/qtbase/config.tests && arm-none-linux-gnueabi-g++ -fuse-ld=gold -o conftest-out conftest.cpp
cc1plus: error: unrecognized command line option '-fuse-ld=gold'
test config.qtbase.tests.use_gold_linker FAILED
executing config test verifyspec
+ cd /home/amin/EMA/qt-everywhere-opensource-src-5.8.0/qtbase/config.tests/common/verifyspec && /home/amin/EMA/qt-everywhere-opensource-src-5.8.0/qtbase/bin/qmake -qtconf /home/amin/EMA/qt-everywhere-opensource-src-5.8.0/qtbase/bin/qt.conf "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += static console" "QMAKE_CFLAGS += --sysroot=/" "QMAKE_CXXFLAGS += --sysroot=/" "QMAKE_LFLAGS += --sysroot=/" /home/amin/EMA/qt-everywhere-opensource-src-5.8.0/qtbase/config.tests/common/verifyspec
+ cd /home/amin/EMA/qt-everywhere-opensource-src-5.8.0/qtbase/config.tests/common/verifyspec && MAKEFLAGS= /usr/bin/make
arm-none-linux-gnueabi-g++ -c -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mthumb -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mthumb -mfloat-abi=softfp --sysroot=/ -O2 -O3 -Wall -W -fPIC -I. -I/home/amin/EMA/qt-everywhere-opensource-src-5.8.0/qtbase/mkspecs/devices/linux-beagleboard-g++ -o verifyspec.o verifyspec.cpp
arm-none-linux-gnueabi-g++ -mfloat-abi=softfp --sysroot=/ -Wl,-O1 -o verifyspec verifyspec.o -lrt -lpthread -ldl
/home/amin/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.6.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find crt1.o: No such file or directory
/home/amin/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.6.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find crti.o: No such file or directory
/home/amin/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.6.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lrt
/home/amin/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.6.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lpthread
/home/amin/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.6.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -ldl
/home/amin/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.6.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lstdc++
/home/amin/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.6.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lm
/home/amin/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.6.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lgcc_s
/home/amin/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.6.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lc
/home/amin/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.6.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lgcc_s
/home/amin/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.6.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find crtn.o: No such file or directory
collect2: ld returned 1 exit status
Makefile:64: recipe for target 'verifyspec' failed
make: *** [verifyspec] Error 1

Your compilation log shows that it was trying to use the gold linker, however the command was not found. The later error of missing libraries and object files presumably stem from this error.
gold is a relatively recent addition to the GNU toolchain, and you're using a fairly old version (gcc 4.6.1) so I would suggest upgrading your toolchain to the most recent one, unless you have really good reasons not to do so.

Qt is quite opinionated when it comes to toolchain selection. There's a list of supported compilers which does not include something based on GCC 4.6. Given that Qt requires C++11 support these days, your chances of getting this working with an ancient compiler are severely limited.
Linaro provides nice toolchains for download. Is there any reason why you are not using one? Alternatively, you also likely require some additional SW on your BBB, so chances are that you're using a distribution like Debian or a building tool such as Buildroot or Yocto for producing your images. BeagleBone Black is a mainstream platform with support provided by essentially anything targetting embedded platforms.
A TL;DR version: Update your toolchain or your build environment. Qt is no simple library.

Related

Passing several linker flags when installing an R package

I want to compile an R package with specific linker flags. In my case, I want to use -rpath to "hard code" some library paths for the package so I don't have to have them always in my LD_LIBRARY_PATH.
If I simply try to do so using R's environment variables, it seems to have no effect:
Sys.setenv(LDFLAGS="-Wl,-rpath,/stornext/System/data/tools/proj/proj-4.9.3/lib -Wl,-rpath,/stornext/System/data/apps/geos/geos-3.7.0/lib")
install.packages("sf")
The final gcc invocation is:
/stornext/System/data/apps/gcc/gcc-11.1.0/bin/g++ -std=gnu++11 -shared -L/stornext/System/data/apps/R/R-4.2.1/lib64/R/lib -L/usr/local/lib64 -o sf.so RcppExports.o bbox.o gdal.o gdal_geom.o gdal_read.o gdal_utils.o gdal_write.o geos.o hex.o mdim.o ops.o polygonize.o proj.o proj_info.o raster2sf.o sfc-sfg.o signed_area.o stars.o wkb.o zm_range.o -L/stornext/System/data/tools/proj/proj-4.9.3/lib -lproj -L/stornext/System/data/tools/gdal/gdal-2.4.4/lib -lgdal -L/stornext/System/data/apps/geos/geos-3.7.0/lib -lgeos_c -L/stornext/System/data/apps/R/R-4.2.1/lib64/R/lib -lR
And when I check the final .so file with readelf -d, I can see that the RPATH headers are missing.
If I try to add them via configure, that doesn't work either:
install.packages("sf", configure.vars="LDFLAGS=-Wl,-rpath,/stornext/System/data/tools/proj/proj-4.9.3/lib -Wl,-rpath,/stornext/System/data/apps/geos/geos-3.7.0/lib -Wl,-rpath,/stornext/System/data/tools/gdal/gdal-2.4.4/lib")
This gives me:
sh: -Wl,-rpath,/stornext/System/data/apps/geos/geos-3.7.0/lib: No such file or directory
In this case, the flags are being passed through numerous stages in order to finally get to the makefile: they go from R to R CMD INSTALL in the shell, then to the configure script, so escaping quotes and spaces seems incredibly difficult here.
Can anyone offer help as to how to provide multiple linker flags when compiling an R package?

Installation of Qt 4.8.7 in Ubuntu 18.04.1 LTS

I am trying to install Qt 4.8.7 from source (https://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz) in a virtual machine running Ubuntu 18.04.1 LTS
So the commands I follow are:
mkdir Qt
cd Qt
wget https://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz
tar -xzf qt-everywhere-opensource-src-4.8.7.tar.gz
mv qt-everywhere-opensource-src-4.8.7 Qt-Source
cd Qt-Source
./configure
Then I choose the Open Source Edition, accept the terms of License. After that it displays:
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /usr/local/Trolltech/Qt-4.8.7
So ...
make
and I have the next error;
Another thing is that in the process of running make, there are a lot of errors like these:
Could you help me? Please
eyllanesc,
I faced the same problem as you a few days ago. And after many tries I did it.
First of all, you'll need to install another gcc and g++ version elder (I choose 4.8 version).
Follow the instructions in this another answer:
GCC & C++ alternatives
And edit the file:
mkspecs/linux-g++-64/qmake.conf
QMAKE_CFLAGS = -std=gnu++98 -fpermissive
QMAKE_LFLAGS = -std=gnu++98 -fpermissive
QMAKE_CXXFLAGS = -std=gnu++98 -fpermissive
With these flags the compiler will use C++98 version. Like
Bart_Vandewoestyne solution.
Then run:
./configure -opensource -nomake demos -nomake examples -nomake tests -debug-and-release -qt3support -no-openssl -no-webkit
make -jN
sudo make install
After the complete installation back the default gcc and g++ versions:
cd /usr/bin
sudo mv g++ g++-4.8_
sudo ln -s g++-7 g++
sudo mv gcc gcc-4.8_
sudo ln -s gcc-7 gcc
And test:
gcc --version
g++ --version
Now it's time to compile some code. But, before this we need to unchanged the modifications on our mkspec:
cd /usr/local/Trolltech/Qt-4.8.4/mkspecs/linux-g++-64/
nano qmake.conf
And comment the lines changed and back to the original configuration:
#QMAKE_CFLAGS = -std=gnu++98 -fpermissive
#QMAKE_LFLAGS = -std=gnu++98 -fpermissive
#QMAKE_CXXFLAGS = -std=gnu++98 -fpermissive
QMAKE_CFLAGS = -m64
QMAKE_LFLAGS = -m64
QMAKE_CXXFLAGS = -m64
Now your change you *.pro file adding or change these lines:
QMAKE_CXX = g++-7
QMAKE_CC = gcc-7
Let me know if it works. For me everything it's fine.

How to make Qt static build run without install vc_redist.x64.exe

I want to build Qt 5.10.1 using MSVC2015, and without MSVC Runtime.
Followed http://amin-ahmadi.com/2016/09/22/how-to-build-qt-5-7-statically-using-msvc14-microsoft-visual-studio-2015/
Configure:
configure -static -debug-and-release -prefix
"C:\Qt\5.10.1-static-msvc2015" -platform win32-msvc2015 -qt-zlib
-qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -sql-sqlite -sql-odbc -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests
modified src\qtbase\mkspecs\common\msvc-desktop.conf change -MD to -MT.
No error during building, but if I don't install MSVC runtime when I run my program will get:
api-ms-win-crt-runtime-l1-1-0.dll missing.
How to make the MSVC static standalone like Mingw static build?
The output of compiling test program:
cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline
-Zc:strictStrings -Zc:throwingNew -O2 -MT -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DNDEBUG
If I don't do step 2, the output will be -MD.
So Why the -MT (step 2) didn't work?
If you having any idea or guessing, Please comment.
Update:
Win10 64
No matter I add -static-runtime or not, both can run with without vc_redist
Win 7 32
Qt 5.10.1 compilation passed, but got api-ms-win-core-winrt-l1-1-0.dll is missing when executing the program.
Even I reinstall vc_redist still got the error...
Relate: Why installed vc_redist still gives api-ms-win-core-winrt-l1-1-0.dll is missing
Qt 5.11.1 compilation also passed, but got C1083: 'QtCore/qglobal.h':No such file or directory when building the program.
Compiling Qt sources from Qt 5.5.0 you can pass -static-runtime argument to configure for static runtime.
Changes 5.5.0:
[Windows] Added -static-runtime option.
Config Options:
-static-runtime ...... With -static, use static runtime [no] (Windows only)

Cute Report Test Fail

I'm testing a Cute report writer, working with QT. My problem is that when i add the include directory to the .pro file i get the following error:
11:50:41: Running steps for project ReportTest...
11:50:41: Starting: "C:\Qt\5.9.1\mingw53_32\bin\qmake.exe" C:\Users\dkolb\Documents\Develop\test\ReportTest\ReportTest.pro -spec win32-g++
Info: creating stash file C:\Users\dkolb\Documents\Develop\test\build-ReportTest-Desktop_Qt_5_9_1_MinGW_32bit-Release\.qmake.stash
11:50:44: The process "C:\Qt\5.9.1\mingw53_32\bin\qmake.exe" exited normally.
11:50:44: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" qmake_all
mingw32-make: Nothing to be done for 'qmake_all'.
11:50:48: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited normally.
11:50:48: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe"
C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Users/dkolb/Documents/Develop/test/build-ReportTest-Desktop_Qt_5_9_1_MinGW_32bit-Release'
'C:\Qt\5.9.1\mingw53_32\bin\uic.exe' ../ReportTest/mainwindow.ui -o ui_mainwindow.h
g++ -c -fno-keep-inline-dllexport -pipe -O2 -std=gnu++11 -Wextra -Wall -W -fexceptions -mthreads -DUNICODE -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../ReportTest -I. -I"C:/Program Files (x86)/ExaroLogic/CuteReport/development/include/cutereport" -IC:/Qt/5.9.1/mingw53_32/include -IC:/Qt/5.9.1/mingw53_32/include/QtWidgets -IC:/Qt/5.9.1/mingw53_32/include/QtGui -IC:/Qt/5.9.1/mingw53_32/include/QtANGLE -IC:/Qt/5.9.1/mingw53_32/include/QtCore -Irelease -I. -IC:/Qt/5.9.1/mingw53_32/mkspecs/win32-g++ -o release/main.o ../ReportTest/main.cpp
Makefile.Release:346: recipe for target 'release/main.o' failed
mingw32-make[1]: Leaving directory 'C:/Users/dkolb/Documents/Develop/test/build-ReportTest-Desktop_Qt_5_9_1_MinGW_32bit-Release'
Makefile:36: recipe for target 'release' failed
mingw32-make[1]: *** [release/main.o] Error -1073741502
mingw32-make: *** [release] Error 2
11:50:58: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project ReportTest (kit: Desktop Qt 5.9.1 MinGW 32bit)
When executing step "Make"
11:50:58: Elapsed time: 00:17.
For testing I'm using an empty gui application.It does compile when i take the include out.
I have download the 32bit version of the report writer as i'm compiling on 32bits, but i don't think that QT is even near the dlls. Here is the .pro file:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = ReportTest
TEMPLATE = app
INCLUDEPATH += "C:/Program Files (x86)/ExaroLogic/CuteReport/development/include/cutereport"
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui

How do I build sqlite with static library also be compiled with -fPIC?

I have compiled using below parameters
#./configure --prefix=/usr/local CFLAGS=-fPIC --enable-static --enable-shared \
CFLAGS="-g -O2 -DSQLITE_ENABLE_FTS3=1 \
-DSQLITE_ENABLE_COLUMN_METADATA=1 \
-DSQLITE_ENABLE_UNLOCK_NOTIFY=1 \
-DSQLITE_SECURE_DELETE=1 \
-DSQLITE_ENABLE_DBSTAT_VTAB=1"
# make -j 8
# make install
After using sqlite I get below error message:
/usr/bin/g++ -o utools/utools.so -Wl,-Bsymbolic -g -O2 -shared -Wl,-z,defs utools/utools.plugin.o utools/lib/libutools.a core/lib/libunv.a fv/lib/libfv.a sb/lib/libsb.a -lz -ldl
/usr/bin/ld: /usr/local/sqlite/lib/libsqlite3.a(sqlite3.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/sqlite/lib/libsqlite3.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
scons: *** [stdarm/stdarm.so] Error 1
scons: building terminated because of errors.
inside /usr/local/lib/ directory, deleting following files worked for me
libsqlite3.a
libsqlite3.la
libsqlite3.o.0.bak
libsqlite3.so
I think these files are from the older versions of libsqlite3,
because when you type and check dpkg -L libsqlite3-dev, none goes to /usr/local/lib/
I took the reference from sqlite3 breakage

Resources