File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1720,6 +1720,23 @@ impl Build {
17201720 } else if target. contains ( "aarch64" ) {
17211721 cmd. args . push ( "--target=aarch64-unknown-windows-gnu" . into ( ) )
17221722 }
1723+ } else if target. ends_with ( "-freebsd" ) && self . get_host ( ) ?. eq ( target) {
1724+ // clang <= 13 on FreeBSD doesn't support a target triple without at least
1725+ // the major os version number appended; e.g. use x86_64-unknown-freebsd13
1726+ // or x86_64-unknown-freebsd13.0 instead of x86_64-unknown-freebsd.
1727+ let stdout = std:: process:: Command :: new ( "freebsd-version" )
1728+ . output ( )
1729+ . map_err ( |e| {
1730+ Error :: new (
1731+ ErrorKind :: ToolNotFound ,
1732+ & format ! ( "Error executing freebsd-version: {}" , e) ,
1733+ )
1734+ } ) ?
1735+ . stdout ;
1736+ let stdout = String :: from_utf8_lossy ( & stdout) ;
1737+ let os_ver = stdout. split ( '-' ) . next ( ) . unwrap ( ) ;
1738+
1739+ cmd. push_cc_arg ( format ! ( "--target={}{}" , target, os_ver) . into ( ) ) ;
17231740 } else {
17241741 cmd. push_cc_arg ( format ! ( "--target={}" , target) . into ( ) ) ;
17251742 }
You can’t perform that action at this time.
0 commit comments