Freitag, 28. August 2009

Running CouchDB on Mac OS X 10.3.9 "Panther"



CouchDB really kicked me.

http://couchdb.apache.org/

I felt the urge to install and play with it.
My system is a 5-year old Mac running Mac OS X 10.3.9 ("Panther") and I'm pretty happy with it.

Unfortunately, Jan Lehnardt's one-click CouchDB package for the Mac requires Intel-based Macs running Mac OS X 10.5 Leopard or newer.
http://janl.github.com/couchdbx/

After 3 days of trying and learning I did it: CouchDB 0.9 runs on my 10.3.9 system.

Here I like to share my installation notes with you.



Requirements
  • Xcode 1.5, Apples development environment as it includes libraries and tools like "gcc" and "make". Download Xcode 1.5 from Apple Developer Connection (later versions of Xcode do not work with Mac OS X 10.3.9)

  • MacPorts, as it provides an infrastructure for building, installing, and packaging open source software. It is designed to match the functionality of the FreeBSD Ports system.
    www.macports.org


Begin the Installation

sudo port install couchdb

MacPorts will download the CouchDB dependencies (ports) and try to compile them.
With various ports you will encounter this error:



illegal reference to symbol: ___cmpdi2

ld: /usr/lib/gcc/darwin/3.3/libgcc.a(_fixunssfdi.o) illegal reference to symbol: ___cmpdi2 defined in indirectly referenced dynamic library /usr/lib/libgcc_s.1.dylib


smpeg

in Makefile:
LIBS = -L/opt/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -Wl,/usr/lib/libgcc_s.1.dylib


libsdl_mixer

in Makefile:
SDL_LIBS = -L/opt/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -Wl,/usr/lib/libgcc_s.1.dylib

EXTRA_LDFLAGS = -L/opt/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -Wl,-framework,QuickTime -Wl,-framework,CoreServices -Wl,/usr/lib/libgcc_s.1.dylib


Beide notwendig (zuerst SDL_LIBS probiert, dann EXTRA_LDFLAGS hinzugefügt)?



wxWidgets

in build/Makefile:
LIBS (ohne -Wl, mit -Wl,)
EXTRALIBS (ohne -Wl, mit -Wl,)
EXTRALIBS_SDL (mit -Wl,)
LDFLAGS (ohne -Wl, mit -Wl,)
...
in build/utils/wxrc/Makefile:
LIBS (ohne -Wl)
EXTRALIBS (ohne -Wl)
...

in build/contrib/src/fl/Makefile:
LIBS (mit -Wl)
EXTRALIBS (mit -Wl)
EXTRALIBS_GUI (mit -Wl)
in build/contrib/src/gizmos/Makefile:
LIBS (ohne -Wl)
EXTRALIBS (ohne -Wl)
in build/contrib/src/plot/Makefile:
LIBS (ohne -Wl)
in build/contrib/src/ogl/Makefile:
LIBS (ohne -Wl)
in build/contrib/src/stc/Makefile:
LIBS (ohne -Wl)
in build/contrib/src/svg/Makefile:
LIBS (ohne -Wl)



erlang


Problem bei configure: "Kernel Poll was requested but is not supported" (o.ä.)

=> Lösung: Portfile editieren:

/opt/local/var/macports/sources/rsync.macports.org/release/ports/lang/erlang/Portfile

configure.args --prefix=${destroot}${prefix} \
--enable-kernel-poll \ # <= Zeile rausnehmen --enable-threads \ ...


Problem beim Compilieren: cc1plus: out of memory

*** malloc: vm_allocate(size=1972441088) failed (error code=3)
*** malloc[2741]: error: Can't allocate region

cc1plus: out of memory allocating 1972437344 bytes after a total of 0 bytes

=> Lösung: Beim Compileraufruf -O2 wegnehmen.

Entweder durch Compilieren außerhalb von MacPorts oder durch Setzen
von configure.optflags (im Portfile?) auf einen leeren Wert.

Hintergrund: Optimierung braucht viel Speicherplatz. Bei großen Funktionen sehr viel.
Möglicherweise ist auch ein Bug in cc1plus enthalten (als Bestandteil von GCC 3.3).

Weiterhin: MacPorts applies -O2 to CFLAGS and CXXFLAGS by default, it could be that the bug
is only experienced with optimization enabled.


