# Cannot build bacula9-server port -  undefined symbol



## rforberger (Jul 3, 2019)

Hi,

I am trying to build the bacula9-server port on my FreeBSD 12.0-RELEASE-p6 GENERIC  amd64 system, but it's failing with the error message:


```
Linking bacula-dir ...
/usr/ports/sysutils/bacula9-server/work/bacula-9.4.3/libtool --silent --tag=CXX --mode=link /usr/bin/c++  -L/usr/local/lib -L/usr/local/lib  -L/usr/local/lib -fstack-protector-strong -L../lib -L../cats -L../findlib -o bacula-dir dird.o admin.o authenticate.o autoprune.o backup.o bsr.o catreq.o dir_plugins.o dird_conf.o expand.o fd_cmds.o getmsg.o inc_conf.o job.o jobq.o mac.o mac_sql.o mountreq.o msgchan.o next_vol.o newvol.o recycle.o restore.o run_conf.o scheduler.o ua_acl.o ua_cmds.o ua_dotcmds.o ua_query.o ua_input.o ua_label.o ua_output.o ua_prune.o ua_purge.o ua_restore.o ua_run.o ua_select.o ua_server.o snapshot.o ua_status.o ua_tree.o ua_update.o vbackup.o verify.o -lz  -lbacfind -lbacsql -lbaccats -lbaccfg -lbac -lm   -lpthread  -lintl  -lwrap /usr/local/lib/libintl.so -Wl,-rpath -Wl,/usr/local/lib -lssl -lcrypto
/usr/bin/ld: error: undefined symbol: BDB::bdb_get_client_pool(JCR*, alist*)
>>> referenced by ua_prune.c
>>>               ua_prune.o:(prunecmd(UAContext*, char const*))
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** [bacula-dir] Error code 1

make[3]: stopped in /usr/ports/sysutils/bacula9-server/work/bacula-9.4.3/src/dird
1 error

make[3]: stopped in /usr/ports/sysutils/bacula9-server/work/bacula-9.4.3/src/dird


  ====== Error in /usr/ports/sysutils/bacula9-server/work/bacula-9.4.3/src/dird ======


*** [all] Error code 1

make[2]: stopped in /usr/ports/sysutils/bacula9-server/work/bacula-9.4.3
1 error

make[2]: stopped in /usr/ports/sysutils/bacula9-server/work/bacula-9.4.3
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/sysutils/bacula9-server
*** Error code 1

Stop.
make: stopped in /usr/ports/sysutils/bacula9-server

===>>> make build failed for sysutils/bacula9-server
===>>> Aborting update

===>>> Update for sysutils/bacula9-server failed
===>>> Aborting update
```

I don't understand how this symbol can be undefined, since it's defined in ./src/cats/sql_get.c .

Any ideas how I can safely build the port?

Thanks in advance.

Best regards,
Ronny Forberger


----------



## SirDice (Jul 3, 2019)

Any reason why you can't use the package?


----------



## rforberger (Jul 3, 2019)

SirDice The package is not built with PGSQL support, which I need.


----------



## SirDice (Jul 3, 2019)

That's a fair enough reason. What's in /etc/make.conf?


----------



## rforberger (Jul 3, 2019)

Just 
	
	



```
DEFAULT_VERSIONS+=ssl=base
```


----------



## SirDice (Jul 3, 2019)

You can remove that, it's the default. But it won't hurt if you leave it in. 



rforberger said:


> I don't understand how this symbol can be undefined, since it's defined in ./src/cats/sql_get.c .


In the source code, yes. But it's the linker that's throwing the error. 

After lots of digging I _think_ BDB::bdb_get_client_pool refers to some code from MySQL. Is that option on or off? Can you post the output of `make showconfig`?


----------



## rforberger (Jul 3, 2019)

SirDice Are you sure it is related to MySQL? Not Berkerley DB? I have already re-installed the ports databases/db5 and databases/db6, but it doesn't mitigate the error.

The output of make showconfig is:


```
===> The following configuration options are available for bacula9-server-9.4.3:
     IPV6=on: IPv6 protocol support
     MTX=off: Install mtx for control of autochanger devices
     NLS=on: Native Language Support
     PYTHON=off: Python bindings or support
====> Options available for the multi BACKEND: you have to choose at least one of them
     SQLITE3=off: SQLite 3 database support
     MYSQL=off: MySQL database support
     PGSQL=on: PostgreSQL database support
```

By the way I'm building with portmaster -dR <port> .


----------



## SirDice (Jul 4, 2019)

rforberger said:


> Are you sure it is related to MySQL?


No, but searching for it resulted in a lot of hits related to MySQL. 



rforberger said:


> I have already re-installed the ports databases/db5 and databases/db6, but it doesn't mitigate the error.


If you don't need them, remove them. Ports typically automatically build and install their dependencies. If you indeed found some relation with the error they may actually be the cause.


----------



## rforberger (Jul 4, 2019)

> No, but searching for it resulted in a lot of hits related to MySQL.



Yes, but the MySQL build option is disabled.



> If you don't need them, remove them. Ports typically automatically build and install their dependencies. If you indeed found some relation with the error they may actually be the cause.



I have deleted the db6 port again, since it is not needed by any port. The db5 is needed by ports, so I can't delete it.

I'm still facing the build issue, any other ideas?

Best regards,
rforberger


----------



## SirDice (Jul 4, 2019)

Can you try building it with the default options? I know you need the PGSQL option but it's an additional option so it may not have been tested correctly. I'm just wondering if the port builds cleanly with the default settings. If it builds properly with the default options but not with PGSQL enabled I would say it's a bug in the port that would need to be fixed. The actual bug might be upstream though.


----------



## rforberger (Jul 4, 2019)

I have done a 
	
	



```
make rmconfig
```
 in 
	
	



```
/usr/ports/sysutils/bacula9-server
```
 but the config options didn't change.
I didn't find any port configuration in 
	
	



```
/var/db/ports/sysutils_bacula9-server/options
```
, so I removed all build options except the SQLITE option manually but the build error persists.

So you think it's an upstream bug or a problem on my system?


----------



## SirDice (Jul 4, 2019)

A `make rmconfig` should be enough to "reset" the options to default. 

If it fails to build with the default options I'm inclined to think it's a problem on your system. The official packages are always built with the default options and the build clusters have successfully created packages for it. So it _should_ build correctly. 

The question then remains, what's causing the build errors? Can you post the output of `pkg version -vR`? It might be some dependency that's outdated or incorrect.


----------



## rforberger (Jul 4, 2019)

Sure.

See: https://paste.ofcode.org/xydFFiEpPADYWVCWyeyFvm


----------



## SirDice (Jul 4, 2019)

The build error is probably because you have a mix of ports and quarterly packages. It builds just fine on my system: https://paste.ofcode.org/z2zqVuFwVGeL4ALcsNeQs

That said, I rechecked and the PGSQL option is actually on by default. So I would suggest using the package.


----------



## rforberger (Jul 4, 2019)

Thanks.
The package has PGSQL support. It works using the package.

Best regards,
rforberger


----------

