[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Building a package for arm64 only on amd64 machine



Dear Mentors,

I am trying to package a small library that will be a dependency for a larger application. The thing is the library will only be a dependency if the application is built on arm64. The CMake file has the lines:
if ("arm64" IN_LIST ARCHITECTURE)
    add_subdirectory(oaknut EXCLUDE_FROM_ALL)
endif()

Oaknut is the library I'm trying to build. The problem stems from the fact that the tarball depends on the catch2, a package that contains Catch2WithMain.a. Oaknut won't build at all when I try to compile natively. When I try to cross compile to arm64 on my amd64 machine it gives me errors about relocations in ELF (62) related to /usr/lib/Catch2WithMain.a. I'm guessing that it's trying to link to the amd64 Catch2WithMain.a that is installed on my machine.

Ideally, I would like to use the arm64 version of catch2, however I don't know how to specify this in the control file. If I run sbuild with --host=arm64, it fails in the same way as above because it's trying to cross-compile but with the amd64 version of catch2. If I put catch2:arm64 in the control file sbuild tells me "catch2:arm64 [is] not installable."

I am clearly going about this the wrong way. I don't know how I can build an arm64 only package and ensure it only uses arm64 build dependencies. Do I need to use a VM? If I can't get this library packaged, I would have to exclude arm64 from the software I am packaging, which I really don't want to do unless absolutely necessary. Any advice would be warmly appreciated.

Regards,

David James

Reply to: