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

"gem install passenger" fails Solaris 10/SPARC (struct msghdr) #119

Closed
FooBarWidget opened this issue May 29, 2014 · 19 comments
Closed

"gem install passenger" fails Solaris 10/SPARC (struct msghdr) #119

FooBarWidget opened this issue May 29, 2014 · 19 comments

Comments

@FooBarWidget
Copy link
Member

From martin.carpenter on April 14, 2008 20:33:28

Running the command:

gem install passenger

fails at the build stage on Solaris 10 SPARC (possibly also x86:
untested). Errors and system information are below. A typical compiler
error is:

native_support.c:63: error: structure has no member named `msg_control'

See the following guard in <sys/socket.h>:

if defined(_XPG4_2) || defined(_KERNEL)

void msg_control; / ancillary data /
socklen_t msg_controllen; /
ancillary data buffer len /
int msg_flags; /
flags on received message */

else

gem install passenger

Updating metadata for 7 gems from http://gems.rubyforge.org/ .......
complete
Bulk updating Gem source index for: http://gems.rubyforge.org/ Building native extensions. This could take a while...
ERROR: Error installing passenger:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb install passenger
creating Makefile

make
gcc -I. -I/usr/local/lib/ruby/1.8/sparc-solaris2.10 -I/usr/local/lib/ruby/
1.8/sp
arc-solaris2.10 -I. -I/usr/local/include -I/usr/local/ssl/include -I/usr/
local/i
nclude/ncurses -I/usr/local/BerkeleyDB.4.2/include -I/usr/openwin/include -
fPIC
-O2 -L/usr/local/lib -R/usr/local/lib -L/usr/local/ssl/lib -R/usr/local/
ssl/lib
-L/usr/openwin/lib -R/usr/openwin/lib -c native_support.c
native_support.c: In function send_fd': native_support.c:63: error: structure has no member namedmsg_control'
native_support.c:64: error: structure has no member named msg_controllen' native_support.c:65: error: structure has no member namedmsg_flags'
native_support.c: In function recv_fd': native_support.c:107: error: structure has no member namedmsg_control'
native_support.c:108: error: structure has no member named msg_controllen' native_support.c:109: error: structure has no member namedmsg_flags'
native_support.c:120: error: structure has no member named `msg_controllen'
make: *** [native_support.o] Error 1

Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/
passenger-1
.0.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/passenger-1.0.1/ext/
passenge
r/gem_make.out

System/environment information follows:

$ uname -a
SunOS ftl1sutst04 5.10 Generic_125100-06 sun4u sparc SUNW,UltraAX-i2
$
$ ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [sparc-solaris2.10]
ftl1sutst04 $ pkginfo -x SMCruby
SMCruby ruby
(sparc) 1.8.6
$
$ gem -v
1.1.1
$
$ gcc -v
Reading specs from /opt/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.2/specs
Configured with: ../gcc-3.4.2/configure --prefix=/opt/sfw --with-ld=/usr/
ccs/bin/ld --with-gnu-as --with-as=/opt/sfw/bin/gas --enable-shared --
disable-libgcj
Thread model: posix
gcc version 3.4.2
$

Original issue: http://code.google.com/p/phusion-passenger/issues/detail?id=18

@FooBarWidget
Copy link
Member Author

From honglilai on April 14, 2008 12:51:17

Could you add '#define _KERNEL' to the beginning of ext/passenger/native_support.c
and check whether that works?

@FooBarWidget
Copy link
Member Author

From honglilai on April 14, 2008 15:36:21

Labels: OpSys-Solaris Portability

@FooBarWidget
Copy link
Member Author

From martin.carpenter on April 15, 2008 01:15:59

Either definition (_KERNEL or _XPG4_2) is sufficient to resolve the issue (and not
introduce any other compilation errors).

#define _XPG_4_2 seems a more sensible choice?

pwd

/usr/local/lib/ruby/gems/1.8/gems/passenger-1.0.1/ext/passenger

make

