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

Spec: allow --link-flags to be used #6243

Merged
merged 2 commits into from Jan 11, 2021

Conversation

bcardiff
Copy link
Member

Fix #6231 .

The --link-flags is not added in the setup_simple_compiler_options because setting the compiler.link_flags is done after the OptionParser.parse.

Nevertheless the setup_simple_compiler_options is used for crystal eval and crystal spec only.
I don't think --link-flags are needed for eval

@RX14
Copy link
Contributor

RX14 commented Jun 22, 2018

--link-flags does make sense for eval, because the resulting executable is linked and executed normally.

@bcardiff
Copy link
Member Author

they make sense yes, but is there a use case for that?

@faustinoaq
Copy link
Contributor

@bcardiff @RX14 maybe this: (oneliner server like python -m http.server on macOS)

crystal eval 'server=HTTP::Server.new(HTTP::StaticFileHandler.new("."));server.listen(8080)' --link-flags -L/usr/local/opt/openssl/lib

@asterite
Copy link
Member

What is the --link-flags used for?

@RX14
Copy link
Contributor

RX14 commented Jun 23, 2018

@bcardiff when you need extra link flags to make an executable run at all? Perhaps you just want to run a quick snippet like require "myshard"; MyShard.foo, but you want to test the snippet against two seperately installed versions of a C library.

Why not allow it, if it's pretty much easier to allow it than disallow it, by placing the option where the rest of the shared compiler flags are anyway?

@RX14
Copy link
Contributor

RX14 commented Jun 23, 2018

Oh, I misread the OP. I thought you were keeping --link-flags out of setup_simple_compiler_options because you specifically didn't want it on eval, not just for technical reasons. Surely we could do something like compiler.link_flags += " #{link_flag}" in the handler and put it in setup_simple_compiler_options...

@bcardiff bcardiff merged commit 4522952 into crystal-lang:master Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

crystal spec doesn't support --link-flags
5 participants