On Mon, 26 May 2003 17:25:48 +0900, Yukihiro Matsumoto wrote:

> Hi,
> 
> In message "Problem compiling extension on Solaris"
>     on 03/05/26, "Tim Hunter" <cyclists / nc.rr.com> writes:
> 
> |I have an user who is trying to build RMagick on Solaris with Ruby
> |1.6.8. The Makefile is generated by extconf.rb. The link fails with
> |these messages:
> 
> Sorry, I have no clue.  We don't use -P nor -dn, at least explicitly. We
> need Solaris guru to solve this question.
> 
> 							matz.

Thanks, Matz. Sadly, this was reported to me by a Solaris guru. He
suggested that we ask a Ruby guru :-(

I misstated the Ruby release. This is Ruby 1.8.0preview2. I believe the -P
and -dn flags are being added by the Solaris gcc linker driver. (Note that
this is gcc 3.3.) The -dn option is for static linking only. The -G option
is for shared linking only. Is it possible that this is the result some
confusion between building static and shared modules?

For reference I am appending the entire Makefile.



SHELL = /bin/sh

#### Start of system configuration section. ####

srcdir = /home/bfriesen/src/lang/RMagick-1.2.2beta1/ext/RMagick
topdir = $(rubylibdir)/$(arch)
hdrdir = $(rubylibdir)/$(arch)
VPATH = $(srcdir)
prefix = $(DESTDIR)/usr/local
exec_prefix = $(prefix)
sitedir = $(prefix)/lib/ruby/site_ruby
rubylibdir = $(libdir)/ruby/$(ruby_version)
builddir = $(ac_builddir)
archdir = $(rubylibdir)/$(arch)
sbindir = $(exec_prefix)/sbin
compile_dir = $(DESTDIR)/home/bfriesen/src/lang/ruby-1.8.0
datadir = $(prefix)/share
includedir = $(prefix)/include
infodir = $(prefix)/info
top_builddir = $(ac_top_builddir)
sysconfdir = $(prefix)/etc
mandir = $(prefix)/man
libdir = $(exec_prefix)/lib
sharedstatedir = $(prefix)/com
oldincludedir = $(DESTDIR)/usr/include
sitearchdir = $(sitelibdir)/$(sitearch)
bindir = $(exec_prefix)/bin
localstatedir = $(prefix)/var
sitelibdir = $(sitedir)/$(ruby_version)
libexecdir = $(exec_prefix)/libexec

CC = gcc -V 3.3
LIBRUBY = $(LIBRUBY_A)
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
LIBRUBYARG_SHARED = 
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static

CFLAGS   = -fPIC -Wall -O2 -g -Wall -I/usr/local/include -I/usr/local/include/freetype2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT -I/usr/openwin/include -I/usr/openwin/include/X11 -I/usr/local/include/libxml2 -DRUBY_VERSION=0x180
CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)  
CXXFLAGS = $(CFLAGS) 
DLDFLAGS = -Wl,-rpath,/usr/local/lib -L/usr/local/lib -L/usr/local/lib -R/usr/local/lib -L/usr/openwin/lib -R/usr/openwin/lib -L/usr/local/lib -L/usr/local/lib  
LDSHARED = $(CC) -Wl,-G
AR = ar
EXEEXT = 

RUBY_INSTALL_NAME = ruby
RUBY_SO_NAME = $(RUBY_INSTALL_NAME)
arch = sparc-solaris2.9
sitearch = sparc-solaris2.9
ruby_version = 1.8
RUBY = ruby
RM = $(RUBY) -rftools -e "File::rm_f(*ARGV.map do|x|Dir[x]end.flatten.uniq)"
MAKEDIRS = $(RUBY) -r ftools -e 'File::makedirs(*ARGV)'
INSTALL_PROG = $(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0755, true)'
INSTALL_DATA = $(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0644, true)'

#### End of system configuration section. ####


LIBPATH =  -L"$(libdir)"
DEFFILE = 

CLEANFILES = 
DISTCLEANFILES = 

target_prefix = 
LOCAL_LIBS = 
LIBS =   -ldl -lcrypt -lm  -lMagick -ljbig -llcms -ltiff -lfreetype -ljasper -ljpeg -lpng -lfpx -lwmflite -ldpstk -ldps -lXext -lSM -lICE -lX11 -lsocket -lnsl -lbz2 -lxml2 -lz -lpthread -lm -lc
OBJS = rmfill.o rmilist.o rmimage.o rminfo.o rmmain.o rmutil.o
TARGET = RMagick
DLLIB = $(TARGET).so

RUBYCOMMONDIR = $(sitedir)$(target_prefix)
RUBYLIBDIR    = $(sitelibdir)$(target_prefix)
RUBYARCHDIR   = $(sitearchdir)$(target_prefix)

CLEANLIBS     = "$(TARGET).{lib,exp,il?,tds,map}" $(DLLIB)
CLEANOBJS     = "*.{o,a,s[ol],pdb,bak}"

all:		$(DLLIB)

clean:
		@$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)

distclean:	clean
		@$(RM) Makefile extconf.h conftest.* mkmf.log
		@$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)

realclean:	distclean
install: $(RUBYARCHDIR)
install: $(RUBYARCHDIR)/$(DLLIB)
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB) $(RUBYARCHDIR)
	@$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
$(RUBYARCHDIR):
	@$(MAKEDIRS) $(RUBYARCHDIR)

site-install: install

..SUFFIXES: .c .cc .m .cxx .cpp .C .o

..cc.o:
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<

..cpp.o:
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<

..cxx.o:
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<

..C.o:
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<

..c.o:
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<

$(DLLIB): $(OBJS)
	@-$(RM) $@
	$(LDSHARED) $(DLDFLAGS) $(LIBPATH) -o $(DLLIB) $(OBJS) $(LOCAL_LIBS) $(LIBS)