develooper Front page | perl.perl5.porters | Postings from January 2004

patch for IRIX/gcc link issues

Thread Next
Martin Pool
January 29, 2004 02:51
patch for IRIX/gcc link issues
Message ID:
I have been helping a friend build Perl 5.8.3 on IRIX 6.5 using gcc.

We configured with ./Configure -Dcc=gcc -d

It fails when trying to build shared libraries in ext/B/C with

  LD_RUN_PATH="" gcc  -mabi=64 -L/usr/lib64 -L/usr/local/lib C.o  -o ../../../lib/auto/B/C/
  ld64: ERROR 33: Unresolved text symbol "main" -- 1st referenced by /usr/lib64/mips3/crt1.o.
  Use linker option -v to see when and which objects, archives and dsos are loaded.

I thought this indicated the linker was trying to produce a program
rather than a library.  I think the solution is to get a -shared
argument onto the gcc command line to build shared libraries.

Here is my attempt at a patch.  I don't know if this is the most
perlish way to do it, but hopefully the general idea can get in.

--- hints/	Tue Jan 27 19:32:36 2004
+++ hints/	Tue Jan 27 19:34:39 2004
@@ -26,6 +26,8 @@
 # 64-bitty by Jarkko Hietaniemi on 9/1998
+# Martin Pool added -shared for gcc on 2004-01-27
 # Use   sh Configure -Dcc='cc -n32' to try compiling with -n32.
 #     or -Dcc='cc -n32 -mips3' (or -mips4) to force (non)portability
 # Don't bother with -n32 unless you have the 7.1 or later compilers.
@@ -173,6 +175,9 @@
 	ccflags="$ccflags -D_BSD_TYPES -D_BSD_TIME"
        test -z "$optimize" && optimize="-O3"
+	# It seems gcc can build Irix shlibs, but of course it needs
+	# -shared.  Otherwise you get link errors looking for main().
+	lddlflags="$lddlflags -shared"
 	case "`uname -s`" in
 	# Without the -mabi=64 gcc in 64-bit IRIX has problems passing
 	# and returning small structures.  This affects inet_*() and semctl().


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About