0

I have a Makefile where within:

TARGETDIR=../rel/$(PLATFORM)
ANALYZER=$(TARGETDIR)/analyzer
TARGETS=$(ANALYZER)
XMLFILE=pgns.xml
JSONFILE=pgns.json

all: $(TARGETS)

$(ANALYZER): analyzer.c pgn.c analyzer.h pgn.h ../common/common.c ../common/common.h Makefile
    $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(ANALYZER) -I../common pgn.c analyzer.c ../common/common.c $(LDLIBS$(LDLIBS-$(@)))

json: $(ANALYZER) pgns2json.xslt
$(ANALYZER) -explain-xml >$(XMLFILE) && xsltproc pgns2json.xslt $(XMLFILE) >$(JSONFILE)

$(ANALYSER) gets compiled and is stored in TARGETDIR. Now in json the analyzer binary is called which provides

 | /bin/sh: ../rel/linux-x86_64/analyzer: cannot execute binary file: Exec format error

because upon file analyzer it show the file as ELF 32-bit file. I understand incompatibility here.

This has been addressed in the my Previous SE Query.

Since I cannot get around this issue; I was thinking of using the json call in a postinstall script in my Recipe.

But I cannot wrap my head around it. These are the steps I have drawn up:

  1. I modify the Makefile which removes json
  2. Should I add DEPENDS = "libxslt libxml2 ?
  3. Should I add RDEPENDS_{PN} = "bash" to execute the command for json?
  4. how should the post-install look like for the recipe?

The Recipe:

SUMMARY = "CANBOAT"
SECTION = "base"
LICENSE = "GPLv3"
#DEPENDS = "libxml2 libxsl"

LIC_FILES_CHKSUM = "file://GPL;md5=05507c6da2404b0e88fe5a152fd12540"

S = "${WORKDIR}/git"

SRC_URI = "git://github.com/canboat/canboat.git;branch=${SRCBRANCH}"
SRCBRANCH = "master"
SRCREV = "93b2ebfb334d7a9750b6947d3a4af9b091be2432"
EXTRA_OEMAKE = "'CC=${CC}' 'AR=${AR}'"
do_compile() {
    oe_runmake
}
do_install() {
   oe_runmake install

}
#post_install() { # here? what will be the structure}
Shan-Desai
  • 3,101
  • 3
  • 46
  • 89

1 Answers1

1

analyzer is a tool that is used to generate some artifacts and is not necessarily needed to be compiled for target in a cross compile environment , rather it needs a platform to run (build host) and input file.

SUMMARY = "CANBOAT"
SECTION = "base"
LICENSE = "GPLv3"

DEPENDS += "libxslt-native canboat-native"

LIC_FILES_CHKSUM = "file://GPL;md5=05507c6da2404b0e88fe5a152fd12540"

SRC_URI = "git://github.com/canboat/canboat.git;branch=${SRCBRANCH} \
           file://0001-Do-not-use-root-user-group-during-install.patch \
           file://0001-Define-ANALYZEREXEC.patch \
           file://0001-use-php-instead-of-php5.patch \
          "
SRCBRANCH = "master"
SRCREV = "93b2ebfb334d7a9750b6947d3a4af9b091be2432"

S = "${WORKDIR}/git"

PREFIX ?= "${root_prefix}"
#PREFIX_class-native = "${prefix}"

EXTRA_OEMAKE_append_class-target = " ANALYZEREXEC=analyzer "

do_compile() {
    oe_runmake
}
do_install() {
   oe_runmake DESTDIR=${D} PREFIX=${root_prefix} EXEC_PREFIX=${exec_prefix} install

}

RDEPENDS_${PN}_append_class-target = " php-cli perl"

BBCLASSEXTEND = "native nativesdk"

The extra patches you need to cross compile canboat are here

0001-Define-ANALYZEREXEC.patch

0001-Do-not-use-root-user-group-during-install.patch

0001-use-php-instead-of-php5.patch

Khem
  • 1,162
  • 8
  • 8
  • I actually do use `analyzer` on the board for an application. Do you think it is wise to remove it? i.e. `rm -rf ${D}${bindir}/analyzer`? – Shan-Desai May 20 '18 at 16:52
  • Also I have copied your patch in the `files` folder within the recipe and tried baking it. I got a quilt error `Hunk #1 FAILED at 27.` – Shan-Desai May 20 '18 at 17:30
  • if you want to have analyser for target then it have to be done a bit differently. We should be generating a canboat-native recipe which should build analyser for cross-compiling and let the target one be as it is. – Khem May 20 '18 at 23:28
  • 1
    I have pushed a fix please copy whole canboat folder into your layer and stick it under /recipes-support folder https://github.com/kraj/meta-himvis/tree/master/recipes-core/canboat – Khem May 21 '18 at 03:56