Skip to content

Commit 94fd99e

Browse files
committed
Specify static linking
1 parent ec3933b commit 94fd99e

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

build/cmake_probe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl From<&str> for LinkLib {
7575
}
7676
}
7777

78-
#[derive(Debug, PartialEq, Eq)]
78+
#[derive(Debug, Clone, PartialEq, Eq)]
7979
pub struct LinkSearch(pub Linkage, pub PathBuf);
8080

8181
impl LinkSearch {

build/library.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ impl Linkage {
100100
}
101101

102102
pub fn as_cargo_rustc_link_spec_no_static(self) -> &'static str {
103-
// fixme: specifying static linkage breaks things in CI
104103
match self {
105-
Self::Default | Self::Dynamic | Self::Static => "",
104+
Self::Default | Self::Dynamic => "",
105+
Self::Static => "static=",
106106
Self::Framework => "framework=",
107107
}
108108
}
@@ -182,17 +182,18 @@ impl Library {
182182
fn process_link_paths<'a>(link_paths: Option<EnvList>, sys_link_paths: Vec<LinkSearch>) -> impl Iterator<Item = String> + 'a {
183183
Self::process_env_var_list(link_paths, sys_link_paths)
184184
.into_iter()
185-
.flat_map(move |path| {
186-
iter::once(path.emit_cargo_rustc_link_search()).chain(
187-
(*TARGET_VENDOR_APPLE && path.0 != Linkage::Framework)
188-
.then(|| LinkSearch(Linkage::Framework, path.1).emit_cargo_rustc_link_search()),
189-
)
185+
.flat_map(move |search| {
186+
iter::once(search.clone())
187+
.chain((*TARGET_VENDOR_APPLE && search.0 != Linkage::Framework).then(|| LinkSearch(Linkage::Framework, search.1)))
190188
})
189+
.inspect(|s| eprintln!("=== Link search path: {s:?}"))
190+
.map(|search| search.emit_cargo_rustc_link_search())
191191
}
192192

193193
fn process_link_libs<'a>(link_libs: Option<EnvList>, sys_link_libs: Vec<LinkLib>) -> impl Iterator<Item = String> + 'a {
194194
Self::process_env_var_list(link_libs, sys_link_libs)
195195
.into_iter()
196+
.inspect(|l| eprintln!("=== Linking to library: {l:?}"))
196197
.map(|l| l.emit_cargo_rustc_link())
197198
}
198199

ci/script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ elif [[ "$os_family" == "Linux" ]]; then
6565
export OPENCV_LINK_LIBS="+freetype,bz2,brotlidec,brotlicommon"
6666
else
6767
if [[ "${OPENCV_LINKAGE:-dynamic}" == "static" ]]; then # static build
68-
export OPENCV_LINK_LIBS=opencv_gapi,opencv_highgui,opencv_objdetect,opencv_dnn,opencv_videostab,opencv_calib3d,opencv_features2d,opencv_stitching,opencv_flann,opencv_videoio,opencv_rgbd,opencv_aruco,opencv_video,opencv_ml,opencv_imgcodecs,opencv_imgproc,opencv_core,ade,ittnotify,liblibwebp,liblibtiff,liblibjpeg-turbo,liblibpng,liblibopenjp2,ippiw,ippicv,liblibprotobuf,quirc,zlib
68+
export OPENCV_LINK_LIBS=opencv_gapi.a,opencv_highgui.a,opencv_objdetect.a,opencv_dnn.a,opencv_videostab.a,opencv_calib3d.a,opencv_features2d.a,opencv_stitching.a,opencv_flann.a,opencv_videoio.a,opencv_rgbd.a,opencv_aruco.a,opencv_video.a,opencv_ml.a,opencv_imgcodecs.a,opencv_imgproc.a,opencv_core.a,ade,ittnotify,liblibwebp,liblibtiff,liblibjpeg-turbo,liblibpng,liblibopenjp2,ippiw,ippicv,liblibprotobuf,quirc,zlib
6969
fi
7070
fi
7171
fi

0 commit comments

Comments
 (0)