diff --git a/ethereumj-core/src/main/java/org/ethereum/solidity/compiler/Solc.java b/ethereumj-core/src/main/java/org/ethereum/solidity/compiler/Solc.java index 3a6da28089..c3caa38265 100644 --- a/ethereumj-core/src/main/java/org/ethereum/solidity/compiler/Solc.java +++ b/ethereumj-core/src/main/java/org/ethereum/solidity/compiler/Solc.java @@ -25,15 +25,15 @@ private Solc() { } private void init() throws IOException { - File tmpDir = new File(System.getProperty("java.io.tmpdir")); + File tmpDir = new File(System.getProperty("java.io.tmpdir"), "solc"); - InputStream is = getClass().getResourceAsStream("/bin/" + getOS() + "/file.list"); + InputStream is = getClass().getResourceAsStream("/native/" + getOS() + "/solc/file.list"); Scanner scanner = new Scanner(is); while (scanner.hasNext()) { String s = scanner.next(); File targetFile = new File(tmpDir, s); if (!targetFile.canRead()) { - InputStream fis = getClass().getResourceAsStream("/bin/" + getOS() + "/" + s); + InputStream fis = getClass().getResourceAsStream("/native/" + getOS() + "/solc/" + s); Files.copy(fis, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } if (solc == null) { diff --git a/ethereumj-core/src/main/java/org/ethereum/solidity/compiler/SolidityCompiler.java b/ethereumj-core/src/main/java/org/ethereum/solidity/compiler/SolidityCompiler.java index f3060821af..192ac8b6b9 100644 --- a/ethereumj-core/src/main/java/org/ethereum/solidity/compiler/SolidityCompiler.java +++ b/ethereumj-core/src/main/java/org/ethereum/solidity/compiler/SolidityCompiler.java @@ -97,9 +97,12 @@ public static Result compile(byte[] source, boolean combinedJson, Options... opt } } - Process process = new ProcessBuilder(commandParts) - .directory(Solc.INSTANCE.getExecutable().getParentFile()) - .start(); + ProcessBuilder processBuilder = new ProcessBuilder(commandParts) + .directory(Solc.INSTANCE.getExecutable().getParentFile()); + processBuilder.environment().put("LD_LIBRARY_PATH", + Solc.INSTANCE.getExecutable().getParentFile().getCanonicalPath()); + + Process process = processBuilder.start(); try (BufferedOutputStream stream = new BufferedOutputStream(process.getOutputStream())) { stream.write(source);