Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crystal spec doesn't support --link-flags #6231

Closed
faustinoaq opened this issue Jun 21, 2018 · 1 comment · Fixed by #6243
Closed

crystal spec doesn't support --link-flags #6231

faustinoaq opened this issue Jun 21, 2018 · 1 comment · Fixed by #6243

Comments

@faustinoaq
Copy link
Contributor

faustinoaq commented Jun 21, 2018

Hi, I'm trying to run specs for Amber on macOS (amberframework/amber#879) and looks like brew openssl needs to be linked directly in the compiler, so I tried this: (suggested by @bcardiff )

crystal spec --link-flags -L/usr/local/opt/openssl/lib

And I got this:

Unhandled exception: Invalid option: --link-flags (OptionParser::InvalidOption)
  from /usr/local/Cellar/crystal-lang/0.25.0_1/src/option_parser.cr:79:45 in '->'
  from /usr/local/Cellar/crystal-lang/0.25.0_1/src/option_parser.cr:255:3 in 'check_invalid_options'
  from /usr/local/Cellar/crystal-lang/0.25.0_1/src/option_parser.cr:228:7 in 'parse'
  from /usr/local/Cellar/crystal-lang/0.25.0_1/src/option_parser.cr:184:5 in 'parse'
  from /usr/local/Cellar/crystal-lang/0.25.0_1/src/spec.cr:109:1 in '__crystal_main'
  from /usr/local/Cellar/crystal-lang/0.25.0_1/src/crystal/main.cr:104:5 in 'main_user_code'
  from /usr/local/Cellar/crystal-lang/0.25.0_1/src/crystal/main.cr:93:7 in 'main'
  from /usr/local/Cellar/crystal-lang/0.25.0_1/src/crystal/main.cr:133:3 in 'main'

I looked into the compiler source code and I found that crystal spec is using setup_simple_compiler_options, so, it doesn't support all flags.

private def setup_simple_compiler_options(compiler, opts)

OptionParser.parse(options) do |opts|
opts.banner = "Usage: crystal spec [options] [files]\n\nOptions:"
setup_simple_compiler_options compiler, opts
end

@felixbuenemann
Copy link
Contributor

felixbuenemann commented Jul 4, 2018

@faustinoaq You should be able to work around the issue using PKG_CONFIG_PATH:

PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig crystal spec

I'm using the same trick with shards build in a project that requires openssl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants