Home
The Toolkit for Online Communities
17719 Community Members, 0 members online, 2162 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Q&A : openFTS install on OS X?

Forum OpenACS Q&A: openFTS install on OS X?

Icon of envelope Request notifications

Collapse
Posted by Stan Kaufman on
Has anyone managed to get openFTS to compile on OS X? I've got OpenACS 4.6.3 running with PG 7.3.4 on my new G4 PB (I've got mirrors of my 3.2.5 sites running with PG 7.3.4 for that matter), but I'm getting a weird compile error trying to get OpenFTS going.

Here's the output from make:

macteggert:/usr/local/src/Search-OpenFTS-tcl-0.3.2$ sudo make
(cd parser; make all)
cc -c -I. -fPIC -I../include -DPACKAGE=\"OPENFTS\" -DVERSION=\"0.3.2\" -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_STRERROR=1 -DHAVE_STRSTR=1 -DHAVE_STRLEN=1  Parser.c -o Parser.o
cc -c -I. -fPIC -I../include -DPACKAGE=\"OPENFTS\" -DVERSION=\"0.3.2\" -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_STRERROR=1 -DHAVE_STRSTR=1 -DHAVE_STRLEN=1  deflex.c -o deflex.o
flex -8 -Pfts_yy -oflexparser.c flexparser.l
cc -c -I. -fPIC -I../include -DPACKAGE=\"OPENFTS\" -DVERSION=\"0.3.2\" -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_STRERROR=1 -DHAVE_STRSTR=1 -DHAVE_STRLEN=1  flexparser.c -o flexparser.o
cc -o Parser.so -shared Parser.o deflex.o flexparser.o 
cc: unrecognized option `-shared'
ld: Undefined symbols:
_main
_Tcl_AppendElement
_Tcl_AppendResult
_Tcl_CreateObjCommand
_Tcl_GetIntFromObj
_Tcl_GetStringFromObj
_Tcl_NewIntObj
_Tcl_NewStringObj
_Tcl_ObjSetVar2
_Tcl_PkgProvide
_Tcl_SetObjResult
make[1]: *** [Parser.so] Error 1
make: *** [parser] Error 2

So it seems to be choking on a "-shared" option to cc, which makes sense, since OS X doesn't support static shared libraries. The bizarre thing is where this option is creeping in, since I've edited the configure file and as far as I can see, the LDSO flag is correct. Here's the relevant part:

#  The Mac OS X Server cc is gcc; the Mac OS X Server make is gmake.
#  Tested under releases 1.0 and 1.02.
#  No SMP support as of this writing.
#
if test `uname` = "Darwin"; then
    PLATFORM="osx"
    CC="cc"
    LD="cc"
    CFLAGS="$CFLAGS -dynamic -traditional-cpp -pipe -Wall -Wno-unused"
    LDSO="$LD -bundle -undefined suppress -flat_namespace"
    RANLIB="ranlib"
    CFLAGS="$CFLAGS -DUSE_CTHREADS=1 -DHAVE_CMMSG=1 -DUSE_DYLD -DUSE_DLSYMPREFIX=1"
    CFLAGS="$CFLAGS -DNO_RAND48=1 -DNO_TIMEZONE=1"
fi

Elsewhere for other platforms, LDSO = "$LD -shared etc etc" but I've got it right here. (I also added the -flat_namespace flag since that's important in compiling AOLserver on OS X, but didn't seem to make any difference here.)

Running ./configure appears to work right; here's the output:

macteggert:/usr/local/src/Search-OpenFTS-tcl-0.3.2$ sudo ./configure --with-aolserver-src=/usr/local/src/aolserver/aolserver --with-tcl=/System/Library/Tcl/8.3
Password:
checking prefix... /usr/local
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for executable suffix... 
checking for object suffix... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking for unistd.h... yes
checking for gcc option to accept ANSI C... none needed
checking for an ANSI C-conforming const... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... (cached) yes
checking for size_t... yes
checking for ANSI C header files... (cached) yes
checking for strerror... yes
checking for strstr... yes
checking for strlen... yes
checking for poll... no
checking platform specific compile options... osx
checking looking for aolserver ns.h include file... /usr/local/src/aolserver/aolserver/include/ns.h
checking looking for aolserver nsd.h include file... /usr/local/src/aolserver/aolserver/nsd/nsd.h
checking for Tcl configuration... found /System/Library/Tcl/8.3/tclConfig.sh
checking for existence of /System/Library/Tcl/8.3/tclConfig.sh... loading
checking for tclsh... /usr/bin/tclsh8.3

        OPENFTS version 0.3.2 configured successfully.

Using c-compiler:       cc
Tcl Version:            8.3
Tcl package directory:  /usr/lib/tcl8.3
Tcl Shell:              /usr/bin/tclsh8.3
Aolserver include:     /usr/local/src/aolserver/aolserver/include
Aolserver nsd include: /usr/local/src/aolserver/aolserver/nsd

configure: creating ./config.status
config.status: creating Makefile.global

To confirm that ./configure has correctly detected OS X, here's a snippet from config.log:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.52.  Invocation command line was

  $ ./configure --with-aolserver-src=/usr/local/src/aolserver/aolserver --with-tcl=/System/Library/Tcl/8.3

## ---------- ##
## Platform.  ##
## ---------- ##

hostname = macteggert.local.
uname -m = Power Macintosh
uname -r = 6.8
uname -s = Darwin
uname -v = Darwin Kernel Version 6.8: Wed Sep 10 15:20:55 PDT 2003; root:xnu/xnu-344.49.obj~2/RELEASE_PPC

/usr/bin/uname -p = powerpc

Clearly openFTS is supposed to compile on OS X, but bizarrely, I found LDSO = cc -shared hardcoded into the Makefiles in several subdirectories in the openFTS root: in aolserver/ dict/ and parser/. I've manually deleted the "-shared" bit in each Makefile but still get the same "cc: unrecognized option `-shared'" error when running make on the whole package.