Probleme beim Linken

Schwerer Fehler (unterschiedliche Definitionen):

ld: multiple definitions of symbol
/usr/lib/gcc/darwin/3.3/libstdc++.a(tinfo.o) z.B.: private external definition
/usr/lib/libstdc++.6.dylib(single module) vs. definition

ld: multiple definitions of symbol
/usr/lib/gcc/darwin/3.3/libgcc.a(unwind-dw2.o) private external definition
/usr/lib/libgcc_s.1.dylib(unwind-dw2.o) definition

Wenn ich libstdc++.6.dylib deaktiviere startet z.B. Firefox nicht mehr
Wenn ich libstdc++.a deaktiviere kommt es zum Linker Fehler: ld: can't locate file for: -lstdc++

=> Lösung: setze für die .a Dateien einen Link auf die .dylib Dateien.

Warnung:

ld: warning multiple definitions of symbol
/opt/local/lib/libiconv.2.dylib(single module)
/usr/lib/libiconv.2.dylib(iconv.o)

ld: warning multiple definitions of symbol
/usr/lib/libz.1.dylib(inflate.o)
/opt/local/lib/libz.1.dylib(inflate.o)

=> Lösung: setze für die /opt/local/lib Dateien einen Link auf die /usr/lib Dateien.


Problem beim Compilieren der Libraries

Library "odbc" (erlang-R13B01/lib/odbc)

Command output: odbcserver.c:2257: warning: passing arg 2 of `ei_decode_list_header' from incompatible pointer type
odbcserver.c:2260: warning: passing arg 2 of `ei_decode_tuple_header' from incompatible pointer type
odbcserver.c:2262: error: `num_param_values' undeclared (first use in this function)
odbcserver.c:2262: error: `state' undeclared (first use in this function)

Nicht nachzuvollziehen.
"num_param_values" und "state" sind nicht undeklariert. Es sind formale Parameter.

=> Lösung: das Builden von Library "odbc" überspringen und hoffen, daß CouchDB sie nicht braucht.
"odbc" ist ein ODBC-Server.

In erlang-R13B01/lib/Makefile:

pman public_key ssl toolbar tv observer odbc \ # <= "odbc" entfernt



icu


restFP und saveFP

ld: Undefined symbols: restFP saveFP => Lösung:


in source/i18n/Makefile:
LIBS = $(LIBICUUC) $(DEFAULT_LIBS) /Users/jri/Desktop/libgcc.a

in source/layout/Makefile:

LIBS = $(LIBICUUC) $(DEFAULT_LIBS) /Users/jri/Desktop/libgcc.a

in source/layoutex/Makefile:

LIBS = $(LIBICUUC) $(LIBICULE) $(DEFAULT_LIBS) /Users/jri/Desktop/libgcc.a

und viele weitere Makefiles ...

in source/text/ viele Unterverzeichnisse mit eigenen Makefiles!

in source/tools/ctestfw/Makefile

Hinweis: hier muß die statische GCC-Library benutzt werden (libgcc.a). Die dynamische (libgcc_s.1.dylib) funktioniert nicht.


libiconv Version inkompatibel