gcc -I. -I/usr/local/lib/ruby/1.8/sparc-solaris2.10 -I/usr/local/lib/ruby/1.8/sparc-
solaris2.10 -I. -I/usr/local/include -I/usr/local/ssl/include -I/usr/local/include/
ncurses -I/usr/local/BerkeleyDB.4.2/include -I/usr/openwin/include -fPIC -O2 -L/usr/
local/lib -R/usr/local/lib -L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/openwin/
lib -R/usr/openwin/lib -c native_support.c
gcc -shared -L/usr/local/lib -R/usr/local/lib -R/usr/lib -L/usr/lib -R/usr/openwin/
lib -L/usr/openwin/lib -L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/local/
BerkeleyDB.4.2/lib -R/usr/local/BerkeleyDB.4.2/lib -L/usr/X11R6/lib -R/usr/X11R6/
lib -L'/usr/local/lib' -Wl,-R'/usr/local/lib' -o native_support.so
native_support.o -ldl -lcrypt -lm -lc

@FooBarWidget
Copy link
Member Author

From honglilai on April 15, 2008 01:57:24

Compilation succeeds, that's good. But does Passenger actually work after this?

@FooBarWidget
Copy link
Member Author

From martin.carpenter on April 15, 2008 15:31:16

Compilation continues, but the build does not succeed. I have tested manually as
follows:

pwd

/usr/local/lib/ruby/gems/1.8/gems/passenger-1.0.1

rake clean

...

rake

...

I've attached the script of my session, with _XPG4_2 #def'ed early in
native_support.c as above.

There are a two issues:

  1. Redefinitions of UINT8_C, UINT16_C, UINT32_C. Definitions in system file /usr/
    include/sys/int_const.h conflicts with boost/cstdint.hpp. These throw warnings.
  2. uint8/16/32_t typedefs are missing. These throw errors. Needs <stdint.h> from
    somewhere?

Attached full script from my test.

Attachment: typescript

@FooBarWidget
Copy link
Member Author

From yukkestar on April 29, 2008 19:35:36

fails Solaris 10/i386

$ uname -a
SunOS abc 5.10 Generic_118855-33 i86pc i386 i86pc
$ ruby -v
ruby 1.8.6 (2008-03-03 patchlevel 114) [i386-solaris2.10]
$ gem -v
1.1.0
$ gcc -v
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/specs
Configured with: /builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld
--without-gnu-ld --enable-languages=c,c++ --enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)

@FooBarWidget
Copy link
Member Author

From robbie.allen on May 01, 2008 13:18:11

Any update on a fix? It fails for me too:

[DEV:/] admin$ uname -a
SunOS z13661AA.textdrive.com 5.11 snv_65 i86pc i386 i86pc
[DEV:/] admin$ ruby -v
ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-solaris2.8]
[DEV:/] admin$ gem -v
0.9.2
[DEV:/] admin$ gcc -v
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/specs
Configured with: /builds2/sfwnv-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld
--without-gnu-ld --enable-languages=c,c++,f77,objc --enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-20050802)

@FooBarWidget
Copy link
Member Author

From honglilai on May 01, 2008 15:04:30

Well none of our team have Solaris, so a patch would be much appreciated.

@FooBarWidget
Copy link
Member Author

From Rawn027 on May 01, 2008 16:25:13

Something that might be worth it is a development VM for Solaris. If you need any suggestions of tips, let me
know.

@FooBarWidget
Copy link
Member Author

From ausbits on May 06, 2008 07:21:03

I see on http://blog.igorminar.com/2006/09/solaris-lighttpd-fastcgi-ssl-howto.html that the Sun C compiler was required in order to successfully compile ruby-fcgi. I
am wondering if this might also prove useful for mod_rails.

This is a totally naive comment on my part, but I am keen to see passenger up and
running on Solaris so I thought I would mention it as another thing to try.

@FooBarWidget
Copy link
Member Author

From chris.a.williams on May 20, 2008 07:19:57

Just a note that someone did manage to get it compiled under Sun Studio on an
OpenSolaris machine: http://tempusfactor.com/2008/04/the-joy-of-c/ Though when I tried to run bin/passenger-install-apache2-module on a Joyent machine
with the tarball he links I wasn't able to get it to compile.

