Skip to content

Commit 9cc373a

Browse files
committed
Merge pull request #593 from kirs/friendly-ext-error
Friendly ext build error <3
2 parents 5e21bf2 + 9877f96 commit 9cc373a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

ext/mysql2/extconf.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
require 'mkmf'
33

44
def asplode lib
5-
abort "-----\n#{lib} is missing. please check your installation of mysql and try again.\n-----"
5+
if RUBY_PLATFORM =~ /mingw|mswin/
6+
abort "-----\n#{lib} is missing. please check your installation of mysql and try again.\n-----"
7+
elsif RUBY_PLATFORM =~ /darwin/
8+
abort "-----\n#{lib} is missing. Try 'brew install mysql', check your installation of mysql and try again.\n-----"
9+
else
10+
abort "-----\n#{lib} is missing. Try 'apt-get install libmysqlclient-dev' or
11+
'yum install mysql-devel', check your installation of mysql and try again.\n-----"
12+
end
613
end
714

815
# 2.0-only
@@ -67,10 +74,14 @@ def asplode lib
6774
else
6875
inc, lib = dir_config('mysql', '/usr/local')
6976
libs = ['m', 'z', 'socket', 'nsl', 'mygcc']
77+
found = false
7078
while not find_library('mysqlclient', 'mysql_query', lib, "#{lib}/mysql") do
7179
exit 1 if libs.empty?
72-
have_library(libs.shift)
80+
found ||= have_library(libs.shift)
7381
end
82+
83+
asplode("mysql client") unless found
84+
7485
rpath_dir = lib
7586
end
7687

0 commit comments

Comments
 (0)