Forum OpenACS Q&A: Re: Problem compiling Aolserver 4.5 with tcl 8.5.5

Collapse
Posted by Gustaf Neumann on
LDLIB is not an environment variable, but a configuration variable managed by configure and autoconf.

The quick fix for your problem is to edit aolserver/include/ns.mak and add -nostartfiles to the options in the line with LDLIB (after configure). The real fix is to figure out, why this flag is not added automatically by configure in your environment.

Collapse
Posted by Richard Hamilton on
Gustav,

Thank you very much. Whilst I am very happy thrashing around the OpenACS code, delving into makefiles is hazy new territory for me at the moment!

When I said that installing tcl in /usr/local/aolserver45/lib had worked for me what I meant was that the tcl compiled fine and I could run tclsh8.5 and run ./nsconfig.tcl using it.

However the Aolserver compilation failed.

I will try poking about in the makefile and if I can't sort it out I will try upgrading to tcl 8.4.19 and compiling Aolserver 4.0.latest.

R.

Collapse
Posted by Richard Hamilton on
Gustav,

You say to edit nsmak.in rather than configure.in. Is this because configure.in calls nsmak.in or because I should be using nsconfig.tcl and nsconfig.tcl calls nsmak.in?

If configure.in calls nsmak.in then why does the section that should add -nostartfiles files occur in both?

R.

Collapse
Posted by Richard Hamilton on
The relevant section in configure.in occurs in a "case" statement and is conditional upon the system being "darwin". I am probably misreading the case statement but this looks a bit strange to me. I can't figure out what the *) is doing there. I will continue working on nsmak.in as you suggest.
#
# TCL_SHLIB_LD from tclConfig.sh is not quite right for aolserver.
#

test "x$prefix" = "xNONE" && prefix="/usr/local/aolserver"
system=`uname`
case "$system" in
    Darwin)
	LDLIB="\$(CC) -dynamiclib -install_name \$(INSTLIB)/\$(DLLBIN)"
	LDSO="\$(CC) -bundle"
	CCRFLAG=
	LDRFLAG=
	CCRPATHS=
	LDRPATHS=
	;;
    *)
	LDLIB="$TCL_SHLIB_LD"
	case "$LDLIB" in
	    *gcc*)
		LDLIB="$LDLIB -nostartfiles"
		;;
	    *shared*)
		LDLIB="$LDLIB -nostartfiles"
		;;
	esac
	CCRPATH="\$(CCRFLAG)\$(INSTLIB)"
	LDRPATH="\$(LDRFLAG)\$(INSTLIB)"
	if test "$TCL_EXEC_PREFIX" != "$prefix"
	then
		CCRPATH="$CCRPATH \$(CCRFLAG)\$(TCL_EXEC_PREFIX)/lib"
		LDRPATH="$LDRPATH \$(LDRFLAG)\$(TCL_EXEC_PREFIX)/lib"
	fi
	if test -d /usr/lib/lwp
	then
		CCRPATH="$CCRPATH \$(CCRFLAG)/usr/lib/lwp"
		LDRPATH="$LDRPATH \$(LDRFLAG)/usr/lib/lwp"
	fi
	LDSO="\$(LDLIB)"
	CCRPATHS="\$(CCRPATH)"
	LDRPATHS="\$(LDRPATH)"
	CCRFLAG=$TCL_CC_SEARCH_FLAGS
	LDRFLAG=$TCL_LD_SEARCH_FLAGS
        if test "$CCRFLAG" = "" ; then
            CCRPATH=
        fi
        if test "$LDRFLAG" = "" ; then
            LDRPATH=
        fi
	;;
esac
Collapse
Posted by Richard Hamilton on
The only bit I can find in nsmak.in is:

# Add dynamic library entry point flags.
ifdef DLLINIT
ifneq (,$(findstring Darwin,$(uname)))
INIT = _$(DLLINIT)
LDLIB += -init _$(INIT)
else
INIT = _init
endif
endif

Collapse
Posted by Gustaf Neumann on
no, i did not say to edit nsmak.in, i sayed edit aolserver/include/ns.mak ... if you primary goal is the get a compiled aolserver.
Collapse
Posted by Gustaf Neumann on
If the goal is to get configure work correctly, configure.in is the right place to fix, or at least to figure out, why the configurations goes wrong.

But you are misreading the code. The first case branch is for "Darwin", all other systems ("*") use the 2nd branch. That's why i asked you in http://www.openacs.org/forums/message-view?message_id=2376173, what the value of LDLIB on your system is.

Collapse
Posted by Richard Hamilton on
Ah! Thank you Gustaf. So that is what the mysterious *) was all about! :-)

I do want to achieve a successful compilation, but I would like to solve the problem properly so that the fix will be documented here.

To find out the value of LDLIB I will add an echo statement to configure.in and run it (unless there's a better way). I now understand what you meant about 'after configure' because ns.mak is created by the configure script. I had not realised initially.

(By the way, I have just realised that I have been mis-spelling your name - I am very sorry, how rude of me.

Regards and thanks
Richard

Collapse
Posted by Richard Hamilton on
Here is the relevant section from ns.mak following the execution of nsconfig.tcl as follows:

# pwd
/usr/local/src/aolserver45r0/aolserver

# /usr/local/aolserver45r0/bin/tclsh8.4 nsconfig.tcl

...
#
# Install directories.
#

AOLSERVER	= /usr/local/aolserver45r0
TCLSH		= /usr/local/aolserver45r0/bin/tclsh8.4
INSTBIN		= $(AOLSERVER)/bin
INSTLIB		= $(AOLSERVER)/lib
INSTINC		= $(AOLSERVER)/include
INSTTCL         = $(AOLSERVER)/modules/tcl
INSTSRV         = $(AOLSERVER)/servers/server1
INSTSRVMOD      = $(INSTSRV)/modules
INSTSRVPAG      = $(INSTSRV)/pages
SH		= /bin/sh

#
# Compiler and linker options.
#

LIBEXT		= .so
LDLIB		= ${CC} -shared ${CFLAGS} ${LDFLAGS} -nostartfiles
LDSO		= $(LDLIB)
CCRFLAG         = -Wl,-rpath,${LIB_RUNTIME_DIR}
LDRFLAG         = -Wl,-rpath,${LIB_RUNTIME_DIR}
CCRPATH         += $(CCRFLAG)$(INSTLIB)
LDRPATH         += $(LDRFLAG)$(INSTLIB)
CC		= $(PURIFY) gcc

I note the following:

  1. The LDLIB assignment DOES in fact have "-nostartfiles" at the end after all.
  2. that CC is defined after LDLIB and that its value is $(PURIFY) gcc
  3. There is no other reference to PURIFY anywhere else in ns.mak
Could the problem be because PURIFY returns no value? What is it supposed to do? R.
Collapse
Posted by Richard Hamilton on
Aha! Fantastic. Aolserver appears to have compiled this time. The only thing I did differently this time was to install vtmalloc which previously I had decided not to do. I had problems with the Google Perftools malloc a few months ago and had not realised that vtmalloc is a tcl specific memory allocator.

Could this be the reason or has it just been one of those strange things where I must have done something in a different order or something?

Collapse
Posted by Richard Hamilton on
Thank you so very much for your help. Aolserver 4.5.0 is now up and running and serving the default page with tcl 8.4.19, vtmalloc and all the other bells and whistles. Fantastic!

Now all I have to do is figure out the differences in the config.tcl file between 4.0.x and 4.5.x

R.