Skip to content

Commit 7f4376f

Browse files
committed
Push forward on #20. Now blocked upstream.
This also fixes #5.
1 parent 295e204 commit 7f4376f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Language/Rust/Inline/Internal.hs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import System.FilePath ( (</>), (<.>), takeExtension )
3636
import System.Directory ( copyFile, createDirectoryIfMissing )
3737
import System.Process ( spawnProcess, readProcess, waitForProcess )
3838
import System.Exit ( ExitCode(..) )
39+
import System.Environment ( setEnv )
3940

4041
import Text.JSON
4142

@@ -160,6 +161,19 @@ cargoFinalizer extraArgs dependencies = do
160161
runIO $ writeFile cargoToml cargoSrc
161162

162163
-- Run Cargo to compile the project
164+
--
165+
-- NOTE: We set `--print native-static-libs` to inform the user these are the
166+
-- libraries they should be specifying in `ghc-options`. It would be
167+
-- much better if:
168+
--
169+
-- * We could parse the `stdout` and print out a `ghc-options` related
170+
-- message. _However_ the message only gets printed if cargo ended
171+
-- up doing work, and I don't know how to detect that.
172+
--
173+
-- * We could automatically link in these libraries, if GHC supported
174+
-- specifying libraries to pass to the final linker call.
175+
--
176+
runIO $ setEnv "RUSTFLAGS" "--print native-static-libs"
163177
let cargoArgs = [ "build"
164178
, "--release"
165179
, "--manifest-path=" ++ cargoToml

0 commit comments

Comments
 (0)