Stefan Jaritz
Stefan Jaritz

Reputation: 2279

How to create cmake recipes in Yocto?

I like to figure out how to create a recipe which is downloaded from git and build by using a make file. For example:

the g3logger (git https://github.com/KjellKod/g3log.git)

How must be the recipe "bb" file looks like?

Upvotes: 2

Views: 3041

Answers (2)

Tom Rini
Tom Rini

Reputation: 2173

So, this is a problem in g3log (which other programs also likely have). If you open up 'Build.cmake' and look around lines 53-56 you see:

   ELSE()
       set(PLATFORM_LINK_LIBRIES rt)
       set(CMAKE_CXX_FLAGS "-Wall -rdynamic -Wunused -std=c++11 -pthread -D_GLIBCXX_USE_NANOSLEEP -D_GLIBCXX_USE_SCHED_YIELD")
   ENDIF()

Which overrides what OpenEmbedded has placed into toolchain.cmake. If you change this instead to:

       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -rdynamic -Wunused -std=c++11 -pthread -D_GLIBCXX_USE_NANOSLEEP -D_GLIBCXX_USE_SCHED_YIELD")

it will now inherit the flags that OpenEmbedded wants you to have such as --sysroot= so that standard includes are found.

Upvotes: 5

iksajotien
iksajotien

Reputation: 1051

In addition to your comment: Maybe it's an error from your Makefile? For string it should be:

#include <string.h>

or

#include <cstring>

You can also show logs for specific task like do_compile, so we'll have deeper insight.

Tips on debugging tasks in bitbake: Yocto Ref Manual - Debugging build failures

Upvotes: 1

Related Questions