This forum is no longer active. Please post your questions to our new community site

Forums MAPPStack

Compiling Zabbix against MAMPStack

Subscribe to Compiling Zabbix against MAMPStack 8 post(s), 2 voice(s)

 
Avatar Armagon 5 post(s)

Greetings.

I successfully compiled Zabbix (www.zabbix.com) against MAPPStack. However, when I try to run it, it fails to find a dynamic library for PostgreSQL.

Mostly following the directions at http://lukecyca.com/2008/09/21/howto-install-zabbix-16-on-mac-os-x-105/ (although I am building it on Tiger Server), I configured it thusly:

cd ~/Downloads/zabbix-1.6.4/
env LIBS=”-lresolv” ./configure—enable-server—with-pgsql=/Applications/mappstack-1.1-2/postgresql/bin/pg_config—with-net-snmp—with-libcurl—prefix=/Library/Zabbix
sudo make install

It builds and installs fine. When I try to run it, I get this:

$ /Library/Zabbix/sbin/zabbix_server
dyld: Library not loaded: /bitnami/mappstack/output/postgresql/lib/libpq.5.dylib Referenced from: /Library/Zabbix/sbin/zabbix_server Reason: image not found
Trace/BPT trap

The output of /Applications/mappstack-1.1-2/postgresql/bin/pg_config

BINDIR = /Applications/mappstack-1.1-2/postgresql/bin
DOCDIR = /Applications/mappstack-1.1-2/postgresql/doc
INCLUDEDIR = /Applications/mappstack-1.1-2/postgresql/include
PKGINCLUDEDIR = /Applications/mappstack-1.1-2/postgresql/include
INCLUDEDIR-SERVER = /Applications/mappstack-1.1-2/postgresql/include/server
LIBDIR = /Applications/mappstack-1.1-2/postgresql/lib
PKGLIBDIR = /Applications/mappstack-1.1-2/postgresql/lib
LOCALEDIR =
MANDIR = /Applications/mappstack-1.1-2/postgresql/man
SHAREDIR = /Applications/mappstack-1.1-2/postgresql/share
SYSCONFDIR = /Applications/mappstack-1.1-2/postgresql/etc
PGXS = /Applications/mappstack-1.1-2/postgresql/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = ‘-prefix=/bitnami/mappstack/output/postgresql’ ‘-without-readline’ ‘CC=gcc’ ‘CFLAGS=-I/bitnami/mappstack/output/common/include’ ‘CPPFLAGS=’ ‘LDFLAGS=-L/bitnami/mappstack/output/common/lib’
CC = gcc -no-cpp-precomp
CPPFLAGS =
CFLAGS = -I/bitnami/mappstack/output/common/include -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv
CFLAGS_SL =
LDFLAGS = -L/bitnami/mappstack/output/common/lib
LDFLAGS_SL =
LIBS = -lpgport -lz -lm
VERSION = PostgreSQL 8.3.3

I looked through config.log in the zabbix directories, but could find no references to bitnami (although certainly there are references to pg_config).

How do I recompile to avoid this, or otherwise resolve the issue?

Thanks,
Armagon

Note: I edited the post to use blockquotes, but don’t know how to pre-format the text inside.

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Hi, it is not necessary to recompile. The problem is that the “zabbix_server” binary file can not found the postgresql libraries. Try the following:


$ cd /Applications/mappstack-1.1-2
$ ./use_mappstack.sh

Using this script you are loading the environment variables for the Stack. You can check your new environment variables typying:
$ export

Then you can start Zabbix server:

$ /Library/Zabbix/sbin/zabbix_server 

I hope it helps.

 
Avatar Armagon 5 post(s)

Thank you, beltran. I’m afraid that even after setting up the environment in that way, the error is unchanged.

 
Avatar Armagon 5 post(s)

Interesting. I’m looking through config.log again, and it has references to /bitnami/mappstack/output/common/include (and /lib) all over the place. I don’t know if it wasn’t there when I searched before, or if I just missed it somehow. I’m trying to see if I can track down where it came from.

Also, if I put a symlink from the dylib file zabbix is looking for to the real file, it works, but I don’t particularly want to have a deep /bitnami path with only a single symlink in it on my server if I can avoid it. [Edit: It turns out that the bitnami path is only there if you start compiling after running use_mappstack.sh. It is not there otherwise.]

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Hi,

The /bitnami folder is the path where we compiled the components. It should be enough defining the environment variables: DYLD_LIBRARY_PATH and others.

 
Avatar Armagon 5 post(s)

I learned that to see the libraries that are linked against, one can use:

otool -L /Library/Zabbix/sbin/zabbix_server

Sure enough, it shows an entry starting with /bitnami.

I did play with DYLD_LIBRARY_PATH (and others). Trying it again, though, it appears to have worked:

DYLD_LIBRARY_PATH=/Applications/mappstack-1.1-2/postgresql/lib/ /Library/Zabbix/sbin/zabbix_server

Interesting. I like that better than a symlink; here is hoping it is the end of my problem.

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Yes, that is exactly that I want to explain you but I forget that “use_mampstack.sh” only change the PATH environment.

Try the following. Instead of running “use_mampstack.sh” you can load all environment variables from the “scripts/setenv.sh” file. As you can check this file contains all the environment variables for your Stack.

$ cd <installation_directory>
$ . scripts/setenv.sh (it is important thespace between the dot and the script)
$ export (you can check that environment variables have changed)
$ /Library/Zabbix/sbin/zabbix_server

Of course this is a better solution than a symlink, this is the method that we use to create independent and relocatable Stacks.

Cheers.

 
Avatar Armagon 5 post(s)

That worked nicely! Thank you, beltran.

Forums MAPPStack