I'm trying to compile a contract using standard JSON through a script via the solc
compiler CLI. I have a folder structure for storing the .sol files, the input JSON, and the compiled JSON output. No matter what variation I use in --allow-paths it tells me the file does not exist, yet if I open the supposedly non-existent file in vim
it opens just fine.
I know the problem is with the --allow-paths
argument, but I cannot figure out what I'm doing wrong.
Say the folder structure is:
/var/www/html/path/to/file/sub/test.sol
for Solidity files/var/www/html/path/to/input/sub/input.json
for input JSON files/var/www/html/path/to/compiled/sub/compiled.json
for compiled JSON files
The commands I've tried are:
solc --standard-json --allow-paths "/var/www/html/path/to/file/sub/" < /var/www/html/path/to/input/sub/input.json > /var/www/html/path/to/compiled/sub/compiled.json
solc --standard-json --allow-paths /var/www/html/path/to/file/sub/ < /var/www/html/path/to/input/sub/input.json > /var/www/html/path/to/compiled/sub/compiled.json
solc --standard-json --allow-paths "/var/www/html/path/to/file/sub" < /var/www/html/path/to/input/sub/input.json > /var/www/html/path/to/compiled/sub/compiled.json
solc --standard-json --allow-paths /var/www/html/path/to/file/sub < /var/www/html/path/to/input/sub/input.json > /var/www/html/path/to/compiled/sub/compiled.json
solc --standard-json --allow-paths "/var/www/html/path/to/file" < /var/www/html/path/to/input/sub/input.json > /var/www/html/path/to/compiled/sub/compiled.json
solc --standard-json --allow-paths /var/www/html/path/to/file < /var/www/html/path/to/input/sub/input.json > /var/www/html/path/to/compiled/sub/compiled.json
- all variations above using relative paths instead from
/var/www/html/path
I've verified multiple times that the path to the Solidity file in the input JSON is correct, but no matter what I try I keep getting a file not found error:
{"component":"general","formattedMessage":"Cannot import url (\"/var/www/html/path/to/file/sub/test.sol\"): File not found.","message":"Cannot import url (\"/var/www/html/path/to/file/sub/test.sol\"): File not found.","severity":"error","type":"IOError"}