Solved Qt 4.8.6 source code cross compile problem : ": not found"
-
Hello,
I am trying to compile Qt4.8.6 source code. First of all,
I am using linaro's toolchain gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf.
I am working on Ubuntu 16.04.3 LTS.
I performed the following operations respectively :-
1 - I created a sample directory with copy and paste in mkspecs/qws directory and its name is linux-am335x-g++.
-
2- Then I rearranged the qmake.conf file like this :
# # qmake configuration for building with arm-linux-g++ # include(../../common/linux.conf) include(../../common/gcc-base-unix.conf) include(../../common/g++-unix.conf) include(../../common/qws.conf) # Compiler Flags to take advantage of the ARM architecture QMAKE_CFLAGS_RELEASE = -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard QMAKE_CXXFLAGS_RELEASE = -O3 -march=armv7-a -mtune=cortex-a8 -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)
- 3- I write my_config script like this :
#!/bin/sh ./configure -opensource -confirm-license -prefix /home/sbahadirarslan/qt_workspace/qt_build -embedded arm -xplatform qws/linux-am335x-g++ -little-endian -static -no-webkit -nomake examples -nomake demos -nomake docs -nomake translations
- 4- Last I rearranged PATH variable like this : (/opt/toolchain/gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf/bin contains toolchain binaries)
/opt/toolchain/gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
But when I run my_config bash file, I get following errors :
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 /opt/toolchain/gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: 1: /opt/toolchain/gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: / : not found /opt/toolchain/gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: 1: /opt/toolchain/gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: /opt/toolchain/gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: 1: /opt/toolchain/gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: / : not found ELF: not found /opt/toolchain/gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: 2: /opt/toolchain/gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: Syntax error: word unexpected (expecting ")") ln: failed to create symbolic link '/home/sbahadirarslan/qt_workspace/qt-everywhere-opensource-src-4.8.6/include/QtCore/qconfig.h': File exists ln: failed to create symbolic link '/home/sbahadirarslan/qt_workspace/qt-everywhere-opensource-src-4.8.6/include/Qt/qconfig.h': File exists
By the way, before running the my_config script, I do make confclean.
I could not solve the cause of this error. Please help me about this situation.
Thanks -
-
Hi and welcome to devnet,
First two recommendations:
- If you can't use Qt 5 then at least use the latest Qt 4 which is 4.8.7
- Use out of source builds, that way if something goes wrong you can just nuke the build folder and start again.
Can you execute
arm-linux-gnueabihf-gcc
from the command line once you tweaked thePATH
environment variable ? -
I found the problem.
First I tried to compile hello.c code with arm-linux-gnueabi-gcc and I got this error :Exec format not found
And then I checked my processor type with
uname -p
Then I got i686.
Then I checked arm-linux-gnueabi-gcc with file command. And I realize that this toolchain is 64 bit toolchain.
Then I install 64 bit ubuntu and problem solved. -
Glad you found out and thanks for the feedback !