# Can't build db48 or db6



## tuaris (Jan 27, 2014)

Both databases/db48 and databases/db6 fail to build on FreeBSD 9.2 powerpc64 with the similar errors:


```
===>  Building for db48-4.8.30.0
./libtool --mode=compile c++ -c -I. -I./../dist/..  -D_THREAD_SAFE -O2 -pipe -fno-strict-aliasing ./../dist/../cxx/cxx_db.cpp
./libtool --mode=compile c++ -c -I. -I./../dist/..  -D_THREAD_SAFE -O2 -pipe -fno-strict-aliasing ./../dist/../cxx/cxx_dbc.cpp
libtool: compile:  c++ -c -I. -I./../dist/.. -D_THREAD_SAFE -O2 -pipe -fno-strict-aliasing ./../dist/../cxx/cxx_dbc.cpp  -fPIC -DPIC -o .libs/cxx_dbc.o
libtool: compile:  c++ -c -I. -I./../dist/.. -D_THREAD_SAFE -O2 -pipe -fno-strict-aliasing ./../dist/../cxx/cxx_db.cpp  -fPIC -DPIC -o .libs/cxx_db.o
In file included from ./../dist/../dbinc/mutex.h:15,
                 from ./db_int.h:884,
                 from ./../dist/../cxx/cxx_dbc.cpp:11:
./../dist/../dbinc/mutex_int.h: In function 'int MUTEX_SET(int*)':
./../dist/../dbinc/mutex_int.h:599: error: cast from 'int*' to 'int' loses precision
In file included from ./../dist/../dbinc/mutex.h:15,
                 from ./db_int.h:884,
                 from ./../dist/../cxx/cxx_db.cpp:11:
./../dist/../dbinc/mutex_int.h: In function 'int MUTEX_SET(int*)':
./../dist/../dbinc/mutex_int.h:599: error: cast from 'int*' to 'int' loses precision
*** [cxx_dbc.lo] Error code 1
*** [cxx_db.lo] Error code 1
2 errors
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** [do-build] Error code 1

Stop in /usr/ports/databases/db48.
```


```
===>  Building for db6-6.0.20
./libtool --mode=compile g++48 -c -I. -I./../src  -D_THREAD_SAFE -O2 -pipe -O3 -mcpu=G5 -maltivec -mcpu=G5 -fno-strict-aliasing ../lang/cxx/cxx_channel.cpp
./libtool --mode=compile g++48 -c -I. -I./../src  -D_THREAD_SAFE -O2 -pipe -O3 -mcpu=G5 -maltivec -mcpu=G5 -fno-strict-aliasing ../lang/cxx/cxx_db.cpp
libtool: compile:  g++48 -c -I. -I./../src -D_THREAD_SAFE -O2 -pipe -O3 -mcpu=G5 -maltivec -mcpu=G5 -fno-strict-aliasing ../lang/cxx/cxx_db.cpp  -fPIC -DPIC -o .libs/cxx_db.o
libtool: compile:  g++48 -c -I. -I./../src -D_THREAD_SAFE -O2 -pipe -O3 -mcpu=G5 -maltivec -mcpu=G5 -fno-strict-aliasing ../lang/cxx/cxx_channel.cpp  -fPIC -DPIC -o .libs/cxx_channel.o
In file included from ./../src/dbinc/mutex.h:15:0,
                 from ./db_int.h:1116,
                 from ../lang/cxx/cxx_channel.cpp:11:
./../src/dbinc/mutex_int.h: In function 'int MUTEX_SET(int*)':
./../src/dbinc/mutex_int.h:599:15: error: cast from 'int*' to 'int' loses precision [-fpermissive]
   return (int)tsl;
               ^
In file included from ./../src/dbinc/mutex.h:15:0,
                 from ./db_int.h:1116,
                 from ../lang/cxx/cxx_db.cpp:11:
./../src/dbinc/mutex_int.h: In function 'int MUTEX_SET(int*)':
./../src/dbinc/mutex_int.h:599:15: error: cast from 'int*' to 'int' loses precision [-fpermissive]
   return (int)tsl;
               ^
gmake: *** [cxx_channel.lo] Error 1
gmake: *** Waiting for unfinished jobs....
gmake: *** [cxx_db.lo] Error 1
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** [do-build] Error code 1

Stop in /usr/ports/databases/db6.
*** [build] Error code 1

Stop in /usr/ports/databases/db6.
```

Yet databases/db42 builds just fine.

This is my /etc/make.conf:

```
.if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc48)
CC=gcc48
CXX=g++48
CPP=cpp48
CPUTYPE=G5
CFLAGS+=-O3 -maltivec
.endif
WITH_BDB_VER=6
```


----------



## tuaris (Mar 4, 2014)

It builds when I change the line to:


```
return (intptr_t)tsl;
```


----------



## SirDice (Mar 4, 2014)

Does it build correctly if you use the default compiler?


----------



## tuaris (Mar 4, 2014)

SirDice said:
			
		

> Does it build correctly if you use the default compiler?



I tried with the default (GCC 4.2), 4.8, and 4.9.  The results were all the same.


----------



## SirDice (Mar 4, 2014)

In that case I'd file a PR. It may be something specific to PowerPC so be sure to mention that.


----------



## swirling_vortex (May 27, 2014)

I ran into this same issue recently on the 64-bit PowerPC version. Someone did post a patch for review, but it doesn't look like it was incorporated into the ports tree yet.

http://lists.freebsd.org/pipermail/freebsd-ppc/2014-April/006944.html

The technical details are a bit over my head, so I'll try the 32-bit version and see if the same error appears.


----------