So where the heck is the "-shared" option getting in here??

One other possible clue: in the tcl.m4 file, there is a complex switch based on the detected platform, but there's no case for OS X. Makes me wonder if in fact this package isn't ready for OS X.

Does anyone see the problem here? Has anyone actually got OpenFTS to run with OS X? Thanks!

(BTW FWIW, I'm writing up details of my experience installing on OS X and will put it into the new-file-storage here once I'm done in case anyone is interested.)

Collapse
Posted by Mark Aufflick on
Hi Stan,

the snippet from your configure.log just shows the output from the uname program, it doesn't indicate that it ubderstands what that means.

MacOS X uses a more advanced (and slightly quirlky) mach style of dynamicly loaded libraries that is different to most of the gnu world.

If you want to have a go at porting it yourself you will need to know about the two types of dynamically loadable code in OSX - check out the fink porting tips page for a somewhat brief introduction:

http://fink.sourceforge.net/doc/porting/index.php

Collapse
3: Sharing Your Pain (response to 1)
Posted by Carl Coryell-Martin on
Hi Stan,

I spent 1.5 hours on friday afternoon struggling with this same problem before giving up and deciding to wait till monday when I could post to the forums to work on this problem.

Thanks for posting this and let me know if you work this out.

OpenFTS on osX is a nice-to-have for me right now, so I am likely to put it off until it is a have-to-have.

Best,

carl
ps written experiences installing on new platforms are always appreciated.

Collapse
Posted by Stan Kaufman on
Thx for the responses. I'm on the road right now and can't do a lot more for a couple more days, but on the plane today I managed to get nsfts.so to compile. The solution appears to be that you have to add the flags

-bundle -undefined suppress -flat_namespace

to the LD definitions in the Makefiles in all the subdirectories in the source tree as well as remove the -shared flag in the same locations.

So, ../parser/Makefile should have this line:

LDSO = $(CC) -bundle -undefined suppress -flat_namespace -o $(PARSERLIB)

and so should these:

../dict/Makefile
../dict/snowball/Makefile
../aolserver/Makefile

The reason I got the complaint about the undefined option -shared was because I missed one use of it in ../dict/snowball/Makefile. Anyway, once those changes were made, the compile finished.

I haven't finished out compiling and installing the rest of the modules, nor have I tested whether it all is going to work in OpenACS. But I'm pretty confident that this is probably going to work.

Once I'm sure that it does, I'll create a patch for the OpenFTS tarball that makes all these changes and post it to new-file-storage. It's not really a bug, so I can't see putting this in bugtracker.

Carl (and Svet), I'd be glad to collaborate on the install doc. I've actually got a rather lengthy draft already done. Unfortunately I'm not going to have much time until Thursday to get back to it.

Collapse
Posted by Stan Kaufman on
Oops, the other files shouldn't include the PARSERLIB bit; that's only for compiling the parser piece of it. But the idea is to stick the other flags before whatever the target object is in the LD definition....
Collapse
Posted by Carl Coryell-Martin on
Thanks for doing the legwork on this, I look forward to trying it out.

-carl

Collapse
Posted by Stan Kaufman on
I posted Yet Another OS X Install Doc here: http://sdm.openacs.org/new-file-storage/one-file.tcl?file_id=485

OpenFTS and the rest of 4.6.3 seem to work OK; I'll try with HEAD once the dust there settles a bit more.

Collapse
Posted by bill kellerman on
Thanks for writing this up Stan.