Forum OpenACS Q&A: error compiling pgdriver on MacOS X

Collapse
Posted by russ m on

I'm looking to get Postgres/AOLServer/OpenACS running under MacOS X, and hit this error when compiling postgres.so - this looks like a gcc internal error to me but I thought I'd try for some feedback from the authors before trying to get a resolution/ workaround out of Apple...

(cc line helpfully wrapped by <textarea> tags)

[tintin:/usr/local/playground/pgdriver-2.0] russm% make
cc -DFOR_ACS_USE -DBIND_EMULATION -I/usr/local/
aolserver/include -Wall -fpic -shared -I/usr/local/pgsql/include -I/
home/aolserver/include -I-/usr/include   -c -o postgres.o 
postgres.c
postgres.c: In function `Ns_DbDriverInit':
postgres.c:333: internal error--unrecognizable insn:
(insn 15 14 17 (set (reg:SI 4 r4)
        (symbol_ref:SI ("PgProcs"))) -1 (nil)
    (nil))
make: *** [postgres.o] Error 1
[tintin:/usr/local/playground/pgdriver-2.0] russm% 

Any ideas? or is this Not Your Problem??

Collapse
Posted by Walter McGinnis on
Russell,

I'm also trying to get things running under OS X. What process have you followed?

I've found a postgresql 7.1.1 package here: http://www.versiontracker.com/moreinfo.fcgi?id=10424. Did you use this?

What was your process for getting aolserver up and running?

I've heard rumor that Ben has a friend that has successfully gotten OpenACS (not sure which version) up and running on OS X. Is this true Ben? Does your friend have any tips or tricks?

It would be nice to have a down and dirty recipe for OS X in new-file-storage.

Collapse
Posted by Ben Adida on
yes it has been done, except my friend is on vacation in a far off
place (beach, sand, drinks with umbrellas, lucky guy). I got a few
pieces out of him before he left, and he mentioned something
about linking against libpq.a directly. If you have the patience to
play around with the makefile, go for it.

Otherwise, I'll bribe my friend until he posts a full solution :)

Collapse
Posted by Walter McGinnis on
Thanks for the good news Ben.  That is definitely exciting.  I may experiment with the Makefile.  When does your friend get back?

Walter

Collapse
Posted by russ m on
I've built PostgreSQL 7.1.1 and aolserver 3.4 from their
respective standard distribution sources, both compile and
seem to work fine out of the box except aolserver can't figure out
the correct extension for shared libraries (easy to do a manual
override in the init file) and the postgresql build fails when I try to
include perl support (so I didn't include it).

then on to the postgres aolserver driver, tweak nsthread.h in the
aolserver includes to remove multiple definition of FD_SETSIZE,
and then I get that error message from the guts of GCC.

I recall that someone on darwin-development has gcc3 running
on Darwin (albeit without the Apple Obj-C extensions) - I might
try getting that installed and see how I go from there...

Collapse
Posted by Walter McGinnis on

Hmm. Judging from the supported platforms in the install file of AOLserverv3.2+ad12 it should compile as well. I gather from this thread https://openacs.org/bboard/q-and-a-fetch-msg.tcl?msg_id=0001jX&topic_id=12&topic=OpenACS%204%2e0%20Design that it is probably preferable to version 3.4 when working with OpenACS.

Seems to me that there were some funky startup issues with releases earlier than AOLserver 3.4. Anyone remember the work arounds?

Collapse
Posted by russ m on
OK, so I'm a deadbeat...

After applying a minimal amount of brainpower (stealing the cc
options aolserver uses to to produce ".so"s on MacOS X) it
compiles fine. Don't know if it works though since postgres dies
while importing the openacs data model...

I'll try the packaged postgresql 7.1.1 mentioned above and see
how easy it is to get aolserver3.2+ad12 running on OSX...

Collapse
Posted by Roberto Mello on
PostgreSQL 7.1.1 will NOT work with OpenACS or any application that uses PL/pgSQL. Use PG 7.1 or wait for 7.1.2 (which fixes PL/pgSQL, pg_dump and other things).
Collapse
Posted by russ m on
It's all up and running, and seems fine...

postgresql 7.1 compiled from unmodified sources

aolserver3.2+ad12 with one change made - commented out the
6 lines in nsthread.h that reset FD_SETSIZE to 1024 (this is a
bandaid so that postgres.so will build later on - I'm assuming
leaving this at 256 will cause problems of some sort)

postgres.so built by hand since the makefile duffed it

and then the regular amount of messing around to turn the
openacs tarball into a running server...

http://203.43.143.246/aolserver-postgres-Darwin.zip contains
what should be ready-to-install binaries of postgresql, aolserver
and postgres.so - unzip, untgz the postgres and aolserver
directories, stick them in /usr/local, replace the postgres.so in
the aolserver directory with the one from the zipfile (oops), initdb,
createdb, etc...

Collapse
Posted by Walter McGinnis on

Cool. Thanks Russell. When I get a change I'll take a look.

I want to emulate the traditional groups used with (Open)ACS, nsadmin and/or web, but groupadd isn't applicable to OS X (and neither are useradd or adduser). So I'm going to get acquainted with Netinfo and lookup real soon...

Collapse
Posted by Walter McGinnis on
I'm working on having an OpenACS 4 dev environment (well, with PG only) running on Mac OS X.  I'm most of the way there (thanks again Russell).  I just need to finish getting the openacs4.tcl from Vadim's guide adapted to OS X.  If anybody has already done this I would appreciate getting my hands on the file or if you have some gotchas and/or workarounds for startup of AOLserver that you could pass on I would appreciate that too.  Even though these posts have spanned days, I haven't spent that much time on it.

I'm compiling all my steps into an install guide.  I'll post it when I'm successful.

Thanks,

Collapse
Posted by Walter McGinnis on

I'm sorry. I meant to thank Vinod Kurup for this doc:
https://openacs.org/new-file-storage/download/openacs-4.html?version_id=178.

Collapse
Posted by Walter McGinnis on
<p>Wahoo!  I got it running.  Only a couple small details that needed configuring if you use this <a href="/new-file-storage/one-file?file_id=113">file</a> as a starting point:

<p>
<ol>
<li>If you do a straight <code>cvs checkout</code> of OpenACS 4 acs-core you get a directory named <code>openacs-4</code>.  This doesn't match the directions in <a href="/new-file-storage/one-file?file_id=114">https://openacs.org/new-file-storage/one-file?file_id=114</a> or the config file.  No big deal, but rather than do everything over again, I just moved the directory to <code>openacs4</code>.  You can also do this during the <code>cvs checkout</code> with a <code>-d <i>desired_directory_name desired_module_name</i></code>.  This is of course not specific to OS X</li>

<li>I found that I needed to add the following line to the config file for AOLserver to start correctly (this <em>is</em> specific to OS X):
<p>
<code>
<pre>
ns_param  stacksize [expr 128*1024] ;# Per-thread stack size.
</pre>
</code>
<p>This should fall under the <code>ns_section ns/threads</code>.
</li>
</ol>

Ok.  I'll write up the rest of the details up and submit them as a guide to file-storage sometime soon.

Collapse
Posted by Vinod Kurup on
Excellent! Congrats Walter

This doesn't match the directions in https://openacs.org/new-file-storage/one-file?file_id=114 or the config file.

I might have confused things a bit. I wanted everything to be consistent for PG and oracle. Since Oracle doesn't allow 'openacs-4' as a legal tablespace name, I changed it to openacs4. You'll notice in the 'cvs import' statement that I import it to a 'openacs4' repository. But I agree it could be clearer - I'll fix that.

Collapse
Posted by Walter McGinnis on

The OpenACS 4 on Mac OS X HOWTO that I have been working on for sometime is available. Feedback appreciated.

https://openacs.org/new-file-storage/one- file.tcl?file_id=217

Enjoy,

Collapse
Posted by Jamie Ross on
Several apps I am trying to build (Postgresql 7.1.3, psdriver etc) keep getting this error during link:
 
/usr/bin/ld: -undefined error must be used when -twolevel_namespace is in effect 
Has anyone else seen this? any sugggestions?

Running OSX 10.1.2

thanks, Jamie

Collapse
Posted by russ m on
Jamie -

The thread at https://openacs.org/bboard/q- and-a-fetch-msg.tcl?msg_id=0002mP contains some info on getting OpenACS running under 10.1. One relevant bit is this patch for postgresql 7.1.3

I believe that the current PG 7.2 betas build on OSX 10.1 out of the box, so give it a shot and report back if you've got some time to kill...

For the other AOLServer bits, you'll need to link anything that uses shared libraries with "-flat_namespace"

there's a tarball of PG and AOLServer built for OSX 10.1 available at http:// 203.43.143.246/openacs/ if you don't really want to build it all yourself...