{"id":578,"date":"2006-12-21T00:43:39","date_gmt":"2006-12-21T05:43:39","guid":{"rendered":"http:\/\/blogs.law.harvard.edu\/hoanga\/2006\/12\/21\/gem-install-mysql-failing-on-ubuntu-fi"},"modified":"2006-12-21T00:43:39","modified_gmt":"2006-12-21T05:43:39","slug":"gem-install-mysql-failing-on-ubuntu-fix","status":"publish","type":"post","link":"https:\/\/archive.blogs.harvard.edu\/hoanga\/2006\/12\/21\/gem-install-mysql-failing-on-ubuntu-fix\/","title":{"rendered":"gem install mysql failing on Ubuntu fix"},"content":{"rendered":"<h4>The problem<\/h4>\n<p>Did you try something stupid (and expect something hopeful) like:<\/p>\n<blockquote><p>\n$ sudo gem install mysql\n<\/p><\/blockquote>\n<p>Then get something beautiful like:<\/p>\n<blockquote>\n<pre>\r\nERROR:  While executing gem ... (RuntimeError)\r\n    ERROR: Failed to build gem native extension.\r\nGem files will remain installed in \/usr\/lib\/ruby\/gems\/1.8\/gems\/mysql-2.7 for inspection.\r\n<\/pre>\n<\/blockquote>\n<p>\nWelcome to getting bit by the<br \/>\n<a href=\"http:\/\/www.debian.org\/doc\/debian-policy\/ch-sharedlibs.html\">policy of the Debian packaging policy<\/a> problem where one software package can be split into muliple pieces.  In general the policy makes sense unless you&#8217;re doing development then you have to remember this.\n<\/p>\n<h4>The fix<\/h4>\n<p>Assuming you installed mysql server via something like <em>sudo apt-get install mysql-server<\/em> the next thing you need is the MySQL development headers in order for the Ruby Gem to compile.   Simple eh?  <em>sudo apt-get install mysql-dev<\/em>.  Well not that but close.  It&#8217;s (because you need to specify the particular version of development libraries very often):<\/p>\n<blockquote><p>\n$ sudo apt-get install libmysqlclient5-dev\n<\/p><\/blockquote>\n<p>Now back to business<\/p>\n<blockquote>\n<pre>\r\n$ sudo gem install mysql\r\nSelect which gem to install for your platform (i486-linux)\r\n 1. mysql 2.7.1 (mswin32)\r\n 2. mysql 2.7 (ruby)\r\n 3. mysql 2.6 (ruby)\r\n 4. mysql 2.5.1 (ruby)\r\n 5. Cancel installation\r\n&gt; 2\r\nBuilding native extensions.  This could take a while...\r\n[snip]\r\ncreating Makefile\r\n\r\nmake\r\ngcc [stuff]\r\ngcc [stuff]\r\nmake install\r\nmkdir -p \/usr\/lib\/ruby\/gems\/1.8\/gems\/mysql-2.7\/lib\r\n\/usr\/bin\/install -c -m 0755 mysql.so \/usr\/lib\/ruby\/gems\/1.8\/gems\/mysql-2.7\/lib\r\n\r\nmake clean\r\nSuccessfully installed mysql-2.7\r\n<\/pre>\n<\/blockquote>\n<p>Now back to business.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The problem Did you try something stupid (and expect something hopeful) like: $ sudo gem install mysql Then get something beautiful like: ERROR: While executing gem &#8230; (RuntimeError) ERROR: Failed to build gem native extension. Gem files will remain installed in \/usr\/lib\/ruby\/gems\/1.8\/gems\/mysql-2.7 for inspection. Welcome to getting bit by the policy of the Debian packaging [&hellip;]<\/p>\n","protected":false},"author":703,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1216,972,615,1217],"tags":[],"class_list":["post-578","post","type-post","status-publish","format-standard","hentry","category-fixes","category-programming","category-ruby","category-stupid"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/posts\/578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/users\/703"}],"replies":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/comments?post=578"}],"version-history":[{"count":0,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/posts\/578\/revisions"}],"wp:attachment":[{"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/media?parent=578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/categories?post=578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/hoanga\/wp-json\/wp\/v2\/tags?post=578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}