Skip to content
This repository

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

Closed
ylluminate opened this Issue · 13 comments

3 participants

George Plymale Jack Nagel Aaron Patterson
George Plymale

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/

Jack Nagel
Owner

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

George Plymale

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?

Jack Nagel
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?

George Plymale

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

Jack Nagel
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.

George Plymale

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?

Jack Nagel
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.

George Plymale

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.

Jack Nagel
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)?

George Plymale

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

Jack Nagel
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.

Jack Nagel
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.

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

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

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

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

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

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

@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~

Julien BLANCHARD julienXX referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Charlie Sharpsteen Sharpie referenced this issue from a commit in Sharpie/homebrew
Jack Nagel 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
Jack Nagel 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.