dyld: /opt/local/bin/gmake version mismatch for library: /opt/local/lib/libiconv.2.dylib (compatibility version of user: 8.0.0 greater than library's version: 5.0.0

=> Lösung: libiconv per Link auf die ursprüngliche Version aus /opt/local/lib umleiten, die ist neuer.



nspr


/usr/bin/gcc-3.3 -o prsystem.o -c -I/opt/local/include -O2 -Wmost -fno-common -O2 -fPIC -UDEBUG -DNDEBUG=1 -DXP_UNIX=1 -DDARWIN=1 -DHAVE_BSD_FLOCK=1 -DHAVE_SOCKLEN_T=1 -DXP_MACOSX=1 -DHAVE_STRERROR=1 -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM -D_NSPR_BUILD_ -I../../../dist/include/nspr -I../../../pr/include -I../../../pr/include/private prsystem.c
prsystem.c: In function `PR_GetPhysicalMemorySize':
prsystem.c:310: error: structure has no member named `max_mem'

prsystem.c:
#if defined(DARWIN)
#include
#include
#endif


Mein Rechner:
/usr/include/mach/host_info.h

struct host_basic_info {
...
... /* kein Feld "max_mem" */
};

www.opensource.apple.com:
/usr/include/mach/host_info.h

struct host_basic_info_old { /* <= beachte "old" */ ... ... /* Wie bei mir */ }; struct host_basic_info { ... uint64_t max_mem; /* actual size of physical memory in bytes */ }; My Darwin Version: 7.9.0 => Lösung:

prsystem.c, Line 310:
ändere
bytes = hInfo.max_mem;
in
bytes = 1024 * 1024 * 1024; /* hInfo.max_mem; */
/* jri: Darwin 7.9 has no max_mem field in host_basic_info struct */

Anmerkung: die Zeile könnte auch komplett kommentiert werden, da sowieso
if (result == KERN_SUCCESS)
davor steht.



spidermonkey


ld: Undefined symbols: ___eprintf

=> Lösung:

in js/src/Makefile.ref:
LDFLAGS = $(XLDFLAGS) /usr/lib/libstdc++.6.dylib


ld: Undefined symbols: restFP saveFP

=> Lösung:

in js/src/Makefile.ref:
LDFLAGS = $(XLDFLAGS) /usr/lib/libstdc++.6.dylib /Users/jri/Desktop/libgcc.a

Hinweis: hier muß die statische GCC-Library benutzt werden (libgcc.a). Die dynamische (libgcc_s.1.dylib) funktioniert nicht.



couchdb


curl too old

checking for curl >= 7.15.5... can't find curl >= 7.15.5
configure: error: Library requirements (curl) not met.

=> Lösung:
sudo port install curl


erlang Crach while starting the CouchDB server

noname:~ jri$ couchdb
kernel-poll not supported; "K" parameter ignored
Apache CouchDB 0.9.0 (LogLevel=info) is starting.
{"init terminating in do_boot",{{badmatch,{error,shutdown}},[{couch_server_sup,start_server,1},{erl_eval,do_apply,5},{erl_eval,exprs,5},{init,start_it,1},{init,start_em,1}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

=> Lösung: starte couchdb als User "couchdb"

sudo -u couchdb couchdb

Hinweis:
CouchDB braucht Schreibzugriff für die Verzeichnisse
/opt/local/var/lib/couchdb/
/opt/local/var/log/couchdb/

Der User "couchdb" ist bereits eingerichtet und die Rechte dieser Verzeichnisse bereits entsprechend gesetzt.





Notes


Environment Variablen notwendig?
LD_TWOLEVEL_NAMESPACE=true
MACOSX_DEPLOYMENT_TARGET=10.3
=> Offenbar nicht notwendig!

Environment Variable notwendig?
export LD_FLAGS="-lc /usr/lib/libgcc_s.1.dylib"
=> Keine Auswirkung!
- vielleicht mit -Wl, (nicht probiert)
- -lc müßte weg können (nicht probiert)
Heißt die Variable LDFLAGS ? (ohne _)



Carl Eastlund wrote (Aug 06, 2008):

I was able to resolve these by adding /usr/lib/libgcc_s.1.dylib to the
link arguments in a few places:

(paths are relative to the build directory)

./mred/gc2/Makefile:wx_mac_LIBS = -framework Carbon -framework Cocoa -framework QuickTime -framework AGL -framework OpenGL $(JPEG_A) $(PNG_A) -lz -ldl -lm -liconv -lc /usr/lib/libgcc_s.1.dylib
./mred/gc2/Makefile: $(MREDLINKER) $(LDFLAGS) -o ../MrEd3m.app/Contents/MacOS/MrEd3m mrmain.o -Wl,-headerpad_max_install_names -F. -framework PLT_MrEd -framework Carbon -framework Cocoa /usr/lib/libgcc_s.1.dylib
./mred/Makefile:EXTRALDFLAGS_wx_mac = -framework Carbon -framework Cocoa -framework QuickTime -framework AGL -framework OpenGL -lz /usr/lib/libgcc_s.1.dylib



lothar.behrens wrote (Jan 19, 2006):

after realizing similar error messages and their solutions I got rid of these linking errors by
-lc /usr/lib/libgcc.dylib or the like.


Keine Kommentare:

Kommentar veröffentlichen