s290484188
2018-09-10 11:11
采纳率: 80%
浏览 2.5k
已采纳

QT交叉编译 缺少sys/cdefs.h

交叉编译QT,因为要用的xcb等库,所以直接把开发板内的/lib /usr/lib /usr/include拷贝到了虚拟机,
解压qt源码,配置qmake.conf
#

qmake configuration for building with aarch64-linux-gnu-g++

#

MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib

include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)

QMAKE_CXXFLAGS += -I/home/ubuntu/yk/usr/include
QMAKE_CXXFLAGS += -I/home/ubuntu/yk/usr/include/aarch64-linux-gnu
QMAKE_CFLAGS += -I/home/ubuntu/yk/usr/include
QMAKE_CFLAGS += -I/home/ubuntu/yk/usr/include/aarch64-linux-gnu

QMAKE_LFLAGS += /home/ubuntu/yk/qt-everywhere-opensource-src-5.8.0/qtbase/lib/
QMAKE_LFLAGS += -L/home/ubuntu/yk/lib/aarch64-linux-gnu
QMAKE_LFLAGS += -Wl,-rpath-link,/home/ubuntu/yk/lib/aarch64-linux-gnu
QMAKE_LFLAGS += -L/home/ubuntu/yk/usr/lib/aarch64-linux-gnu
QMAKE_LFLAGS += -Wl,-rpath-link,/home/ubuntu/yk/usr/lib/aarch64-linux-gnu
QMAKE_LFLAGS += -L/home/ubuntu/yk/lib
QMAKE_LFLAGS += -Wl,-rpath-link,/home/ubuntu/yk/lib
QMAKE_LFLAGS += -L/home/ubuntu/yk/usr/lib
QMAKE_LFLAGS += -Wl,-rpath-link,/home/ubuntu/yk/usr/lib

QMAKE_LIBS += -lpthread -lgobject-2.0 -lglib-2.0 -lpcre
QMAKE_CFLAGS += -O2 -march=armv7-a -mfpu=neon -mfloat-abi=hard
QMAKE_CXXFLAGS += -O2 -march=armv7-a -mfpu=neon -mfloat-abi=hard

QMAKE_LFLAGS += -L/home/ubuntu/yk/lib
QMAKE_LFLAGS += -Wl,-rpath-link,/home/ubuntu/yk/lib
QMAKE_LFLAGS += -L/home/ubuntu/yk/usr/lib
QMAKE_LFLAGS += -Wl,-rpath-link,/home/ubuntu/yk/usr/lib

modifications to g++.conf

QMAKE_CC = aarch64-linux-gnu-gcc
QMAKE_CXX = aarch64-linux-gnu-g++
QMAKE_LINK = aarch64-linux-gnu-g++
QMAKE_LINK_SHLIB = aarch64-linux-gnu-g++

modifications to linux.conf

QMAKE_AR = aarch64-linux-gnu-ar cqs
QMAKE_OBJCOPY = aarch64-linux-gnu-objcopy
QMAKE_NM = aarch64-linux-gnu-nm -P
QMAKE_STRIP = aarch64-linux-gnu-strip
load(qt_config)

执行configure后提示错误

ubuntu@ubuntuPC:~/yk/qt-everywhere-opensource-src-5.8.0$ ./configure -release -nomake examples -no-iconv -qt-xcb -qpa xcb -no-opengl -sysroot /home/ubuntu/yk/ -xplatform linux-arm-gnueabi-g++ -prefix /home/ubuntu/Qt5.8.0_arm -opensource -confirm-license

  • cd qtbase
  • /home/ubuntu/yk/qt-everywhere-opensource-src-5.8.0/qtbase/configure -top-level -release -nomake examples -no-iconv -qt-xcb -qpa xcb -no-opengl -sysroot /home/ubuntu/yk/ -xplatform linux-arm-gnueabi-g++ -prefix /home/ubuntu/Qt5.8.0_arm -opensource -confirm-license

This is the Qt Open Source Edition.

You are licensed to use this software under the terms of
the GNU Lesser General Public License (LGPL) version 3.
You are also licensed to use this software under the terms of
the GNU General Public License (GPL) version 2.

You have already accepted the terms of the Open Source license.

Creating qmake...
........................................................................................Done.
Info: creating stash file /home/ubuntu/yk/qt-everywhere-opensource-src-5.8.0/.qmake.stash
Info: creating super cache file /home/ubuntu/yk/qt-everywhere-opensource-src-5.8.0/.qmake.super

Running configuration tests...
Checking for gold linker... yes
Checking for valid makespec... yes
Checking for target architecture... Project ERROR: Could not determine target architecture. See config.log for details.

查看config.log

executing config test architecture

  • cd /home/ubuntu/yk/qt-everywhere-opensource-src-5.8.0/qtbase/config.tests/arch && /home/ubuntu/yk/qt-everywhere-opensource-src-5.8.0/qtbase/bin/qmake -qtconf /home/ubuntu/yk/qt-everywhere-opensource-src-5.8.0/qtbase/bin/qt.conf "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared use_gold_linker console" "QMAKE_CFLAGS += --sysroot=/home/ubuntu/yk/" "QMAKE_CXXFLAGS += --sysroot=/home/ubuntu/yk/" "QMAKE_LFLAGS += --sysroot=/home/ubuntu/yk/" /home/ubuntu/yk/qt-everywhere-opensource-src-5.8.0/qtbase/config.tests/arch
  • cd /home/ubuntu/yk/qt-everywhere-opensource-src-5.8.0/qtbase/config.tests/arch && MAKEFLAGS= /usr/bin/make > g++ -c -pipe --sysroot=/home/ubuntu/yk/ -g -Wall -W -fPIC -I. -I/home/ubuntu/yk/qt-everywhere-opensource-src-5.8.0/qtbase/mkspecs/linux-g++ -o arch.o arch.cpp > In file included from /home/ubuntu/yk/usr/include/stdio.h:27:0, > from arch.cpp:43: > /home/ubuntu/yk/usr/include/features.h:367:25: fatal error: sys/cdefs.h: No such file or directory > compilation terminated. > Makefile:167: recipe for target 'arch.o' failed > make: *** [arch.o] Error 1

找不到sys/cdefs.h
但是我配置的目录下面 /home/ubuntu/yk/usr/include/aarch64-linux-gnu 有sys/cdefs.h
找了一天问题了,还缺少配置什么路径?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • s290484188 2019-01-15 09:19
    已采纳

    没有找到xcb的安装方法

    已采纳该答案
    打赏 评论
  • threenewbee 2018-09-10 15:59

    安装下标准库,检查下有没有添加到编译的头文件路径,参考:https://blog.csdn.net/sfdazsdf/article/details/48625545

    打赏 评论

相关推荐 更多相似问题