Thread: Mac version can't dump/restore

Mac version can't dump/restore

From
John DeSoi
Date:
I get this error when trying to dump a database:

/Applications/pgAdmin3.app/Contents/SharedSupport/helper/pg_dump -i - 
h localhost -p 5432 -U user -F c -b -v -f "/temp/test" test
dyld: Library not loaded: /usr/local/pgsql/lib/libpq.4.dylib  Referenced from:
/Applications/pgAdmin3.app/Contents/SharedSupport/
 
helper/pg_dump  Reason: image not found

Process returned exit code -1.


The problem is the pg_dump utility hard codes the path of libpq. This  
is not very workable because not only can that be customized, some  
one using pgAdmin might not have PostgreSQL installed at all on the  
local machine.

Here is how I setup pgEdit on the Mac which may be a good solution.

1. Put libpq.dylib in the same folder with pg_dump/pg_restore and  
include it in the distribution.
2. Use install_name_tool on each postgresql executable to have it  
reference the library relative to the executable folder. Example:

install_name_tool -change /usr/local/pgsql/lib/libpq.4.dylib  
@executable_path/libpq.4.1.dylib pg_restore


Also, I noticed that the pgAdmin package has PkgInfo at the same  
level as the Contents folder. I thought it should be in the Contents  
folder.





John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL



Re: Mac version can't dump/restore

From
"Dave Page"
Date:
Thanks John - I'll look into this when I have my Mac to hand.

Gotta say I'm slightly surprised to see you here offering advice, though
of course you're more than welcome :-)

Regards. Dave.

> -----Original Message-----
> From: pgadmin-support-owner@postgresql.org
> [mailto:pgadmin-support-owner@postgresql.org] On Behalf Of John DeSoi
> Sent: 16 March 2006 14:29
> To: pgadmin-support@postgresql.org
> Subject: [pgadmin-support] Mac version can't dump/restore
>
> I get this error when trying to dump a database:
>
> /Applications/pgAdmin3.app/Contents/SharedSupport/helper/pg_dump -i -
> h localhost -p 5432 -U user -F c -b -v -f "/temp/test" test
> dyld: Library not loaded: /usr/local/pgsql/lib/libpq.4.dylib
>    Referenced from:
> /Applications/pgAdmin3.app/Contents/SharedSupport/
> helper/pg_dump
>    Reason: image not found
>
> Process returned exit code -1.
>
>
> The problem is the pg_dump utility hard codes the path of
> libpq. This
> is not very workable because not only can that be customized, some
> one using pgAdmin might not have PostgreSQL installed at all on the
> local machine.
>
> Here is how I setup pgEdit on the Mac which may be a good solution.
>
> 1. Put libpq.dylib in the same folder with pg_dump/pg_restore and
> include it in the distribution.
> 2. Use install_name_tool on each postgresql executable to have it
> reference the library relative to the executable folder. Example:
>
> install_name_tool -change /usr/local/pgsql/lib/libpq.4.dylib
> @executable_path/libpq.4.1.dylib pg_restore
>
>
> Also, I noticed that the pgAdmin package has PkgInfo at the same
> level as the Contents folder. I thought it should be in the Contents
> folder.
>
>
>
>
>
> John DeSoi, Ph.D.
> http://pgedit.com/
> Power Tools for PostgreSQL
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>


Re: Mac version can't dump/restore

From
John DeSoi
Date:
On Mar 17, 2006, at 3:14 AM, Dave Page wrote:

> Gotta say I'm slightly surprised to see you here offering advice,  
> though
> of course you're more than welcome :-)

Well, some may see it as I'm helping my primary (and free)  
competition. Although I certainly need a number of features that  
pgAdmin already has, after I get those done I'll be focusing on  
things that I don't expect will be in pgAdmin any time soon. I'm much  
more interested in tools to support complex database application  
development. For me, pgAdmin's model of big lists of objects in  
alphabetical order does not support this very well.

But pgAdmin is a very nice administration tool and I'm happy to help  
where I can. If I have a good tool for administration, I can spend  
more time working on other features I would like to have for  
application development.

Thanks for your continued efforts and especially for supporting the Mac.

John


John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL



Re: Mac version can't dump/restore

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-support-owner@postgresql.org
> [mailto:pgadmin-support-owner@postgresql.org] On Behalf Of John DeSoi
> Sent: 16 March 2006 14:29
> To: pgadmin-support@postgresql.org
> Subject: [pgadmin-support] Mac version can't dump/restore
>
> The problem is the pg_dump utility hard codes the path of
> libpq. This
> is not very workable because not only can that be customized, some
> one using pgAdmin might not have PostgreSQL installed at all on the
> local machine.

Hmm, yes - it seems the build script was assuming GNU xargs, whereas on
the build machine I have the standard BSDish one. I've added some
detection code to the script so it should work with either now.

> Also, I noticed that the pgAdmin package has PkgInfo at the same
> level as the Contents folder. I thought it should be in the Contents
> folder.

Yup, quite correct from what I can see in the Apple docs.

Thanks for the reports - fixes will be committed shortly.

Regards, Dave


Re: Mac version can't dump/restore

From
John DeSoi
Date:
Hi Dave,

On Mar 20, 2006, at 6:30 AM, Dave Page wrote:

> Hmm, yes - it seems the build script was assuming GNU xargs,  
> whereas on
> the build machine I have the standard BSDish one. I've added some
> detection code to the script so it should work with either now.

So why do this rather than include libpq in the package so there is  
no path dependency at all? I thought this is what you are doing on  
Windows already.

Just curious.




John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL



Re: Mac version can't dump/restore

From
"Dave Page"
Date:

> -----Original Message-----
> From: John DeSoi [mailto:desoi@pgedit.com]
> Sent: 20 March 2006 14:47
> To: Dave Page
> Cc: pgadmin-support@postgresql.org
> Subject: Re: [pgadmin-support] Mac version can't dump/restore
>
> Hi Dave,
>
> On Mar 20, 2006, at 6:30 AM, Dave Page wrote:
>
> > Hmm, yes - it seems the build script was assuming GNU xargs,
> > whereas on
> > the build machine I have the standard BSDish one. I've added some
> > detection code to the script so it should work with either now.
>
> So why do this rather than include libpq in the package so there is
> no path dependency at all? I thought this is what you are doing on
> Windows already.
>
> Just curious.

We already did basically what you suggested as part of the install
process when building an appbundle - the problem was that the script
that locates and copies in the libraries was failing due to the xargs
bug. The error message simply went unnoticed in the other reams of
output that make install spews out, and because I normally statically
link wx, it only affected people who didn't have a local install of
PostgreSQL which is presumably fairly rare. Of course, that begs the
question, why isn't PostgreSQL being statically linked as well, but
that's a whole other issue.

The script is at
http://svn.pgadmin.org/cgi-bin/viewcvs.cgi/trunk/pgadmin3/pkg/mac/comple
te-bundle.sh?rev=5055&view=markup if you want a peek.

Regards, Dave.