Skip to contentSkip to conversation

Cmake + qt4 = linker error

DISCUSSION Radek Dostál 2 participants 3 messages Sep 29, 2015 – Sep 30, 2015 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi,

I have a very simple (hello world style) program which uses cmake for compilation and depends on qt4. I am trying to put together bitbake recipe for this program. See attached.

When compiling it fail with following error:
/tmp/oe-work/sysroots/x86_64-linux/usr/lib/libQtCore.so: file not
recognized: File format not recognized

I suspect it is looking for libraries in native sysroot due to following message in log.do_configure: "Found Qt4:
/tmp/oe-work/sysroots/x86_64-linux/usr/bin/qmake2 (found version "4.8.5")"

Obviously it can only find qmake2 binary in the native sysroot and not in the target sysroot as it does not make any sense to build qmake2 for target.

I checked meta-openembedded and openembedded-core and could not find any
example I could use for inspiration.

1) Is there something I am missing?

2) Is this a known problem?

Thanks,
Radek

LICENSE = "CLOSED"

inherit cmake

DEPENDS += "qt4-embedded"

SRC_URI = "\
	file://main.cpp \
	file://CMakeLists.txt \

"

S = "${WORKDIR}"

project(nsdk_toolbox)
cmake_minimum_required(VERSION 2.6)

find_package(Qt4 REQUIRED)

#include(Qt4Macros)

include_directories(${QT_INCLUDES})

set(nsdk_toolbox_SOURCES
main.cpp
)

set(nsdk_toolbox_HEADERS
)

qt4_wrap_cpp(nsdk_toolbox_MOC ${nsdk_toolbox_HEADERS} OPTIONS -nw)

add_executable(nsdk_toolbox ${nsdk_toolbox_SOURCES} ${nsdk_toolbox_HEADERS} ${nsdk_toolbox_MOC})

target_link_libraries(nsdk_toolbox ${QT_QTCORE_LIBRARY}) install(TARGETS nsdk_toolbox DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)

#2 lore raw
Quoted 20 lines · Radek Dostál

Hi,

I have a very simple (hello world style) program which uses cmake for compilation and depends on qt4. I am trying to put together bitbake recipe for this program. See attached.

When compiling it fail with following error:
/tmp/oe-work/sysroots/x86_64-linux/usr/lib/libQtCore.so: file not
recognized: File format not recognized

I suspect it is looking for libraries in native sysroot due to following message in log.do_configure: "Found Qt4:
/tmp/oe-work/sysroots/x86_64-linux/usr/bin/qmake2 (found version "4.8.5")"

Obviously it can only find qmake2 binary in the native sysroot and not in the target sysroot as it does not make any sense to build qmake2 for target.

Quoted 5 lines

I checked meta-openembedded and openembedded-core and could not find any example I could use for inspiration.

1) Is there something I am missing?

2) Is this a known problem?

may be you should inherit qt4e in your recipe as well

Quoted 11 lines

Thanks,
Radek

<nsdktoolbox.bb><CMakeLists.txt>--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#3 lore raw

Hi Raj,

Quoted 1 line

may be you should inherit qt4e in your recipe as well

I have tried this as well producing interesting behavior. When using:

1) inherit cmake qt4e

it did not even passed do_configure, as qt4e overwrite configuration method with the one which used qmake.

2) inherit qt4e cmake

it produced the same behavior as the DEPENDS += "qt4-embedded".

FYI: I have chosen DEPENDS += "qt4-embedded" for example as it looked slightly more readable, but there is no difference between the two.

Thanks,
Radek