-
Notifications
You must be signed in to change notification settings - Fork 5.4k
merge flags when the second one does not have a -
#11085
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
base: master
Are you sure you want to change the base?
Conversation
Is only words that do not start with Anyway, Rather I think it should be |
Thanks @nobu for taking a look! Unfortunately, it's not something I can control. A few Ruby packages are doing this, e.g. Nokogiri: https://github.com/sparklemotion/nokogiri/blob/cee2c4dace0445e535aee0175afc0e10ecb193bc/ext/nokogiri/extconf.rb#L673 |
FYI @flavorjones, perhaps it's Nokogiri's |
FYI there are a couple of those in the wild: https://github.com/search?q=append_cflags%28ENV%5B%22CFLAGS%22%5D.split%29&type=code :) |
Is there a reason that you can't pass in a CFLAGS string without spaces in your use case? that is:
The Nokogiri extconf can certainly change this line:
to this
however, then trying the cflags from the environment variable is all-or-nothing, versus the current code which will try each in turn, and accept or reject each one based on compiler success or failure. For example, if I run:
Then I'll see this in the output:
If someone can suggest a better way to do this, I'm happy to update the gems I maintain which includes nokogiri. |
I don't really understand the need to check each flag set by the env one-by-one. It seems like overriding the intention of the user (and breaks in this case and a number of others, such as My idea for a better way was to only split at |
@wolfv As the maintainer of Nokogiri who has to deal with users asking my why their CFLAGS aren't taking effect ... I guess we will have to agree to disagree on whether this behavior is needed or not. The real long-term solution here is for mkmf to offer a better way to import compiler flags. |
I'm still curious about this.
Seems like a very easy workaround. |
See ruby/ruby#11085 for discussion
See sparklemotion/nokogiri#3274 which will make it into Nokogiri v1.17.0 |
**What problem is this PR intended to solve?** See ruby/ruby#11085 for discussion **Have you included adequate test coverage?** Existing test suite should be sufficient to tell us if this breaks things. **Does this change affect the behavior of either the C or the Java implementations?** N/A
|
I ran into some problems with packages such as
nokogiri
and flags likeCFLAGS=-isystem /foo
.The packages run something like
append_cflags(ENV["CFLAGS"].split) unless ENV["CFLAGS"].nil?
.This fails because the
/foo
would be stripped as it is not a valid CFLAG alone.That in turn leads to some compilation issues later.
I never coded in Ruby, so I am sure this solution isn't really good. Maybe some one can come up with a better patch for this issue. The idea is to look at the next argument, and figure out if it does not start with a
-
to merge it with the previous one.