Skip to content

For FreeBSD, pkg-config reports paths in /usr/local instead of /usr/local/$target #1744

@schodet

Description

@schodet

Checklist

Describe your issue

Trying to cross-compile a project using bindgen, the package I depend on is found, but the reported path is wrong.

It turns out that when using pkg-config, the library is found thanks to PKG_CONFIG_PATH variable, but the flags returned do not include the target in path.

When entering the container:

# pkg-config --cflags openssl
-I/usr/local/include
# ls /usr/local/include
(nothing)
#

The project I try to build is using rrd, for which I have an open PR to fix the build: cygnus9/rrd-rust#17

This works on a real FreeBSD host.

I am not familiar with the concept of sysroot, so I may miss something.

What target(s) are you cross-compiling for?

x86_64-unknown-freebsd

Which operating system is the host (e.g computer cross is on) running?

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

cross 0.2.5

Example

git clone https://github.com/schodet/rrd-rust.git -b pkg-config-include-path
cd rrd-rust/librrd-sys
edit Cross.toml
cross build --target x86_64-unknown-freebsd

With Cross.toml:

[target.x86_64-unknown-freebsd]
pre-build = ["""
export FREEBSD_MIRROR=$(/freebsd-fetch-best-mirror.sh) &&
/freebsd-setup-packagesite.sh &&
/freebsd-install-package.sh pkgconf rrdtool
"""]

Result:

...
src/gen/wrapper.h:1:10: fatal error: 'rrd.h' file not found

Additional information / notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions