Tcl Source Code

View Ticket
Login
Ticket UUID: ed982d0ec0dd95311df3e00bca079174006fc82
Title: Failed tclsh link on AIX.
Type: Support Version: tcl8.6.3
Submitter: anonymous Created on: 2015-02-08 05:00:49
Subsystem: 53. Configuration and Build Tools Assigned To: stwo
Priority: 5 Medium Severity: Important
Status: Open Last Modified: 2016-09-01 16:11:24
Resolution: None Closed By: nobody
    Closed on:
Description:
Really need some assistance.... Novice with Makefile, configure, ld etc.
Tried over 10 times to build tcl.  It always ends:

# pwd    
/home/surfer/DownLoadLFNs/HTML/NEWS/BuildFirefox/tcl8.6.3/unix
# ls -la libtcl*
-rwxr-xr-x    1 surfer   Internet    2773523 Feb 07 20:05 libtcl8.6.so
-rw-r--r--    1 surfer   Internet       6105 Feb 07 20:03 libtclstub8.6.a
# make
        gcc -DNDEBUG -O2  -pipe     tclAppInit.o  -L/home/surfer/DownLoadLFNs/HTML/NEWS/BuildFirefox/tcl8.6.3/unix -ltcl8.6 libtc
lstub8.6.a -ldl -lz  -lpthread -lc -lm   -L/opt/alinux/lib -o tclsh
ld: 0706-006 Cannot find or open library file: -l tcl8.6
        ld:open(): A file or directory in the path name does not exist.
collect2: error: ld returned 255 exit status
make: 1254-004 The error code from the last command is 1.


I do not know how to tell the loader where the library or file it is looking for is located.  Assuming that it is looking for libtcl8.6.so or libtclstub8.6.a.


Configuration:
IBM pSeries system running AIX 7.1
I have use GNU make and AIX make
Only used AIX ld
m4 seems to always go to AIX m4
I do have a linux version of m4 in /opt/freeware/bin/m4
configure run so that install will be into /opt/alinux
User Comments: dkf added on 2015-03-17 11:36:27:

It looks like the linker that's being used doesn't know how to link with the sort of shared libraries that are being produced, or at least that it expects different shared lib suffixes to the conventional .so and this is something I could definitely believe. Now, I don't know AIX at all, but googling indicates that the linker might need the -brtl flag passing to it. I can't vouch for the accuracy of that site, and getting it through the gcc frontend will require it to be written as -Wl,-brtl, but maybe it will help?

Or maybe I'm dead wrong! I don't know AIX or have access to it at all.


dgp added on 2015-02-27 12:52:26:
Seeking other opinions on this.

anonymous added on 2015-02-27 02:12:23:
I have not tried to build tcl/tk with out setting LD equal to ld.
I have never set LD=gcc.  As far as I know gcc calls ld to do any kind 
of linking.  I do not have the GNU ld installed on my system.  I only
have IBM ld installed on my system.

The problem that I experience was that either configure/gmake was
causing an incorrect -L and -l specification to be generated.
From the information I got by reading the man pages for ld
-L is used to specify a directory where libraries and .so files
can be found.  The -l specifies a name of a particular library.

During the gmake run a -l specification is being used to define
a .so file and not a library.  Thus when ld tried to find the 
library it is unable to do so and is thus unable to complete the
link operation.

All I did was to change the command to put the correct library
name in the -l specification and to add the correct .so file to the
command.
That is; I changed -ltcl8.6 to -ltclstub8.6
and libtclstub8.6.a to libtcl8.6.so.
(If tclstub8.6 should really be tcl8.6 then there are other
problem in the configure/gmake output.)

The correction to the tk gmake run is the same except that
the tk gmake also requires that the correct tcl changes also
be added to the command.

Bye,
Dwight

dgp added on 2015-02-25 17:48:10:
Thanks for the transcript.

I don't have an AIX box myself to try reproduction on,
so I'm pretty much just tossing out a guess.

I see that you have

$ LD=ld

Have you tried a build where you leave LD undefined?

Or a build where you set

$ LD=gcc

?

Apologies if these are dumb suggestions.

The evidence points to your link step not knowing
how to properly interpret an argument like -ltcl8.6

Thanks for testing and reporting what you can.

dgp added on 2015-02-12 18:53:53:
Can you please report the sequence you originally used
to attempt to build Tcl, etc. that failed?  That is, any command
line options given to configure, etc.  Also what build directory
you were working in.

For that matter, a simple transcript of your failing session might
be the most reliable way to transmit to us all the information that
might be relevant.  That might get large, so either an attachment
or a link to a pastebin might be best.  Thanks.

anonymous (claiming to be Anonymous - Dwight) added on 2015-02-12 03:55:05:
Hi,
  Since I do not know how to modify Makefiles or configure files, I
just modified the source code file or the make command resulting from the
Makefile.
  Some one that know what configure is doing to create the Makefile
will have to look at what I did to the command to
figure out how to fix the configure file to solve the problem.

  What I did appears below.

***********************
*    tcl make error   *
***********************
####Problem when doing a "make"

gcc -DNDEBUG -O2  -pipe     tclAppInit.o \
        -L/home/surfer/DownLoadLFNs/HTML/NEWS/BuildFirefox/tcl8.6.3/unix -ltcl8.6 libtclstub8.6.a -ldl -lz  -lpthread -lc -lm  \
        -L/usr/local/lib -o tclsh
ld: 0706-006 Cannot find or open library file: -l tcl8.6
        ld:open(): A file or directory in the path name does not exist.
collect2: error: ld returned 255 exit status
Makefile:647: recipe for target 'tclsh' failed
gmake: *** [tclsh] Error 1


BAD make command:
gcc -DNDEBUG -O2  -pipe     tclAppInit.o \
-L/home/surfer/DownLoadLFNs/HTML/NEWS/BuildFirefox/tcl8.6.3/unix -ltcl8.6 libtclstub8.6.a -ldl -lz  -lpthread -lc -lm  \
-L/usr/local/lib -o tclsh

GOOD make command:
gcc -DNDEBUG -O2  -pipe     tclAppInit.o \
-L/home/surfer/DownLoadLFNs/HTML/NEWS/BuildFirefox/tcl8.6.3/unix -ltclstub8.6 libtcl8.6.so  -ldl -lz  -lpthread -lc -lm  \
-L/usr/local/lib -o tclsh

####Same kind of problem when doing a "make test"

***********************
*    tk make error    *
***********************
Must fix the include <tcl.h> in the following files:
(Change tcl.h to /opt/alinux/include/tcl.h)
        generic/tk.h
        generic/tkIntXlibDecls.h
        generic/ttk/ttkElements.c
        generic/ttk/ttkLabel.c
        generic/ttk/ttkTagSet.c

####Problem when doing a "make"
BAD:
gcc -O2  -pipe     tkAppInit.o -L/home/surfer/DownLoadLFNs/HTML/NEWS/BuildFirefox/tk8.6.3/unix -ltk8.6 \
-L/opt/alinux/lib -ltcl8.6  -lpthread -lc  -lX11 -lXext -ldl -lz  -lpthread -lc -lm  -L/opt/alinux/lib -o wish
Good:
gcc -O2  -pipe     tkAppInit.o -L/home/surfer/DownLoadLFNs/HTML/NEWS/BuildFirefox/tk8.6.3/unix -ltkstub8.6 libtk8.6.so \
-L/opt/alinux/lib -ltclstub8.6 /opt/alinux/lib/libtcl8.6.so \
-lpthread -lc  -lX11 -lXext -ldl -lz  -lpthread -lc -lm  -L/opt/alinux/lib -o wish

####Same kind of problem when doing a "make test"
BAD:
gcc -O2  -pipe     tkTestInit.o tkTest.o tkSquare.o tkOldTest.o  libtkstub8.6.a -L/opt/alinux/lib -ltclstub8.6 \
-L/home/surfer/DownLoadLFNs/HTML/NEWS/BuildFirefox/tk8.6.3/unix -ltk8.6 \
-L/opt/alinux/lib -ltcl8.6  -lpthread -lc  -lX11 -lXext -ldl -lz  -lpthread -lc -lm 
-L/home/surfer/DownLoadLFNs/HTML/NEWS/BuildFirefox/tk8.6.3/unix:/opt/alinux/lib -o tktest
Good:
gcc -O2  -pipe     tkTestInit.o tkTest.o tkSquare.o tkOldTest.o  libtk8.6.so -L/opt/alinux/lib -ltclstub8.6 \
-L/home/surfer/DownLoadLFNs/HTML/NEWS/BuildFirefox/tk8.6.3/unix -ltkstub8.6 \
-L/opt/alinux/lib -ltclstub8.6 /opt/alinux/lib/libtcl8.6.so  -lpthread -lc  -lX11 -lXext -ldl -lz  -lpthread -lc -lm  \
-L/home/surfer/DownLoadLFNs/HTML/NEWS/BuildFirefox/tk8.6.3/unix:/opt/alinux/lib -o tktest

dgp added on 2015-02-11 03:40:18:
If you could record here the edits you needed to make
to the Makefile to make things work, then there's a chance
we could make fixes to configure so that it stops getting
it wrong.  Thanks for whatever you can offer.

anonymous added on 2015-02-11 01:58:16:
Hope I am responding correctly this time.
I do not have the IBM c compiler.
I have used gcc for many years and have never had a problem with gcc.
What I was trying to report via my last comment was that after reading the
"ld" man page a number of times I think I figured out what was wrong.

First I should explain that I am not a software developer and definitely
not a knowledgeable person when it comes to make or configure.
All I know is that configure creates the Makefile that make used to
build the distribution.

What I found when I ran make (gmake) was that the command it was trying to 
execute seems to be a call to ld; but the parameters that were being passed 
had an error in it. The -L correctly pointed to the build directory; but 
the -l had the wrong library name in it.  I believe the name used in the
-l was the shared object.  And the addition file specified was the shared
library.  In any case.  When I made this substitution it corrected the 
problem and then I could run make to it conclusion.
I assume things worked OK because when I did make test all test
ran to completion with out any errors.

When I tried to compile tk I encountered the same problem I had when compiling
tcl; but with the added problem that the tk makes use of the tcl share library and object.
I also encountered a problem with and include <tcl.h> statement in the files
I mentioned in my previous update.  Not sure just what configure was supposed
to do about adjusting the include to point to the correct tcl.h file; but it
did not make any changes and thus the make run tried to use the tcl.h that 
was in /usr/include..  I forget; but I did tell configure where the tcl that
I wanted to use was located.  Some how this information was not reflected
in the make (Makefile) run.  Once I change each of the files that contained
the include <tcl.h> statement to include </opt/alinux/include/tcl.h> the
make ran to completion without further problems.

The problems I encountered do not seem to be gcc or ld problems.  They
seem to be problems resulting from a problem in the configure run or
maybe the source code files.  As far as I can tell gcc and ld did exactly
what they were instructed to do.  Thus the error.

As to my other problem.
Sorry to say I did not read the README file fully.  However; when I did
I noticed that there was a comment that said that some of the test might
fail because they were no longer valid.  Since all the test that were
run except for one ran successfully I am going to assume that the one that
failed is no longer valid. (I forget the name of the test...something
with box in it I believe.  I am currently on a different AIX server.)

If I have any more problems I will post another message asking for help.
You may mark this ticked closed or if you want any addition information
ask and I will try to provide the requested information.

Thanks for responding!
Bye,
Dwight

dgp added on 2015-02-10 17:02:35:
This is not an answer, but a bit of shared experience.

Whenever I've needed to build Tcl on one these "Big Iron"
unix systems (Solaris, IRIX, AIX, HPUX,...), I have found
gcc to be completely unreliable.  I've always had to fall
back to whatever compiler and toolchain the OS maker
provides/sells to compile C code.

Now, I haven't tried to do anything like this in many many
years.  If you regularly have success building with gcc
on your AIX system, and it's only Tcl that's failing, then
you may be right that Tcl's build system needs tweaking
to cover the case.

But if this is a rare building event on this system for you as
well, I think I'd avoid bashing my head on this particular
brick wall and shift over to whatever AIX uses for its "cc".

Other are welcome to register their disagreement.

Attachments: