segmentation fault at graphics_system_name.isEmpty() - qt

I have ported Qt 4.8.6 to sparc linux.as per my knowledge Sparc and Linux support is not available in qws folder.
I have copied linux-generic-g++ to linux-sparc-g++ and changed qmake.conf as per my toolchain functionality as shown below.
include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/qws.conf)
QMAKE_CFLAGS_RELEASE = -nostdlib -nostartfiles -shared
QMAKE_CXXFLAGS_RELEASE = -nostdlib -nostartfiles -shared
QMAKE_LFLAGS_RELEASE = -nostdlib -nostartfiles -shared
QMAKE_CC = sparc-elf-gcc
QMAKE_CXX = sparc-elf-g++
QMAKE_LINK = sparc-elf-g++
QMAKE_LINK_SHLIB = sparc-elf-g++
QMAKE_AR = sparc-elf-ar cqs
QMAKE_OBJCOPY = sparc-elf-objcopy
QMAKE_STRIP = sparc-elf-strip
load(qt_config)
After this I have configured with below configuration feature
./configure -verbose -opensource -confirm-license -no-qt3support -no-glib -depths 32 -qt-gfx-vnc -no-gfx-qvfb -no-gfx-multiscreen -no-gfx-directfb -debug -shared -embedded sparc -platform qws/linux-x86_64-g++ -xplatform qws/linux-sparc-g++ -host-little-endian -little-endian -no-openssl -no-opengl -no-sql-sqlite -no-xmlpatterns -no-multimedia -no-audio-backend -no-phonon -no-script -no-phonon-backend -no-svg -multimedia -no-webkit -nomake demos -no-separate-debug-info -prefix /usr/local/ -plugindir /usr/local/plugins -importdir /usr/local/imports -translationdir /usr/local/translations -no-rpath
I have successfully crated all shared library and copied into my board /lib/ path
Now my plan is to run analogclock example on board using below command(I don't have display that's what I am using VNC display)
./analogclock -qws -display VNC:0
analogclock[120]: segfault at 8 ip 5019b06c (rpc f000eff0) sp ef82cae8
error 30001 in libQtGui.so.4.8.6[50017000+10cb000] Segmentation fault
I am getting segmentation fault when graphics_system_name.isEmpty(); in src/gui/kernel/qapplication.cpp file is invoked.
After debugging I found that global "QString QApplicationPrivate::graphics_system_name;" object is created successfully with valid address 0x5143a400.
However I could not access any QString member functions such as (graphics_system_name.data(), graphics_system_name.size().....)
If I create local QString class object,it is working fine.if global segmentation fault.

Related

How do I upload an object file generated by LLVM to Arduino?

I'm making a simple language for Arduino, and want to compile this with LLVM.
I tried to generate LLVM IR (to understand what LLVM IR is generated from the Arduino code). I used this command:
> clang -S -emit-llvm -Os -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -x c++ -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I "C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" -I "C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" Blink.cc -o ./Blink.cc.ll -I "C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include" --target=avr
It generates Blink.ll. And likewise, I also can compile the source code to .o (object) file.
But this file is not able to upload to the Arduino board.
To upload to the Arduino, I have to use avrdude. But it requires.hex file.
And LLVM outputs .o file, only. I have no clue what have I do to upload this file to the Arduino board.

Compiling: undefined reference "clock_gettime and memcpy" for Qt project

I try to compile Qt project with CentOS.
This question describe what I have done in detail and
I want to do with another glibc libraries /users/my/lib64/ (I can't update /lib64/) by referring to this.
This is the compile out put:
g++ ./main.o ./moc_widget.o ./widget.o \
-o ./test -Wl,--rpath=/users/my/lib64 \
-Wl,--rpath=/users/my/Qt/5.9.1/gcc_64/lib \
-Wl,--dynamic-linker=/users/my/lib64/libc.so.6 \
-Wl,--dynamic-linker=/users/my/lib64/libz.so.1 \
-L/users/my/Qt/5.9.1/gcc_64/lib -lQt5Widgets \
-lQt5Gui -lQt5Core -lGL -lpthread -lglib-2.0 -lrt -lX11 \
-I/users/my/test/2 \
-I/users/my/Qt/5.9.1/gcc_64/include \
-I/users/my/Qt/5.9.1/gcc_64/include/QtWidgets \
-I/users/my/Qt/5.9.1/gcc_64/include/QtCore \
-I/users/my/Qt/5.9.1/gcc_64/include/QtGui
.pro file :
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = test
TEMPLATE = app
DEFINES += QT_DEPRECATED_WARNINGS
CONFIG += qt
SOURCES += \
main.cpp \
widget.cpp
HEADERS += \
widget.h
FORMS += \
widget.ui
gcc version : 6.1.0
But the error:
/users/my/Qt/5.9.1/gcc_64/lib/libQt5Core.so: undefined reference to `clock_gettime#GLIBC_2.17'
/users/my/Qt/5.9.1/gcc_64/lib/libQt5Widgets.so: undefined reference to `memcpy#GLIBC_2.14'
collect2 ld returned exit 1 status
How to solve it ?
g++ ./main.o ./moc_widget.o ./widget.o \
-o ./test -Wl,--rpath=/users/my/lib64 \
-Wl,--rpath=/users/my/Qt/5.9.1/gcc_64/lib \
-Wl,--dynamic-linker=/users/my/lib64/libc.so.6 \
-Wl,--dynamic-linker=/users/my/lib64/libz.so.1 \
-L/users/my/Qt/5.9.1/gcc_64/lib -lQt5Widgets \
-lQt5Gui -lQt5Core -lGL -lpthread -lglib-2.0 -lrt -lX11 \
-I...
This command line is completely bogus (you didn't understand previous answer): there can only be one dynamic linker, and it should be /users/my/lib64/ld-linux-x86-64.so.2, and not libz.so.1. By using multiple --dynamic-linker=... flags, you are simply replacing previous (incorrect) setting with a new (also incorrect) one.
It's also bogus because specifying -I... flags on the link line without any sources is pointless.
If this command succeeded, you'd end up with an executable that would simply crash immediately, because libz.so.1 is not a dynamic linker.
Now, your link fails because you are performing the link on the wrong system. You need to link on the original system (the one where you successfully linked your binary earlier, and the one which has GLIBC 2.17 or later). And then move the linked executable to your target system.
On the original system, your link command should look something like this:
g++ main.o moc_widget.o widget.o -o test \
-Wl,-rpath=/users/my/lib64 \
-Wl,--dynamic-linker=/users/my/lib64/ld-linux-x86-64.so.2 \
-L...
The two lines I indented above should be the only change from your original successful link command.

Project ERROR: Unknown module(s) in Qt: gui widgets printsupport macextras

I'm trying to compile OpenSCAD on my Mac. When the build script reaches the line qmake qscintilla.pro it spits out the error Project ERROR: Unknown module(s) in QT: gui opengl concurrent widgets printsupport macextras If I run qmake on its own I recieve more errors for missing modules Project ERROR: Unknown module(s) in QT: gui opengl concurrent widgets printsupport macextras I added QT += macextras to my qt.pro file to see if it would stop complaining about macextras, but that didn't work either.
I looked inside qt-everywhere-opensource-src-5.4.1 and I can see qtmacextras but I don't see the other modules mentioned.
Any ideas how I could get these modules for Mac?
I thought that qt was being compiled by the following script
build_qt()
{
version=$1
if [ -d $DEPLOYDIR/lib/QtCore.framework ]; then
echo "qt already installed. not building"
return
fi
echo "Building Qt" $version "..."
cd $BASEDIR/src
rm -rf qt-everywhere-opensource-src-$version
if [ ! -f qt-everywhere-opensource-src-$version.tar.gz ]; then
curl -O -L http://download.qt-project.org/official_releases/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.tar.gz
fi
tar xzf qt-everywhere-opensource-src-$version.tar.gz
cd qt-everywhere-opensource-src-$version
patch -p0 < $OPENSCADDIR/patches/qt4/patch-src_corelib_global_qglobal.h.diff
patch -p0 < $OPENSCADDIR/patches/qt4/patch-libtiff.diff
patch -p0 < $OPENSCADDIR/patches/qt4/patch-src_plugins_bearer_corewlan_qcorewlanengine.mm.diff
if $USING_CLANG; then
# FIX for clang
sed -i "" -e "s/::TabletProximityRec/TabletProximityRec/g" src/gui/kernel/qt_cocoa_helpers_mac_p.h
PLATFORM="-platform unsupported/macx-clang"
fi
if $OPTION_32BIT; then
QT_32BIT="-arch x86"
fi
case "$OSX_VERSION" in
9)
# libtiff fails in the linker step with Mavericks / XCode 5.0.1
MACOSX_RELEASE_OPTIONS=-no-libtiff
# wlan support bails out with lots of compiler errors, disable it for the build
patch_qt_disable_core_wlan "$version"
;;
*)
MACOSX_RELEASE_OPTIONS=
;;
esac
./configure -prefix $DEPLOYDIR -release $QT_32BIT -arch x86_64 -opensource -confirm-license $PLATFORM -fast -no-qt3support -no-svg -no-phonon -no-audio-backend -no-multimedia -no-javascript-jit -no-script -no-scripttools -no-declarative -no-xmlpatterns -nomake demos -nomake examples -nomake docs -nomake translations -no-webkit $MACOSX_RELEASE_OPTIONS
make -j"$NUMCPU" install
}
It sounds like you're using the macosx-build-dependencies.sh script. If you do, you need to set up your environment first, to search for libraries in the right places:
$ source setenv_mac-qt5.sh

