Crosscompiling Qt4: uic segfaults - qt

For a dated embedded project I try to crosscompile Qt 4.7.4 on a current Ubuntu 16.04 x86_64 system with multiarch setup (amd64 + i386).
The crosscompilation was once set up for Ubuntu 12.04 x86, and it works well there. Compiling it on the new system for host debugging (host and target platform being set to x86/i386/32 bit) worked well, too. However, when I try to crosscompile it for the target system (arm) with the host set to i386 uic segfaults while building the QtGui lib.
The following relevant flags are used to configure Qt for the target system:
-host-arch i386 -platform qws/linux-x86-g++
-embedded arm -xplatform qws/linux-gnueabi-arm-mucross-g++
Furthermore mkspecs/qws/linux-x86-g++/qmake.conf has been patched to include some compiler flags that seem necessary to get compilation and linking right:
QT_ARCH = I386
QMAKE_CFLAGS += -m32
QMAKE_CXXFLAGS += -m32
QMAKE_LFLAGS += -m32
This is the call that fails:
/<project>/qt-target/bin/uic /<project>/qt-everywhere-opensource-src-4.7.4/src/gui/dialogs/qpagesetupwidget.ui -o .uic/release-shared-emb-arm/ui_qpagesetupwidget.h
I can reproduce the segfault manually and debug it. strace doesn't show anything obvious, the correct i386 libs are being loaded. Here's the first lines of the gdb backtrace:
Program received signal SIGSEGV, Segmentation fault.
__GI___fesetenv (envp=0xffffbbd4) at ../sysdeps/i386/fpu/fesetenv.c:116
116 ../sysdeps/i386/fpu/fesetenv.c: Datei oder Verzeichnis nicht gefunden.
(gdb) backtrace
#0 __GI___fesetenv (envp=0xffffbbd4) at ../sysdeps/i386/fpu/fesetenv.c:116
#1 0x080fa7de in qdtoa (d=9999.9899999999998, mode=2, ndigits=6,
decpt=0xffffbce8, sign=0xffffbcec, rve=0xffffbcf4, resultp=0xffffbcf8)
at /<project>/qt-everywhere-opensource-src-4.7.4/src/corelib/tools/qlocale.cpp:6655
#2 0x080fc230 in QLocalePrivate::doubleToString (
this=0x8181160 <locale_data>, d=9999.9899999999998, precision=2,
form=<optimized out>, width=0, flags=<optimized out>)
at /<project>/qt-everywhere-opensource-src-4.7.4/src/corelib/tools/qlocale.cpp:4012
#3 0x0811da6f in QString::setNum (this=0xffffbf78, n=9999.9899999999998,
f=<optimized out>, prec=6)
at /<project>/qt-everywhere-opensource-src-4.7.4/src/corelib/tools/qstring.cpp:5930
#4 0x0811ddca in QString::number (n=9999.9899999999998, f=103 'g', prec=6)
at /<project>/qt-everywhere-opensource-src-4.7.4/src/corelib/tools/qstring.cpp:6034
Some investigation brought me to a glibc bug in fesetenv() which was fixed in glibc 2.23, but since this is already installed (libc6 2.23-0ubuntu3), I didn't get any further here. The faulting line 116 has been introduced by that fix, but lacking knowledge of the internals I'm not able to point out the cause of the segfault:
__asm__ ("ldmxcsr %0" : : "m" (mxcsr));
Furthermore there are some old, closed or unresolved Qt bug reports regarding the bootstrap build (which includes uic), but these didn't give me any useful hints either.
Who can give a pointer what I can try to find the cause and work around or fix this issue?

The reason for this problem was that additional, target specific include and lib dirs were provided to the configure script using the -I and -L options. These were used for the bootstrap build, too, which didn't matter much on the old system where the headers of host and target where apparently close enough to each other.
Once moved into the target mkspec file and added to QMAKE_CFLAGS, QMAKE_CXXFLAGS and QMAKE_LFLAGS the build process works fine.

Related

