From 647851e1e103f9c3125b424a2fab160b3bb342c1 Mon Sep 17 00:00:00 2001 From: Terence Lee Date: Wed, 9 Aug 2017 15:17:21 -0500 Subject: [PATCH] Fix linking neon-runtime on windows. -l is only intended to communicate the names of libraries See https://github.com/rust-lang/rust/issues/38850 for more details. --- crates/neon-runtime/build.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/neon-runtime/build.rs b/crates/neon-runtime/build.rs index d0d311976..84c097c1e 100644 --- a/crates/neon-runtime/build.rs +++ b/crates/neon-runtime/build.rs @@ -2,6 +2,7 @@ extern crate gcc; use std::process::Command; use std::env; +use std::path::Path; fn main() { // 1. Build the object file from source using node-gyp. @@ -58,7 +59,10 @@ fn build_object_file() { .map(|i| i + node_lib_file_flag_pattern.len()) .expect("Couldn't find node_lib_file in node-gyp output."); let node_lib_file_end_index = node_gyp_output[node_lib_file_start_index..].find(".lib").unwrap() + node_lib_file_start_index; - println!("cargo:node_lib_file={}", &node_gyp_output[node_lib_file_start_index..node_lib_file_end_index]); + let node_lib_file = &node_gyp_output[node_lib_file_start_index..node_lib_file_end_index]; + let file = Path::new(node_lib_file); + println!("cargo:rustc-link-search=native={}", file.parent().unwrap().display()); + println!("cargo:rustc-link-lib={}", file.file_name().unwrap().to_str().unwrap()); } // Run `node-gyp build`.