How to make gnatmake tool compile RTS with project?

Is there a way to make gnatmake tool recompile the Ada's runtime library ("RTS") with the project I'm building file by file? I want to integrate my custom preprocessor that adds some features to ada source code and then compiles it with gcc. I'm passing --GCC=<preprocessor> flag to the gnatmake utility, it figures out dependencies automatically and runs my preprocessor for all of my source files. However I want custom preprocessing to be done on code in the RTS as well, is there any way to do it?
The -a flag tells gnatmake to recompile any RTS files that need to be recompiled.
After a little experiment here it seems that if you copy system.ads (and maybe gnat.ads, interfac.ads .. yes) from the compiler’s adainclude/ directory to your source tree (I think you’ll need to touch it whenever you update your preprocessor), gnatmake may be able do what you want.
$ cp /opt/gcc-4.9.0/lib/gcc/x86_64-apple-darwin13/4.9.0/adainclude/system.ads .
$ gnatmake -a int
gcc -c int.adb
gcc -gnatpg -c -I./ -I- /opt/gcc-4.9.0/lib/gcc/x86_64-apple-darwin13/4.9.0/adainclude/s-stalib.adb
gcc -gnatpg -c -I./ -I- /opt/gcc-4.9.0/lib/gcc/x86_64-apple-darwin13/4.9.0/adainclude/a-except.adb
gcc -gnatpg -c -I./ -I- /opt/gcc-4.9.0/lib/gcc/x86_64-apple-darwin13/4.9.0/adainclude/s-valint.adb
gcc -gnatpg -c system.ads
...
gcc -gnatpg -c -I./ -I- /opt/gcc-4.9.0/lib/gcc/x86_64-apple-darwin13/4.9.0/adainclude/s-conca4.adb
gnatbind -x int.ali
gnatlink int.ali
and, after I realised I hadn’t used -gnata,
$ touch int.adb
$ gnatmake -a -gnata int
gcc -c -gnata int.adb
gcc -gnatpg -c -I./ -gnata -I- /opt/gcc-4.9.0/lib/gcc/x86_64-apple-darwin13/4.9.0/adainclude/s-assert.adb
gnatbind -x int.ali
gnatlink int.ali
(I do not want to use -f here, because it’ll rebuild everything.)

Cross-compiling Qt for Pandaboard