David Kleiner is also trying and ran into issues: http://opensolaris.org/jive/thread.jspa?threadID=57357&tstart=15 and http://groups.google.com/group/phusion-passenger/browse_thread/thread/6870c2f026926ae2/0c6deb7df69f9d37 I'd really like to get this working on my Joyent box, it seems like combined we're
pretty close to getting it compiling - but I'm useless with fixing builds and C/C++
code myself.

Has anyone managed to get it to work? I can provide SSH/SFTP access to a Joyent box
for you if it'll help Hongli. It'd be great to get mod_rails on Joyent as they are
one of the more well-known Rails hosting providers....

@FooBarWidget
Copy link
Member Author

From chris.a.williams on May 20, 2008 07:24:18

I should note that the box I'm trying to get it compiled on outputs the following for
uname -a:
SunOS xxx.joyent.us 5.11 snv_86 i86pc i386 i86pc

@FooBarWidget
Copy link
Member Author

From harrisj.home on June 03, 2008 08:20:42

I actually got mod_rails to finally compile on Solaris 10 x86 with GCC by making a
few modifications to the rake files and source. It ran through all the tests too,
although I haven't yet tried using it to serve content. But this is what worked for
me (thanks to the suggestions made by others previously):

  • I placed a #define _XPG4_2 directive at the top of native_support.c
  • In the extconf.rb for native_support.c, I added the following line
    have_library('xnet')
    would only want to do this for Solaris.
  • In the Rakefile, I added the following CPPFLAGS
    -D_XOPEN_SOURCE=500 -D_XPG4_2 -D__EXTENSIONS__ -DBOOST_HAS_STDINT_H
    I am no expert in Solaris compilation, but the purpose of 3 of these are to tell
    Solaris to use Posix/Xopen/XNS directives in the include and a smarter person than I
    could probably figure out a better way to do that. The last directive is to keep
    Boost from loading its own definitions for the types in stdint.h
  • To the LDFLAGS, I added the following "-lxnet -lrt -lsocket -lnsl" to link in
    Solaris' networking libraries (someone can probably figure out a better way of
    including this stuff).
  • In the apache module code, I replaced all references to mutex with boost::mutex to
    disambiguate which mutex class I was using.

And that seemed to do the trick. The hard part was figuring out how to enable various
functionality in the Solaris includes and what linker/define flags to use. Just
because it compiles does not necessarily mean it's linked correctly. Some linking
problems were apparent only when I ran rake test:apache. And I haven't actually
tested it with an application yet. And I'm sure some Solaris expert will be happy to
tell me all the backward ways I've done things here. But I hoped this might be useful
to some users and the Phusion team. Thank you.

@FooBarWidget
Copy link
Member Author

From harrisj.home on June 17, 2008 09:28:13

Okay, I've gotten in working on Solaris x86, but need help testing the patch on other
machines... http://groups.google.com/group/phusion-passenger/browse_thread/thread/d97540b42cd76dd7?hl=en#

@FooBarWidget
Copy link
Member Author

From alex.kiernan on September 10, 2008 06:27:27

I've just been trying to get passenger to work on Solaris 10 Sparc (using the code
from git), whilst it builds, it explodes with SIGBUS at run time. Changing things
around so it always uses the SOLARIS9 code for file descriptor passing fixes it
up. I think the reason the code works on Solaris 10 x86 is because x86 will allow
unaligned accesses to succeed, whereas they SIGBUS on Sparc.

Attachment: solaris-sparc.diff

@FooBarWidget
Copy link
Member Author

From honglilai on September 10, 2008 09:19:09

Thanks, I've applied the patch. Can anyone else confirm whether the problem is now
fixed? Can this issue be closed now?

@FooBarWidget
Copy link
Member Author

From honglilai on September 10, 2008 09:19:30

Thanks, I've applied the patch. Can anyone else confirm whether the problem is now
fixed? Can this issue be closed now?

@FooBarWidget
Copy link
Member Author

From steelfu on December 10, 2008 19:59:25

I've tried installing Passenger via 2.0.5 gem on Open Solaris on Joyent but failed with the same error. I did get it
to install via master tree on github.

@FooBarWidget
Copy link
Member Author

From honglilai on December 11, 2008 01:37:55

Status: Fixed
Labels: Milestone-2.1.0

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

No branches or pull requests

1 participant