You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The section in build.rs can possibly add the standard path /usr/lib (or /usr/lib/x86_64-linux-gnu on Debian) to the rustc-link-search path. It will introduce an extra -L/usr/lib flag to the linker. It is not desired because it overrides the search order of other more specific search paths.
I encountered a scenario to import both opencv and diesel in my project. I install the OpenCV 4 in non-standard path (It's because Ubuntu ships the older OpenCV), and set PKG_CONFIG_PATH to let the build.rs in opencv crate to append the non-standard search paths for me.
In the mean time, the pq-sys required by diesel puts the standard search path to the linker as I pointed here. It causes the linker to search for libopencv_*.so in both standard and non-standard paths, and the build fails due to conflict.
I see an obvious solution is the pkg-config feature. However, pq-sys is not the direct dependency of my project but for the dependent diesel, making the patch a bit difficult. The build script itself should also avoid producing standard paths to the linker.
The text was updated successfully, but these errors were encountered:
jerry73204
changed the title
The build script add standard path to rustc-link-search, causing troubles
The build script adds standard path to rustc-link-search, causing troubles
May 14, 2020
The section in build.rs can possibly add the standard path
/usr/lib
(or/usr/lib/x86_64-linux-gnu
on Debian) to therustc-link-search
path. It will introduce an extra-L/usr/lib
flag to the linker. It is not desired because it overrides the search order of other more specific search paths.I encountered a scenario to import both
opencv
anddiesel
in my project. I install the OpenCV 4 in non-standard path (It's because Ubuntu ships the older OpenCV), and setPKG_CONFIG_PATH
to let thebuild.rs
inopencv
crate to append the non-standard search paths for me.In the mean time, the
pq-sys
required bydiesel
puts the standard search path to the linker as I pointed here. It causes the linker to search forlibopencv_*.so
in both standard and non-standard paths, and the build fails due to conflict.I see an obvious solution is the
pkg-config
feature. However,pq-sys
is not the direct dependency of my project but for the dependentdiesel
, making the patch a bit difficult. The build script itself should also avoid producing standard paths to the linker.The text was updated successfully, but these errors were encountered: