GobySoft / dccl

Dynamic Compact Control Language
Other
17 stars 13 forks source link

DCCL fails to cross compile (building on Yocto) #123

Open bahaeg123 opened 1 year ago

bahaeg123 commented 1 year ago

I'm trying to compile DCCL for Yocto using the following recipe:

SUMMARY = "Data Compression Library (DCCL)"
DESCRIPTION = "DCCL library for Yocto"
LICENSE = "MIT"

LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRCREV = "d7c89774b68a031929e634f9d4a668659e52c5d0"

SRC_URI= "git://github.com/GobySoft/dccl.git;protocol=https;branch=4.0"

SRC_URI[md5sum] = "102a5140bf01fb8c790c84c00ccb89d7"
SRC_URI[sha256sum] = "45a26992f0e12a42b651f150c6fb92681e866dea493501f979e9a8d4df430bc9"

S = "${WORKDIR}/git"

inherit cmake

DEPENDS ="\
            boost \
            protobuf\
            protobuf-c\
        "

EXTRA_OECMAKE += "-DCMAKE_INSTALL_PREFIX=${D}${prefix}"
EXTRA_OECMAKE += "-DCMAKE_INSTALL_BINDIR=${D}${bindir}"
EXTRA_OECMAKE += "-DCMAKE_INSTALL_LIBDIR=${D}${libdir}"
EXTRA_OECMAKE += "-DCMAKE_INSTALL_INCLUDEDIR=${D}${includedir}"
EXTRA_OECMAKE += "-DCMAKE_INSTALL_DATADIR=${D}${datadir}"

FILES_${PN} += "${libdir}/* ${bindir}/* ${includedir}/* "

But I receive the following error:

...
| Build host architecture: x86_64
| Build target architecture: aarch64
| Setting CMAKE_CXX_STANDARD to 14 as required by DCCL (when Boost is available). If you wish to use a newer standard, set CMAKE_CXX_STANDARD directly
| Compiling in Git source tree.
| DCCL is cross-compiling. Target library architecture:
| CMake Error at CMakeLists.txt:118 (message):
|   Failed to find protoc-gen-dccl for cross-compiling
...

I looked into a similar issue that was closed years ago : #28 But it seems like the issue wasn't fixed.

Could you help me with this?

tsaubergine commented 1 year ago

Hi -

I merged #28 so that fix is in the current codebase. I don't use Yocto so I can't be super helpful. @MikeGodin do you have any thoughts?

The fundamental issue is that protoc-gen-dccl (the Protobuf compiler plugin for DCCL) needs to be available for the host build architecture (usually amd64).

For the Debian build, I run the amd64 builds first then install the amd64 version of dccl4-compiler (which includes the amd64 protoc-gen-dccl) into the host machine for the cross build. See https://github.com/GobySoft/dccl/blob/4.0/.circleci/config.yml#L172

Also, DCCL is licensed LGPL, not MIT.