I spend weeks trying to cross compile Qt for my Panda board and no way, I can't pass the ./configure. If someone could give me a help I'll appreciate.
My host system is Ubuntu-13.04 ×86_64bit(running un Virtualbox)
My target system is Pandaboard ES Ubuntu-12.04.
All the steps in host box:
sudo apt-get install arm-linux-gnueabihf
sudo mkdir /opt/qt-485-armhf
cd /usr/src
sudo wget http://download.qt-project.org/official_releases/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.tar.gz
sudo tar xf qt-everywhere-opensource-src-4.8.5.tar.gz
cd /usr/src/qt-everywhere-opensource-src-4.8.5
sudo cp -r mkspecs/qws/linux-arm-gnueabi-g++ mkspecs/qws/linux-arm-gnueabihf-g++
sudo vim mkspecs/qws/linux-arm-gnueabihf-g++/qmake.conf
-------------------------------
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
#Compiler Flags to take advantage of the ARM architecture
#N.B.:I also tried to uncomment the two following instructions with no success
QMAKE_CFLAGS = -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard
QMAKE_CXXFLAGS = -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard
# modifications to g++.conf
QMAKE_CC = arm-linux-gnueabihf-gcc
QMAKE_CXX = arm-linux-gnueabihf-g++
QMAKE_LINK = arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB = arm-linux-gnueabihf-g++
# modifications to linux.conf
QMAKE_AR = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = arm-linux-gnueabihf-objcopy
QMAKE_STRIP = arm-linux-gnueabihf-strip
load(qt_config)
---------------------------------
sudo sed -i -e "/#if/d" -e "/#error/d" -e "/#endif/d" config.tests/unix/libmng/libmng.cpp (This command fixes detection of libmng 2.0.)
export QTDIR=/opt/qt4-485-armhf
And finally:
sudo ./configure -prefix /opt/qt4-485-armhf -sysconfdir /etc/xdg -embedded arm -little-endian -host-big-endian -no-qt3support -nomake examples -nomake demos -opensource -confirm-license -release -openssl-linked -no-phonon -no-phonon-backend -no-nis -platform qws/linux-x86_64-g++ -xplatform qws/linux-arm-gnueabihf-g++ -optimized-qmake
With this result:
Creating qmake. Please wait...
g++ -c -o option.o -pipe -m64 -DQMAKE_OPENSOURCE_EDITION -O2 -g -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian -Igenerators/integrity -I/usr/src/qt-everywhere-opensource-src-4.8.5/include -I/usr/src/qt-everywhere-opensource-src-4.8.5/include/QtCore -I/usr/src/qt-everywhere-opensource-src-4.8.5/src/corelib/global -I/usr/src/qt-everywhere-opensource-src-4.8.5/src/corelib/xml -I/usr/src/qt-everywhere-opensource-src-4.8.5/tools/shared -DQT_NO_PCRE -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL -DQT_NO_COMPRESS -I/usr/src/qt-everywhere-opensource-src-4.8.5/mkspecs/qws/linux-x86_64-g++ -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DEPRECATED option.cpp
g++ -o "/usr/src/qt-everywhere-opensource-src-4.8.5/bin/qmake" project.o property.o main.o makefile.o unixmake2.o unixmake.o mingw_make.o option.o winmakefile.o projectgenerator.o meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o borland_bmake.o msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o symbiancommon.o registry.o epocroot.o gbuild.o qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfile.o qfilesystementry.o qfilesystemengine_unix.o qfilesystemengine.o qfilesystemiterator_unix.o qfsfileengine_unix.o qfsfileengine.o qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o qmap.o qmetatype.o qsettings.o qsystemerror.o qlibraryinfo.o qvariant.o qvsnprintf.o qlocale.o qlocale_tools.o qlocale_unix.o qlinkedlist.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o
You have not explicitly asked to use pkg-config and are cross-compiling.
pkg-config will not be used to automatically query cflag/lib parameters for
dependencies
The system floating point format could not be detected.
This may cause data to be generated in a wrong format
Turn on verbose messaging (-v) to see the final report.
OpenSSL support cannot be enabled due to functionality tests!
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.
Thanks in advance.
To cross-compile a program on a PC you must have the development files for the same packages installed on the PC as the ARM target. Qt 4.8 depends on OpenSSL, so you must get the correct development files for the ARM release if you wish to compile Qt.
Install a Ubuntu 12.04 PC virtual box. SAME VERSION as the board.
Get the compiler. apt-get install arm-linux-gnueabihf (You knew that).
Get required development packages. apt-get install libssl-dev or apt-get build-dep -aarmhf qt4 (which only works for X11).
Edit your Qt configuration to suit your needs and build it.
The current step you are missing is step 3; but to perform it you need step 1 or some other way to get the OpenSSL development files for Ubuntu 12.04. There is probably some other way to do this using apt.sources. I think the steps above will be easiest for you.
Here is an alternative approach. As you are going to use Qt, you don't necessarily need Ubuntu. Simple rootfs with Qt Embedded could be sufficient.
I'll describe, how you can create rootfs and your application using Buildroot(BR). BR already has a config file for Pandaboard. All you need to is to download BR and execute:
make pandaboard_defconfig
After that you can choose between Qt4 and Qt5 in the menuconfig.
For your application I'd suggest using CMake infrastructure, but it is a matter of taste. This article is about source directory override mechanism in BR.
try to get the version off gcc in your Pandaboard Ubuntu OS and if is the same arm-linux-gnueabihf-gcc version or less like 4.6 hint the config in your qmake.config
#QMAKE_CFLAGS = -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard
#QMAKE_CXXFLAGS = -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard

Resources