[yocto] Running cmake in the SDK environment from a script fails

Bartosz Golaszewski brgl at bgdev.pl
Wed Jan 17 11:30:21 PST 2018


Hi,

I'm working on a project in which a base linux distribution is built
using yocto while a set of proprietary components is built with the
generated SDK (-c populate_sdk).

These components use cmake for building. While they build just fine
when the 'cmake' command is invoked from command-line, as soon as
there's a fork() and execve() in between (e.g. when cmake is invoked
from a script or even when I tried tracing it with strace), the build
fails on finding any external library:

-- Could NOT find ZLIB (missing:  ZLIB_LIBRARY) (found version "1.2.8")
CMake Error at cmake/external_dependencies.cmake:10 (message):
  Could not find zlib
Call Stack (most recent call first):
  CMakeLists.txt:109 (include)

The 'found' message is there because it eventually 'found' my host's
header as visible in the strace output[1].

The target arch is core2-64 while the host is x86_64. Both host and
target dirs are present in sysroots/.

What's clear when browsing the strace output is that the headers are
not searched for in the right directory which would in this case be
sysroots/core2-64-poky-linux/usr/include/ but in
/sysroots/x86_64-pokysdk-linux/ instead.

I initially thought this to be a problem with the project's
CMakeLists.txt but it seems fine given the fact that it builds when
used manually.

Any idea what could be the culprit here?

Best regards,
Bartosz Golaszewski

[1] https://pastebin.com/1pqmbh7R



More information about the yocto mailing list