How to solve this error in Arduino code ESP32 Board + PS4 controller [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
In the end of this error message there is "exit status1"
Error compiling for board ESP32 Dev Module.
Could somebody explain me what it means (cause of it) and how to solve it ?
Arduino: 1.8.13 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"
Compiling core...
Using precompiled core:
C:\Users\Zero\AppData\Local\Temp\arduino_cache_137710\core\core_faddaac1d69e7dde1f9d30f3045a530a.a
Linking everything together...
"C:\Users\Zero\AppData\Local\Arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-97-gc752ad5-5.2.0/bin/xtensa-esp32-elf-gcc" -nostdlib "-LC:\Users\Zero\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6/tools/sdk/lib" "-LC:\Users\Zero\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6/tools/sdk/ld" -T esp32_out.ld -T esp32.project.ld -T esp32.rom.ld -T esp32.peripherals.ld -T esp32.rom.libgcc.ld -T esp32.rom.spiram_incompatible_fns.ld -u esp_app_desc -u ld_include_panic_highint_hdl -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,--undefined=uxTopUsedPriority -u __cxa_guard_dummy -u __cxx_fatal_exception -Wl,--start-group
"C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\sketch\Pokus_o_Arduino_PS4_a_GPIO-23_50Hz_1000-2000us_do_ODrivu.ino.cpp.o"
"C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\ESP32Servo\ESP32PWM.cpp.o"
"C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\ESP32Servo\ESP32Servo.cpp.o"
"C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\ESP32Servo\ESP32Tone.cpp.o"
"C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\ESP32Servo\analogWrite.cpp.o"
"C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\PS4-esp32-master-AED3\ps4.c.o"
"C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\PS4-esp32-master-AED3\ps4_gap.c.o"
"C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\PS4-esp32-master-AED3\ps4_parser.c.o"
"C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\PS4-esp32-master-AED3\ps4_spp.c.o"
"C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\PS4-esp32-master-AED3\PS4Controller.cpp.o"
"C:\Users\Zero\AppData\Local\Temp\arduino_cache_137710\core\core_faddaac1d69e7dde1f9d30f3045a530a.a" -lgcc -lesp_websocket_client -lwpa2 -ldetection -lesp_https_server -lwps -lhal -lconsole -lpe -lsoc -lsdmmc -lpthread -llog -lesp_http_client -ljson -lmesh -lesp32-camera -lnet80211 -lwpa_supplicant -lc -lmqtt -lcxx -lesp_https_ota -lulp -lefuse -lpp -lmdns -lbt -lwpa -lspiffs -lheap -limage_util -lunity -lrtc -lmbedtls -lface_recognition -lnghttp -ljsmn -lopenssl -lcore -lfatfs -lm -lprotocomm -lsmartconfig -lxtensa-debug-module -ldl -lesp_event -lesp-tls -lfd -lespcoredump -lesp_http_server -lfr -lsmartconfig_ack -lwear_levelling -ltcp_transport -llwip -lphy -lvfs -lcoap -lesp32 -llibsodium -lbootloader_support -ldriver -lcoexist -lasio -lod -lmicro-ecc -lesp_ringbuf -ldetection_cat_face -lapp_update -lespnow -lface_detection -lapp_trace -lnewlib -lbtdm_app -lwifi_provisioning -lfreertos -lfreemodbus -lethernet -lnvs_flash -lspi_flash -lc_nano -lexpat -lfb_gfx -lprotobuf-c -lesp_adc_cal -ltcpip_adapter -lstdc++ -Wl,--end-group -Wl,-EL -o
"C:\Users\Zero\AppData\Local\Temp\arduino_build_197658/Pokus_o_Arduino_PS4_a_GPIO-23_50Hz_1000-2000us_do_ODrivu.ino.elf"
C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\PS4-esp32-master-AED3\ps4_gap.c.o:(.literal.gapInitService+0x1c): undefined reference to `GAP_ConnOpen'
C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\PS4-esp32-master-AED3\ps4_gap.c.o:(.literal.gapEventHandle+0xc): undefined reference to `GAP_ConnGetL2CAPCid'
C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\PS4-esp32-master-AED3\ps4_gap.c.o:(.literal.gapEventHandle+0x10): undefined reference to `GAP_ConnBTRead'
C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\PS4-esp32-master-AED3\ps4_gap.c.o:(.literal.gapSendHid+0x14): undefined reference to `GAP_ConnBTWrite'
C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\PS4-esp32-master-AED3\ps4_gap.c.o: In function `gapInitService':
C:\Users\Zero\Documents\Arduino\libraries\PS4-esp32-master-AED3\src/ps4_gap.c:48: undefined reference to `GAP_ConnOpen'
C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\PS4-esp32-master-AED3\ps4_gap.c.o: In function `gapUpdateConnected':
C:\Users\Zero\Documents\Arduino\libraries\PS4-esp32-master-AED3\src/ps4_gap.c:48: undefined reference to `GAP_ConnGetL2CAPCid'
C:\Users\Zero\Documents\Arduino\libraries\PS4-esp32-master-AED3\src/ps4_gap.c:48: undefined reference to `GAP_ConnGetL2CAPCid'
C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\PS4-esp32-master-AED3\ps4_gap.c.o: In function `gapEventHandle':
C:\Users\Zero\Documents\Arduino\libraries\PS4-esp32-master-AED3\src/ps4_gap.c:48: undefined reference to `GAP_ConnBTRead'
C:\Users\Zero\AppData\Local\Temp\arduino_build_197658\libraries\PS4-esp32-master-AED3\ps4_gap.c.o: In function `gapSendHid':
C:\Users\Zero\Documents\Arduino\libraries\PS4-esp32-master-AED3\src/ps4_gap.c:88:
undefined reference to `GAP_ConnBTWrite'
collect2.exe: error: ld returned 1 exit status
Using library ESP32Servo at version 0.9.0 in folder: C:\Users\Zero\Documents\Arduino\libraries\ESP32Servo
Using library PS4-esp32-master-AED3 at version 2.0 in folder: C:\Users\Zero\Documents\Arduino\libraries\PS4-esp32-master-AED3
exit status 1
Error compiling for board ESP32 Dev Module.
What version of your Arduino IDE? I already had this error using version 1.5.x, so I reinstalled for version 1.6.x and the code compiled.
This kind of linker (ld) error generally means that the functions were declared (probably in a header file) but they were not actually defined (usually done in a .cpp file). This is probably because the library did not get installed correctly and completely.

Linking problem when using open-mpi (using the wrappers)

At the linking stage, I am getting an error of the form:
Undefined symbols for architecture x86_64:
"_mpi_allreduce", referenced from:
_pcnaup2 in libparpack.a(pcnaup2.o)
_pslamch in libparpack.a(pslamch.o)
_pcgetv0 in libparpack.a(pcgetv0.o)
_pcnaitr in libparpack.a(pcnaitr.o)
_pscnorm2 in libparpack.a(pscnorm2.o)
"_mpi_comm_rank", referenced from:
_pcnaupd in libparpack.a(pcnaupd.o)
_pcmout in libparpack.a(pcmout.o)
_pcvout in libparpack.a(pcvout.o)
_pivout in libparpack.a(pivout.o)
_pcgetv0 in libparpack.a(pcgetv0.o)
_psvout in libparpack.a(psvout.o)
when I am trying to link with mpifort, so that the command that is being run looks like
mpifort -L(lots of libraries) -l(lots of libraries) -o qlua qlua.o
though I am confused; because I was under the impression that using the wrapper mpifort should handle all the linking to the mpi library for me, so I'm not too sure what steps I should take to debug such an error. For completeness, when I run mpifort -v the output is:
Using built-in specs.
COLLECT_GCC=/usr/local/bin/gfortran
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/10.2.0_2/libexec/gcc/x86_64-apple-darwin19/10.2.0/lto-wrapper
Target: x86_64-apple-darwin19
Configured with: ../configure --build=x86_64-apple-darwin19 --prefix=/usr/local/Cellar/gcc/10.2.0_2 --libdir=/usr/local/Cellar/gcc/10.2.0_2/lib/gcc/10 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-10 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 10.2.0_2' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk SED=/usr/bin/sed
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (Homebrew GCC 10.2.0_2)

QT can't build - "Some of the required modules (!win32-g++) are not available"

I pulled down the qtpdf repository to check out and play with from here:
http://code.qt.io/cgit/qt-labs/qtpdf.git
As soon as I open the qtpdf.pro file, I get the following general messages:
Cannot read C:/.../build-qpdf-Desktop_Qt_5_10_0_MinGW_32bit-Debug/src/lib/pdfium.pri: No such file or directory
Cannot read C:/.../build-qpdf-Desktop_Qt_5_10_0_MinGW_32bit-Debug/src/lib/freetype.pri: No such file or directory
Project MESSAGE: perl -w C:\Qt\5.10.0\mingw53_32\bin\syncqt.pl -module QtPdf -version 5.9.0 -outdir "C:/.../build-qpdf-Desktop_Qt_5_10_0_MinGW_32bit-Debug" C:/.../qtpdf
Project MESSAGE: perl -w C:\Qt\5.10.0\mingw53_32\bin\syncqt.pl -module QtPdfWidgets -version 5.9.0 -outdir "C:/.../build-qpdf-Desktop_Qt_5_10_0_MinGW_32bit-Debug" C:/.../qtpdf
Project ERROR: Unknown module(s) in QT: pdfwidgets
Project ERROR: Unknown module(s) in QT: pdf
Also when running "rebuild all" I get the following error message:
16:15:33: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" qmake_all
"Some of the required modules (!qnx:!uikit:!winphone:!winrt:!win32-g++:!integrity) are not available."
"Skipped."
I've narrowed this down to !win32-g++ - If I remove that, it won't throw that error, but I don't understand what exactly this error means - I have googled around a lot but couldn't find anything that seemed reminiscent of this particular problem.
I managed to build qtpdf with mingw provided with Qt5.11.2.
Comment out "requires(!qnx:!uikit:!winphone:!winrt:!win32-g++:!integrity)" from pdf.pro
Apply the patch found here : https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-pdfium-git/pdfium-2729.patch (link dead in 2021, no backup sorry)
Add -luuid after "win32: LIBS_PRIVATE += -ladvapi32 -lgdi32 -luser32" in lib.pro
I don't know why, probably because I am not an expert, but mingw doesn't generate correctly the folder "include". As a workaround I use the one generated under linux. For some reason, mingw generate only QPdfDepends and QPdfWidgetsDepends, none of the needed headers are generated. I didn't dig because I am lazy.
Hope it helps !
# Upstream PDFium has not been ported to various platforms yet.
requires(!qnx:!uikit:!winphone:!winrt:!win32-g++:!integrity)
The module is not working on win32-g++ (mingw32).

basic_client which is built with Makefile BusAttachment::Connect failed

I just built standard core 15.09a on linux and run sample apps basic_client.
This one built by scons.
bin/samples/basic_client works fine.
However, I built cpp/samples/basic/basic_client with Makefile.
It does not work. It shows an error
"0.232 ****** ERROR ALLJOYN external ...e/src/BusAttachment.cc:560 | BusAttachment::Connect failed: ER_OS_ERROR
BusAttachment::Connect('') failed.".
So, I launched the bin/allhoyn-daemon, then no error occurred.
What is difference between scon and Makefile version?
Additionally, where can I get the information of application under the bin directory?
I searched the web-site of AllSeen and couldn't find any info.
As i know, the error that you got when build with Makefile happens because basic_client hasn't alljoyn router inside, with scons it runs fine because it compiles with BR=on and some flags:
-lajrouter -lBundledRouter.o -lssl -lcrypto
For more infomation, visit: here

PyQt make error while compiling the source code

I want to install PyQt for Qt 4.7.4 and i downloaded the packages SIP and PyQt from riverbankcomputing.co.uk.
I configured and installed SIP successfully and configured PyQt successfully. But when i ran make in the terminal i got this error:
/home/user/Desktop/PyQt-x11-gpl-4.8.5/QtCore/sipQtCoreQThread.cpp: In function ‘PyObject* meth_QThread_currentThreadId(PyObject*, PyObject*)’:
/home/user/Desktop/PyQt-x11-gpl-4.8.5/QtCore/sipQtCoreQThread.cpp:325:50: error: invalid conversion from ‘void*’ to ‘long unsigned int’
/home/user/Desktop/PyQt-x11-gpl-4.8.5/QtCore/sipQtCoreQThread.cpp:325:50: error: initializing argument 1 of ‘PyObject* PyLong_FromUnsignedLong(long unsigned int)’
make[1]: *** [sipQtCoreQThread.o] Error 1
make[1]: Leaving directory `/home/user/Desktop/PyQt-x11-gpl-4.8.5/QtCore'
make: *** [all] Error 2
The full log is here: http://www.text-upload.com/read.php?id=176672&c=5376703
Can you help me fix this error, please? Thank you!
According to the build log, PyQt's configure script has found and is using the Simulator/embedded variant of Qt, and not the Desktop variant.
Try passing the path to qmake of the Desktop variant to the configure script:
python ./configure.py -q /home/user/.QtSDK/Desktop/Qt/4.7.4/gcc/bin/qmake
There are two choices
python ./configure.py -q /home/user/.QtSDK/Desktop/Qt/4.7.4/gcc/bin/qmake
or
python ./configure.py -q /home/user/.QtSDK/Simulator/Qt/gcc/bin/qmake
second will exit with some error code.
I'm trying first string right now.

Resources