Problems linking non-standard-location C libs (SPM)

I am trying to implement a ros2 client using the swift package manager. The library I'm trying to use is located in /opt/ros/dashing/lib/ and I can't figure out how to link to it. I'm following the guide on system libraries here. My files look as follows:

Package Description:

let package = Package(
    name: "example",
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
        .systemLibrary(name: "librcl", pkgConfig: "librcl"),
            name: "example",
            dependencies: ["librcl"])

I get the following error:

'librcl' librcl.pc: warning: couldn't find pc file

It's looking for a .pc file. Is that absolutely necessary for the linker to work? I don't see any .pc files in the ROS 2 libraries. Can someone explain the role of these files and whether they're absolutely necessary to link c libs to swift?

A .pc file is a file used by the tool pkgconfig, a standard Unix tool used to instruct compilers and linkers in how to find libraries for compile and linking purposes. Swift Package Manager supports parsing .pc files in order to avoid needing to specify specific paths to a given library, as .pc files are configured specifically for a given platform.

They are not necessary for linking C libraries to Swift. Note that warning does not mean "error": SwiftPM is emitting this warning as a diagnostic in case future compilation attempts fail, but while it may lead to an error, it is not necessarily one by itself. Is your code compiling and linking? If it is, no further action needs to be taken.

It's not uncommon to find a .pc file to be emitted by a C library's build or installation process: are you sure you don't end up with one as a side effect of make or make install?

Thanks! I ended up using the old deprecated method where I make a separate C wrapper package and add that as a dependency. That way I can set the path manually. Is there any way to use manual locations though with the new system for linking to system libraries?

Not that I am aware of, though @Aciid is the right person to ask.

@Aciid Can you provide any insight on how to use system packages in non-standard locations using the new method? Absolute paths are not possible so it seems that the only way is using the standard install directories. I also do not have a pkg-config for the libraries.