Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffi won't compile on Solaris 11.x #360

Open
efrancis opened this issue Aug 7, 2014 · 16 comments
Open

ffi won't compile on Solaris 11.x #360

efrancis opened this issue Aug 7, 2014 · 16 comments
Labels

Comments

@efrancis
Copy link

efrancis commented Aug 7, 2014

When trying to install ffi on Solaris 11 (tested 11.1 and 11.2), you get prompted that you need to install developer tools first (even though everything is installed).

If you comment out the line that was added for Solaris 10 in ext/ffi_c/extconf.rb, then ffi installs successfully:
# $CFLAGS << " -std=c99" if RbConfig::CONFIG['host_os'] =~ /solaris/

@efrancis efrancis closed this as completed Aug 7, 2014
@efrancis
Copy link
Author

I seem to have mistakenly closed this issue when posting it. Though I found a workaround, it should probably remain open, until the official version includes a fix for it.

@efrancis efrancis reopened this Aug 18, 2014
@djberg96
Copy link
Contributor

The original issue was #91. I'm curious why that would cause issues, though.

@efrancis
Copy link
Author

Since I don't even know what -std=c99 does, I can't begin to guess on the cause of this. But when I found the other thread, and read that this was added specifically for Solaris 10, I just tried commenting it out on Solaris 11, on the offhand chance that it might work, and it did.

@djberg96
Copy link
Contributor

As I understand it, it forces compilation with c99 (should be under /usr/bin or wherever your gcc compiler is), which means it won't use features of gcc that aren't compatible with the C99 standard.

https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html

@efrancis
Copy link
Author

With the c99 option, it claims I need to install development tools first. However I've got the gcc package distributed in the official package manager by Oracle. Here's the error output:

Installing ffi-1.9.3.gem ...
Building native extensions. This could take a while...
ERROR: Error installing pkg/ffi-1.9.3.gem:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
/usr/local/lib/ruby/2.1.0/mkmf.rb:456:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/local/lib/ruby/2.1.0/mkmf.rb:541:intry_link0'
from /usr/local/lib/ruby/2.1.0/mkmf.rb:556:in try_link' from /usr/local/lib/ruby/2.1.0/mkmf.rb:642:inblock in try_ldflags'
from /usr/local/lib/ruby/2.1.0/mkmf.rb:635:in with_ldflags' from /usr/local/lib/ruby/2.1.0/mkmf.rb:641:intry_ldflags'
from /usr/local/lib/ruby/2.1.0/mkmf.rb:1762:in pkg_config' from extconf.rb:15:in

'

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.1.0/gems/ffi-1.9.3 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.1.0/extensions/x86-solaris-2.11/2.1.0-static/ffi-1.9.3/gem_make.out
!!! Command failed: gem install -q pkg/ffi-1.9.3.gem

@tduehr
Copy link
Member

tduehr commented Sep 8, 2014

Can you post the content of gem_make.out?

@johnknott
Copy link

I can confirm this also affects Smartos in the same way, and commenting out the same line enables extensions to compile successfully.

FWIW, on the latest version of Smartos:

RbConfig::CONFIG['host_os']
=> "solaris2.11"

@efrancis
Copy link
Author

efrancis commented Sep 9, 2014

gem_make.out:

/usr/local/bin/ruby extconf.rb
/usr/local/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/local/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
    from /usr/local/lib/ruby/2.1.0/mkmf.rb:556:in `try_link'
    from /usr/local/lib/ruby/2.1.0/mkmf.rb:642:in `block in try_ldflags'
    from /usr/local/lib/ruby/2.1.0/mkmf.rb:635:in `with_ldflags'
    from /usr/local/lib/ruby/2.1.0/mkmf.rb:641:in `try_ldflags'
    from /usr/local/lib/ruby/2.1.0/mkmf.rb:1762:in `pkg_config'
    from extconf.rb:15:in `<main>'

extconf failed, exit code 1

mkmf.log:

"gcc -o conftest -I/usr/local/include/ruby-2.1.0/i386-solaris2.11 -I/usr/local/include/ruby-2.1.0/ruby/backward -I/usr/local/include/ruby-2.1.0 -I.  -D_FILE_OFFSET_BITS=64   -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -std=c99 conftest.c  -L. -L/usr/local/lib -lffi     -lruby-static  -lpthread -lsocket -ldl -lcrypt -lm   -lc"
In file included from /usr/include/math.h:13:0,
                 from /usr/local/include/ruby-2.1.0/ruby/missing.h:23,
                 from /usr/local/include/ruby-2.1.0/ruby/defines.h:68,
                 from /usr/local/include/ruby-2.1.0/ruby/ruby.h:29,
                 from /usr/local/include/ruby-2.1.0/ruby.h:33,
                 from conftest.c:1:
/usr/local/include/ruby-2.1.0/ruby/missing.h:215:17: error: expected identifier or ‘(’ before ‘__extension__’
 RUBY_EXTERN int signbit(double x);
                 ^
/usr/local/include/ruby-2.1.0/ruby/missing.h:215:17: error: expected identifier or ‘(’ before ‘)’ token
 RUBY_EXTERN int signbit(double x);
                 ^
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

@tduehr tduehr added the bug label Sep 15, 2014
@tduehr
Copy link
Member

tduehr commented Oct 9, 2014

Should be fixed in 1.9.6

@tduehr
Copy link
Member

tduehr commented Oct 13, 2014

Okay. This I don't get. This is the result of trying to install on solaris 11 at this point. somehow Ruby installs just fine, but the headers break when trying to install gems.

/usr/local/rvm/rubies/ruby-2.1.3/include/ruby-2.1.0/ruby/missing.h:215:17: error: expected identifier or ‘(’ before ‘__extension__’
 RUBY_EXTERN int signbit(double x);
                 ^
/usr/local/rvm/rubies/ruby-2.1.3/include/ruby-2.1.0/ruby/missing.h:215:17: error: expected identifier or ‘(’ before ‘)’ token
 RUBY_EXTERN int signbit(double x);
                 ^
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

@face
Copy link

face commented Nov 26, 2014

'solaris2.11' =~ /solaris(!?2.11)/ will return 0, which in ruby is true so the flag is still present in solaris 11 ffi 1.9.6. This pull request should fix: #391

@bahamat
Copy link

bahamat commented Jan 6, 2015

There are two pull requests open to address this issue. #382 and #391. Can we get consensus on which one should be merged?

@tduehr
Copy link
Member

tduehr commented Jan 7, 2015

Neither. They don't address the whole thing. I'll get this ironed out in the morning.

@tduehr
Copy link
Member

tduehr commented Jan 8, 2015

Give #399 a try. It should work for both solaris 10 and 11. I've only tested it on 11 so far.

@efrancis
Copy link
Author

efrancis commented Jan 8, 2015

Tested on Solaris 11.2 and works perfectly now.

@bahamas10
Copy link

#382, #391 and #399 all tested and working on SmartOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants