Skip to content

Unsafe header/library path used in cross-compilation linker error 0.95.0, because of opencv-binding-generator as runtime dependency #682

@hanza-developer

Description

@hanza-developer

Cross-compiling on an x86 machine to an ARM machine fails due to incorrect linker flags. The linker stops with the following error:

...
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: aarch64-buildroot-linux-gnu-gcc: ERROR: unsafe header/library path used in cross-compilation: '-L' '/usr/lib/llvm-20/lib'

Source of the problem seems to be in commit d1f4513:

[dependencies]
...
opencv-binding-generator = { version = "0.96.1", path = "binding-generator" }
...

This commit newly adds opencv-binding-generator as a normal runtime dependency, and thus "infecting" the linker with the additional linker flag -L /usr/lib/llvm-20/lib. These linker flags are of course invalid with in a cross-compiliaton setting with a non-/ sysroot.

Removing the opencv-binding-generator line from the current master (31850617) leads to a successful build.

I'm unfortunately not able to share more of the build log due to company data protection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions