i had the same issue.  to answer your question, you can pass additional 
flags to gem install.  I had a similar issue on the beaglebone.  for some 
reason /usr/include and /lib were not being passed to the makefile.  the 
solution is to hack the files like you did, or to pass the command line 
argument like this:

 gem install your-gem-name -- --with-opt-include=/usr/include 
--with-opt-lib=/lib

for the gem I was installing, that did the trick.  the shared version of 
ibgcc was in my /lib directory, so I did not need to link static.  but the 
usr/include was also missing for me on my beaglebone.

this is a link that shows you all the other options you could pass through.
http://community.bitnami.com/t/gem-with-native-extension-installation-issue/3968

hopefully that will help you in the future.

On Friday, September 6, 2013 10:30:36 PM UTC-4, mark sayer wrote:
>
> Okay - I've made some progress. mkmf is definitely not picking up 
> /usr/include - if I manually compile the conftest.c program adding in 
> -I/usr/include it resolves the error. The next error I get is from ld 
> unable to find ggc_s - I can overcome this by linking to the static gcc 
> using -static-libgcc.
>
> This is the compiler command line I can use to successfully build 
> conftest.c adding the above options to the line automagically generated by 
> mkmf:
>
> arm-angstrom-linux-gnueabi-gcc  -march=armv7-a -mthumb-interwork 
> -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a8 
> --sysroot=/build/v2012.12/build/tmp-angstrom_v2012_12-eglibc/sysroots/beaglebone
>  
> -o conftest -I/usr/include/ruby-1.9.1/arm-linux-eabi 
> -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. 
> -D_FILE_OFFSET_BITS=64  -I/usr/include/mysql  -pipe -g 
> -feliminate-unused-debug-types   -DUNIV_LINUX -O2 -pipe -g 
> -feliminate-unused-debug-types -fPIC conftest.c  -L. -L/usr/lib -L. -Wl,-O1 
> -Wl,--hash-style=gnu -Wl,--as-needed -rdynamic -Wl,-export-dynamic   
>  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -rdynamic -L/usr/lib 
> -lmysqlclient -lz -lcrypt -lnsl -lm  -lruby  -lpthread -lrt -ldl -lcrypt 
> -lm   -lc -static-libgcc
>
> The question I have - is how do I configure mkmf to by default use these 
> options when building a native gem extension? mkmf.rb is difficult to 
> figure out and there deosn't seem to be much documentation around on how to 
> configure it. 
>
> Regards,
>
> Mark.
>
> On Monday, September 2, 2013 11:13:06 PM UTC+10, mark sayer wrote:
>>
>>
>> Howdy -
>>  
>> I'm having problems building native gems. When rubygem tries to make the 
>> native extension, I get an error saying string.h is not found.
>>  
>> I've compiled a basic C program with string.h to make sure all my default 
>> GCC include paths are right and it works fine. But I've tried to build 3 
>> gems now (I'm after mysql - but I've also tried json and others) all of 
>> which fail during make saying string.h not found.
>>  
>> I'm running
>>  
>> BeagleBon Black with Angtsrom 2012.12
>> Ruby 1.9.3p194
>> rubygem 1.8.23
>>  
>> I've installed the libc and other required development packaged using 
>> opkg. As stated I can compile C programs using GCC okay and I have verified 
>> string.h is available and basic string io functionality works in compiled C 
>> program.s
>>  
>> Here's the output from gem install mysql
>>  
>> Building native extensions.  This could take a while...
>> ERROR:  Error installing mysql:
>>         ERROR: Failed to build gem native extension.
>>         /usr/bin/ruby extconf.rb
>> checking for mysql_ssl_set()... *** extconf.rb failed ***
>> Could not create Makefile due to some reason, probably lack of
>> necessary libraries and/or headers.  Check the mkmf.log file for more
>> details.  You may need configuration options.
>> Provided configuration options:
>>         --with-opt-dir
>>         --without-opt-dir
>>         --with-opt-include
>>         --without-opt-include=${opt-dir}/include
>>         --with-opt-lib
>>         --without-opt-lib=${opt-dir}/lib
>>         --with-make-prog
>>         --without-make-prog
>>         --srcdir=.
>>         --curdir
>>         --ruby=/usr/bin/ruby
>>         --with-mysql-config
>>         --without-mysql-config
>> /usr/lib/ruby/mkmf.rb:381:in `try_do': The compiler failed to generate an 
>> executable file. (RuntimeError)
>> You have to install development tools first.
>>         from /usr/lib/ruby/mkmf.rb:461:in `try_link0'
>>         from /usr/lib/ruby/mkmf.rb:476:in `try_link'
>>         from /usr/lib/ruby/mkmf.rb:619:in `try_func'
>>         from /usr/lib/ruby/mkmf.rb:894:in `block in have_func'
>>         from /usr/lib/ruby/mkmf.rb:790:in `block in checking_for'
>>         from /usr/lib/ruby/mkmf.rb:284:in `block (2 levels) in postpone'
>>         from /usr/lib/ruby/mkmf.rb:254:in `open'
>>         from /usr/lib/ruby/mkmf.rb:284:in `block in postpone'
>>         from /usr/lib/ruby/mkmf.rb:254:in `open'
>>         from /usr/lib/ruby/mkmf.rb:280:in `postpone'
>>         from /usr/lib/ruby/mkmf.rb:789:in `checking_for'
>>         from /usr/lib/ruby/mkmf.rb:893:in `have_func'
>>         from extconf.rb:45:in `<main>'
>>
>> Gem files will remain installed in 
>> /usr/lib/ruby/gems/1.9.1/gems/mysql-2.9.1 for inspection.
>> Results logged to 
>> /usr/lib/ruby/gems/1.9.1/gems/mysql-2.9.1/ext/mysql_api/gem_make.out
>>  
>> Here's the mkmf.log file from the gem install mysql:
>>  
>> "arm-angstrom-linux-gnueabi-gcc  -march=armv7-a     -mthumb-interwork 
>> -mfloat-ab
>> i=softfp -mfpu=neon -mtune=cortex-a8 
>> --sysroot=/build/v2012.12/build/tmp-angstro
>> m_v2012_12-eglibc/sysroots/beaglebone -o conftest 
>> -I/usr/include/ruby-1.9.1/arm-
>> linux-eabi -I/usr/include/ruby-1.9.1/ruby/backward 
>> -I/usr/include/ruby-1.9.1 -I.
>>   -D_FILE_OFFSET_BITS=64  -I/usr/include/mysql  -pipe -g 
>> -feliminate-unused-debu
>> g-types   -DUNIV_LINUX -O2 -pipe -g -feliminate-unused-debug-types -fPIC 
>> conftes
>> t.c  -L. -L/usr/lib -L. -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed 
>> -rdynamic -
>> Wl,-export-dynamic    -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed 
>> -rdynamic -L/
>> usr/lib -lmysqlclient -lz -lcrypt -lnsl -lm  -lruby  -lpthread -lrt -ldl 
>> -lcrypt
>>  -lm   -lc"
>> In file included from /usr/include/ruby-1.9.1/ruby.h:32:0,
>>                  from conftest.c:1:
>> /usr/include/ruby-1.9.1/ruby/ruby.h:48:21: fatal error: string.h: No such 
>> file o
>> r directory
>> compilation terminated.
>> checked program was:
>> /* begin */
>> 1: #include "ruby.h"
>> 2:
>> 3: int main() {return 0;}
>> /* end */
>>
>> Any ideas why I might be getting this error? Mu assumption is that the 
>> compiler flags set by extconf.rb are somehow excluding the paths for 
>> dtring.h includes on the agnstrom distro? But I'm lost here - any pointers 
>> welcome.
>>  
>> Thanks,
>>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to