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

hints/solaris_2.sh guesses wrong ld (patch included) #962

Closed
p5pRT opened this issue Dec 16, 1999 · 2 comments
Closed

hints/solaris_2.sh guesses wrong ld (patch included) #962

p5pRT opened this issue Dec 16, 1999 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 16, 1999

Migrated from rt.perl.org#1909 (status was 'resolved')

Searchable as RT1909$

@p5pRT
Copy link
Author

p5pRT commented Dec 16, 1999

From ralston@pobox.com


The hints/solaris_2.sh file that comes with perl5.005_03 attempts to
determine whether the ld being used is the Solaris version or the GNU
version. It does this by compiling a test program with the "-v"
switch, and sorting through the output for a line of the form​:

/full/path/to/ld [arguments]

The exact test is​:

  myld=`echo $verbose| grep ld | awk '/\/ld/ {print $1}'`
  # This assumes that gcc's output will not change, and that
  # /full/path/to/ld will be the first word of the output.

These assumptions are now incorrect. As of at least gcc version
2.95.2 (and probably earlier versions), "gcc -v" does *not* show the
full command line used to invoke ld; the only output which appears is
the output from "ld -V" itself, which is of the form​:

  ld​: Software Generation Utilities - Solaris/ELF (3.0)

In the above command pipeline, the "awk" command returns nothing, so
$myld gets set to an empty string, which causes the if-then-else
conditional to take the wrong path​:

  if $myld -V 2>&1 | grep "ld​: Software Generation Utilities" >/dev/null 2>&1; then
  cat <<END >&2

  Aha. You're using egcs and /usr/ccs/bin/ld.

  END

  else
  cat <<END >&2

  NOTE​: You are using GNU ld(1). GNU ld(1) will not build Perl.
  I'm arranging to use /usr/ccs/bin/ld by including -B/usr/ccs/bin/
  in your ${cc​:-cc} command. (Note that the trailing "/" is required.)

  END
  cc="${cc​:-cc} -B/usr/ccs/bin/"
  fi

The end result is that when Configure is run, it erroneously detects
GNU ld, and adds "-B/usr/ccs/bin" to the arguments passed to the C
compiler. While the "-B/usr/ccs/bin" is probably harmless, detecting
GNU ld when GNU ld does not exist on the system is bogus, and should
be fixed.

The follow patch modifies the ld test as follows​: if /full/path/to/ld
was not found in the output of "gcc -v", instead look for the Solaris
"ld​: Software Generation Utilities" magic string directly in the
"gcc -v" output itself; if that string is found, assume that gcc
invokes /usr/ccs/bin/ld. If a /full/path/to/ld was found in the
output of "gcc -v", invoke /full/path/to/ld with -V, and again check
the output for the "ld​: Software Generation Utilities" string.

Regards,
James

--
James Ralston / Information Technology
Software Engineering Institute
Carnegie Mellon University / Pittsburgh PA USA

Inline Patch
diff -U 2 -r -N ORIG/perl5.005_03/hints/solaris_2.sh perl5.005_03/hints/solaris_2.sh
--- ORIG/perl5.005_03/hints/solaris_2.sh	Sun Jan 24 09:47:49 1999
+++ perl5.005_03/hints/solaris_2.sh	Thu Dec 16 18:22:42 1999
@@ -182,11 +182,23 @@
         # make it show its true colors.
 
+            # See if we can find a /full/path/to/ld as the first word
+            # of one of the output lines.
 	    myld=`echo $verbose| grep ld | awk '/\/ld/ {print $1}'`
-            # This assumes that gcc's output will not change, and that
-            # /full/path/to/ld will be the first word of the output.
 
-            # all Solaris versions of ld I've seen contain the magic
-            # string used in the grep below.
-            if $myld -V 2>&1 | grep "ld: Software Generation Utilities" >/dev/null 2>&1; then
+            # If $myld is now an empty string, we're using a version
+            # of gcc that doesn't output the full path to ld, so see
+            # if we can find the "ld: Software Generation Utilities"
+            # magic string in the output.  If we were able to find a
+            # /full/path/to/ld, run it and see what it produces; all
+            # Solaris versions of ld I've seen emit the "ld: Software
+            # Generation Utilities" string in their verbose output.
+            if [ ! "$myld" ] && echo $verbose | grep "ld: Software Generation Utilities" >/dev/null 2>&1; then
+                cat <<END >&2
+
+Aha. You're using egcs and /usr/ccs/bin/ld.
+
+END
+
+            elif $myld -V 2>&1 | grep "ld: Software Generation Utilities" >/dev/null 2>&1; then
                 cat <<END >&2
 

-----------------------------------------------------------------

---
Site configuration information for perl 5.00503:

Configured by root at Thu Dec 16 14​:21​:35 EST 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration​:
  Platform​:
  osname=solaris, osvers=2.6, archname=sun4-solaris
  uname='sunos x.x.x.x 5.6 generic_105181-16 sun4u sparc sunw,ultra-5_10 '
  hint=previous, useposix=true, d_sigaction=define
  usethreads=undef useperlio=undef d_sfio=undef
  Compiler​:
  cc='gcc', optimize='-O2', gccversion=2.95.2 19991024 (release)
  cppflags=''
  ccflags =''
  stdchar='unsigned char', d_stdstdio=define, usevfork=false
  intsize=4, longsize=4, ptrsize=4, doublesize=8
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries​:
  ld='ld', ldflags =''
  libpth=/usr/lib /usr/ccs/lib
  libs=-ldb -ldl -lcrypt -lm -lsocket -lnsl
  libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so.5
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -R /usr/lib/perl5/sun4-solaris/CORE'
  cccdlflags='-fPIC', lddlflags='-G -z text -h libperl.so.5'

Locally applied patches​:
 


@​INC for perl 5.00503​:
  /usr/lib/perl5/sun4-solaris
  /usr/lib/perl5
  /usr/lib/perl/sun4-solaris
  /usr/lib/perl
  .


Environment for perl 5.00503​:
  HOME=/home/ralston
  LANG (unset)
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/usr/site/bin​:/usr/bin​:/usr/proc/bin​:/usr/ccs/bin​:/usr/ucb​:/usr/afsws/bin​:/usr/openwin/bin​:/usr/local/bin​:/usr/sbin​:/usr/afsws/etc​:/sbin
  PERL_BADLANG (unset)
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Dec 17, 1999

From @gsar

On Thu, 16 Dec 1999 18​:41​:06 EST, James Ralston wrote​:

The hints/solaris_2.sh file that comes with perl5.005_03 attempts to
determine whether the ld being used is the Solaris version or the GNU
version. It does this by compiling a test program with the "-v"
switch, and sorting through the output for a line of the form​:

/full/path/to/ld [arguments]

The exact test is​:

myld=`echo $verbose| grep ld | awk '/\/ld/ {print $1}'`
# This assumes that gcc's output will not change, and that
# /full/path/to/ld will be the first word of the output.

These assumptions are now incorrect. As of at least gcc version
2.95.2 (and probably earlier versions), "gcc -v" does *not* show the
full command line used to invoke ld; the only output which appears is
the output from "ld -V" itself, which is of the form​:

ld​: Software Generation Utilities - Solaris/ELF (3.0)

This should be fixed in the development versions. Please try
5.005_63 and let us know how it fares.

Sarathy
gsar@​ActiveState.com

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

No branches or pull requests

1 participant