pub fn ld_builder(app_name: String, build_dir: &str) -> Result<(), String> {
    let obj_file_name = format!("{}/{}.o", build_dir, app_name);
    let a_file_name = format!("{}/lib{}.a", build_dir, app_name);
    let app_file_name = format!("{}/{}", build_dir, app_name);
    let obj_file = Path::new(&obj_file_name);

    Command::new("ld")
        .args(&[
            "-o",
            &app_file_name,
            "-dynamic-linker",
            "/lib64/ld-linux-x86-64.so.2",
            "/usr/lib/x86_64-linux-gnu/crt1.o",
            "/usr/lib/x86_64-linux-gnu/crti.o",
            "/usr/lib/x86_64-linux-gnu/crtn.o",
            "-lc",
            &a_file_name,
        ])
        .spawn()
        .map_err(|_| "Failed to run `ld` command".to_string())?
        .wait()
        .map_err(|_| "Failed to process `ld` command".to_string())?;
    std::fs::remove_file(obj_file).or::<String>(Ok(()))
}
/// Run linker with `ld` tool
Run linker with `ld` tool
Run linker with ` ld ` tool
pub fn ld_builder(app_name: String, build_dir: &str) -> Result<(), String> {
    let obj_file_name = format!("{}/{}.o", build_dir, app_name);
    let a_file_name = format!("{}/lib{}.a", build_dir, app_name);
    let app_file_name = format!("{}/{}", build_dir, app_name);
    let obj_file = Path::new(&obj_file_name);
    Command::new("ld")
        .args(&[
            "-o",
            &app_file_name,
            "-dynamic-linker",
            "/lib64/ld-linux-x86-64.so.2",
            "/usr/lib/x86_64-linux-gnu/crt1.o",
            "/usr/lib/x86_64-linux-gnu/crti.o",
            "/usr/lib/x86_64-linux-gnu/crtn.o",
            "-lc",
            &a_file_name,
        ])
        .spawn()
        .map_err(|_| "Failed to run `ld` command".to_string())?
        .wait()
        .map_err(|_| "Failed to process `ld` command".to_string())?;
    std::fs::remove_file(obj_file).or::<String>(Ok(()))
}
pub fn ld_builder ( app_name : String , build_dir : & str ) -> Result < ( ) , String > { let obj_file_name = format ! ( " " build_dir app_name ) ; let a_file_name = format ! ( " " build_dir app_name ) ; let app_file_name = format ! ( " " build_dir app_name ) ; let obj_file = Path :: new ( & obj_file_name ) ; Command :: new ( " " ) . args ( & [ " " , & app_file_name , " " , " " , " " , " " , " " , " " , & a_file_name , ] ) . spawn ( ) . map_err ( | _ | " " . to_string ( ) ) ? . wait ( ) . map_err ( | _ | " " . to_string ( ) ) ? ; std :: fs :: remove_file ( obj_file ) . or :: < String > ( Ok ( ( ) ) ) }
Run linker with `ld` tool
Run linker with ` ld ` tool
app_name
String
build_dir
&str