@@ -597,8 +597,8 @@ impl Build {
597
597
598
598
/// Set the `-shared` flag.
599
599
///
600
- /// When enabled, the compiler will produce a shared object which can
601
- /// then be linked with other objects to form an executable .
600
+ /// The method is reserved for linking a shared library, currently
601
+ /// a no-op .
602
602
///
603
603
/// # Example
604
604
///
@@ -615,18 +615,8 @@ impl Build {
615
615
616
616
/// Set the `-static` flag.
617
617
///
618
- /// When enabled on systems that support dynamic linking, this prevents
619
- /// linking with the shared libraries.
618
+ /// This is a no-op method retained for backward compatibility.
620
619
///
621
- /// # Example
622
- ///
623
- /// ```no_run
624
- /// cc::Build::new()
625
- /// .file("src/foo.c")
626
- /// .shared_flag(true)
627
- /// .static_flag(true)
628
- /// .compile("foo");
629
- /// ```
630
620
pub fn static_flag ( & mut self , static_flag : bool ) -> & mut Build {
631
621
self . static_flag = Some ( static_flag) ;
632
622
self
@@ -798,9 +788,8 @@ impl Build {
798
788
/// ```no_run
799
789
/// cc::Build::new()
800
790
/// .file("src/foo.c")
801
- /// .shared_flag(true)
802
791
/// .cpp_link_stdlib("stdc++")
803
- /// .compile("libfoo.so ");
792
+ /// .compile("foo ");
804
793
/// ```
805
794
pub fn cpp_link_stdlib < ' a , V : Into < Option < & ' a str > > > (
806
795
& mut self ,
@@ -1843,14 +1832,6 @@ impl Build {
1843
1832
cmd. args . push ( "-finput-charset=utf-8" . into ( ) ) ;
1844
1833
}
1845
1834
1846
- if self . static_flag . is_none ( ) {
1847
- let features = self . getenv ( "CARGO_CFG_TARGET_FEATURE" ) ;
1848
- let features = features. as_deref ( ) . unwrap_or_default ( ) ;
1849
- if features. contains ( "crt-static" ) {
1850
- cmd. args . push ( "-static" . into ( ) ) ;
1851
- }
1852
- }
1853
-
1854
1835
// armv7 targets get to use armv7 instructions
1855
1836
if ( target. starts_with ( "armv7" ) || target. starts_with ( "thumbv7" ) )
1856
1837
&& ( target. contains ( "-linux-" ) || target. contains ( "-kmc-solid_" ) )
@@ -2031,13 +2012,6 @@ impl Build {
2031
2012
self . ios_watchos_flags ( cmd) ?;
2032
2013
}
2033
2014
2034
- if self . static_flag . unwrap_or ( false ) {
2035
- cmd. args . push ( "-static" . into ( ) ) ;
2036
- }
2037
- if self . shared_flag . unwrap_or ( false ) {
2038
- cmd. args . push ( "-shared" . into ( ) ) ;
2039
- }
2040
-
2041
2015
if self . cpp {
2042
2016
match ( self . cpp_set_stdlib . as_ref ( ) , cmd. family ) {
2043
2017
( None , _) => { }
0 commit comments