Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Is aes somehow involved with the most recent builds from the mysql brew package? #10549

Closed
ylluminate opened this Issue · 13 comments

3 participants

@ylluminate

I'm getting some kind of issue with a -aes flag being passed to the mysql2 gem whilst attempting to build it. The developer is not sure where the -aes flag is coming from and I am wondering if anyone could enlighten me as to perhaps if the current homebrew mysql package is somehow bringing this into play.

I started a thread here about it which explains it a bit better and then links back to the mysql2 issue I created:
http://stackoverflow.com/questions/9475220/mysql-unrecognized-command-line-option-aes-with-ruby-1-9-3-p125/

@jacknagel
Owner

Short answer is "probably", can you post your brew --config and brew --env for reference?

@ylluminate

brew --config: https://gist.github.com/556e12eacf4f15d4a3d3

And indeed @jacknagel you are correct sir, lo and behold:
brew --env: https://gist.github.com/8398df43361f7df4b0cd

Hrm?

@jacknagel
Owner

My guess is that the gem is trying to compile with gcc-4.2, which is old enough that it doesn't support the -aes flag. Does the gem installation respect the CC variable, i.e. can you do CC=/usr/bin/clang gem install mysql2?

@ylluminate

Apparently not. CC=/usr/bin/clang gem install mysql2 does not succeed unfortunately in this case... Yields the same -aes issue.

@jacknagel
Owner

I'm assuming it is getting -aes from mysql_config --cflags.

Short of getting the gem build to use the same compiler that was used to build mysql, you _could_ edit mysql_config (it's just a shell script) and remove -aes from $cflags.

Other less attractive options may be to recompile mysql without -Xclang -aes, via something like ENV.remove_from_cflags /-Xclang -aes/, or with just --use-llvm or --use-gcc.

@ylluminate

Well, that's a nice quick and clean solution re: just editing the mysql_config. After editing out the -aes that it works perfectly. Thanks very much for the shortcut.

Apparently each time now though I recompile mysql with the stock options in homebrew it gives the same result so is there a more permanent solution that folks should use when hitting this issue down the road?

@jacknagel
Owner

Currently we pass -aes as a standard optimization flag when clang is used (on nehalem). I don't know what portion of packages in Homebrew are able to benefit from it, but I'd image we'll see more things like this crop up now that clang is the default in the Xcode 4.3 era.

A perfectly acceptable solution for now may be to disable it just in the mysql formula with ENV.remove_from_cflags /-Xclang -aes/, but it would be worth finding out whether or not mysql's AES functions take advantage of it or not first.

I'm mostly unfamiliar with the gem build process so I don't know at what level the choice of compiler is dictated, but IMO the real "bug" here is that you can't CC=/usr/bin/clang gem install mysql2.

@ylluminate

Could you indicate where perhaps this issue could be coming into play regarding what would be stopping CC from being defined as clang? It seems quite odd to me that this doesn't work and wouldn't mind poking about to see what may be going on here in this regard.

@jacknagel
Owner

Not having a system with these properties, keep in mind that I'm mostly shooting in the dark at this point.

Where does your /usr/bin/cc symlink point (i.e., readlink /usr/bin/cc)?

@ylluminate

readlink /usr/bin/cc -> clang

clang --version ->
Apple clang version 3.1 (tags/Apple/clang-318.0.45) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix

@jacknagel
Owner

Hmm.

When I gem install --verbose mysql2, it invokes simply "gcc", so it appears that something on the gem side (perhaps not specific to this gem) is hardcoding gcc.

@jacknagel
Owner

So it turns out we're already carrying a patch to remove optimization flags from mysql_config for this exact reason; will add -aes to that list.

@jacknagel jacknagel closed this issue from a commit
@jacknagel jacknagel mysql: prune clang-isms from `mysql_config --cflags`
Closes #10549.
cf #10842.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
1727299
@jacknagel jacknagel closed this in 1727299
@mnin mnin referenced this issue from a commit
@jacknagel jacknagel mysql: prune clang-isms from `mysql_config --cflags`
Closes #10549.
cf #10842.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
e62675b
@jvoorhis jvoorhis referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@MNeise MNeise referenced this issue from a commit
@jacknagel jacknagel mysql: prune clang-isms from `mysql_config --cflags`
Closes #10549.
cf #10842.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
e90bd82
@cacoco cacoco referenced this issue from a commit
@jacknagel jacknagel mysql: prune clang-isms from `mysql_config --cflags`
Closes #10549.
cf #10842.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
0548c81
@staticfloat staticfloat referenced this issue from a commit in staticfloat/homebrew
@jacknagel jacknagel mysql: prune clang-isms from `mysql_config --cflags`
Closes #10549.
cf #10842.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
4d93db5
@tenderlove

@jacknagel gems will be compiled with whatever compiler was used to compile Ruby itself. Adjusting CC when installing a gem will likely have no impact (unless the gem author specifically adds support in their extconf.rb). If someone compiles Ruby with GCC, then compiles mysql with clang, it could result in problems.

To find out the compiler used when Ruby was built, you can inspect the RbConfig::CONFIG constant:

$ ruby -v -rrbconfig -e"p RbConfig::CONFIG['CC']"
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
"gcc"
$ ruby -v -rrbconfig -e"p RbConfig::CONFIG['CC']"
ruby 2.0.0dev (2012-03-27 trunk 35152) [x86_64-darwin11.3.0]
"clang"

That said, I'm not sure how rvm handles installing Ruby. Ruby will try to use gcc if it's there, and you must supply CC=clang when running configure in order to change the compiler.

Hope that helps~

@julienXX julienXX referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@Sharpie Sharpie referenced this issue from a commit in Sharpie/homebrew
@jacknagel jacknagel mysql: prune clang-isms from `mysql_config --cflags`
Closes #10549.
cf #10842.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
5ba8172
@snakeyroc3 snakeyroc3 referenced this issue from a commit in snakeyroc3/homebrew
@jacknagel jacknagel mysql: prune clang-isms from `mysql_config --cflags`
Closes #10549.
cf #10842.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
99289c8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.