# How to avoid the ".. is already installed" errors II.



## HL1234 (Mar 5, 2017)

Sorry,
that I have to describe a similar problem. In short.
I like to install devel/subversion. And also tried to use db5 support by changing from "BDB=off: Berkeley DB support" to on.
To make things for me more clear, I have installed all dependencies for subversion, before I try to build this port; that are:
`make build-depends-list`

```
Required: ./databases/db5
         ./databases/sqlite3
         ./devel/apr1
         ./devel/gettext-runtime
         ./devel/gettext-tools
         ./devel/pkgconf
         ./ports-mgmt/pkg
         ./textproc/expat2
         ./www/serf
```
All dependencies installed fine.

Then I `make build` the devel/subversion port and it comes again to these "_..is already installed_"error for db5.
I found out why by using a logging script
`script build.log make build`
devel/subversion is looking for its dependencies. These is the result:

```
===>  Patching for subversion-1.9.5
===>  Applying extra patch /usr/ports/devel/subversion/files/extra-patch-fbsd-template
===>  Applying FreeBSD patches for subversion-1.9.5
===>   subversion-1.9.5 depends on package: pkgconf>=0.9.10 - found
===>   subversion-1.9.5 depends on executable: msgfmt - found
===>   subversion-1.9.5 depends on file: /usr/local/lib/libapr-1.a - found
===>   subversion-1.9.5 depends on file: /usr/local/lib/libsqlite3.a - found
===>   subversion-1.9.5 depends on file: /usr/local/lib/libexpat.a - found
===>   subversion-1.9.5 depends on file: /usr/local/lib/libserf-1.a - found
===>   subversion-1.9.5 depends on file: /usr/local/lib/libdb-5.3.a - not found
===>  Found saved configuration for db5-5.3.28_6
===>   db5-5.3.28_6 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by db5-5.3.28_6 for building
===>  Extracting for db5-5.3.28_6
```

The problem is here:

```
subversion-1.9.5 depends on file: /usr/local/lib/libdb-5.3.a - not found
```
I have databases/db5 installed again, but this has nothing changed.
I'm searching for the library  /usr/local/lib/libdb-5.3.a in /usr/local/lib/ and see that libdb-5.3.a is not in /usr/local/lib/ but in /usr/local/lib/db5
`ls /usr/local/lib/db5/libdb-5.3.a`

```
-rw-r--r--  1 root  wheel  2656210  4 Mrz 21:34 /usr/local/lib/db5/libdb-5.3.a
```
In /usr/local/lib/ I find also static libraries with the extension *.a.
So I recapitulate one of the ports to things wrong. Either databases/db5 has not set correct a link in /usr/local/lib/ to /usr/local/lib/db5/libdb-5.3.a or subversion looks at the wrong place for it: "subversion-1.9.5 depends on file: /usr/local/lib/libdb-5.3.a - not found".

What do you think?

And how can I fixed this, so that an later update will not break again with the same installation?

Thanks


----------



## spectrum48 (Mar 5, 2017)

Hi! I don't use subversion but I tried to install it to see if I could reproduce your error.

I already had databases/db5 installed; installing devel/subversion with the db option enabled went fine. Note that it looked for shared libraries (libdb-5.3.so, not libdb-5.3.a):


```
===>   subversion-1.9.5 depends on shared library: libdb-5.3.so - found (/usr/local/lib/libdb-5.3.so)
```

Now, if I check the "STATIC Build static version (no shared libs)" option in devel/subversion it looks for static libraries and I can reproduce exactly your error.

So my guess is: you have databases/db5 installed as a shared library, then you try to install devel/subversion as a static program so it looks for a static version of databases/db5 which is not present of course. This triggers a build of databases/db5 which fails since it's already installed.

Does it seem reasonable?

If so, do you really need to build a static version of devel/subversion?


----------



## SirDice (Mar 6, 2017)

Note that FreeBSD 10 and higher have svnlite(1). 

What's in /etc/make.conf?


----------



## HL1234 (Mar 6, 2017)

spectrum48 said:


> So my guess is: you have databases/db5 installed as a shared library, then you try to install devel/subversion as a static program so it looks for a static version of databases/db5 which is not present of course. This triggers a build of databases/db5 which fails since it's already installed.
> 
> Does it seem reasonable?
> 
> If so, do you really need to build a static version of devel/subversion?


Hello,
you are correct. Without static it does compile. But this is not the question. I'm using a port and I can select some options. I do recommend that there will be not a problem. If db5 and static option doesn't work together, there should be a warning. But there is no warning. So this maybe is the bug of the port if both together should not selected. But I disagree with that. In /usr/local/lib/db5 I found the static lib of db5. I believe that subversion is looking at the wrong place or db5 do something not right, or at least something is misconfigured on my system because subversion doesn't search into subdirectories of /usr/local/lib?

In addition, db5 have no static option what could be selected.

Why use static? This is not the question, but I will give my idea about that (maybe not right). Static library not shared - I think so. So if the system is totally broken, subversion will at the end get working. And with subverision I can fetch and reinstall a new system. So I think its a good idea to have this important program running standing alone an not sharing any libraries. But maybe I'm wrong.

Why using subversion and not svnlite?
I've learned this way to fetch the FreeBSD sources:
`cd /usr/ports/devel/subversion`
`make clean install`
`svn checkout svn://svn.freebsd.org/base/release/11.0.1 /usr/src`
..
SirDice in my make.conf I have no entry for DBD, db5 or subversion. What do you expect?

Thanks all


----------



## HL1234 (Mar 8, 2017)

No help?
Is this a bug in `devel/subversion` that it can not found /usr/local/lib/db5/libdb-5.3.a? 
Should I go on anyway, forget the idea of a static version of subversion, because this is broken and take the default options?


----------



## SirDice (Mar 8, 2017)

If you just need it to fetch the sources you can use svnlite(1). There are only a few features missing compared to the "full" Subversion client but I very much doubt you need those.




HL1234 said:


> in my make.conf I have no entry for DBD, db5 or subversion. What do you expect?


Something in the form of BDB_VERSION or similar. That would cause the same issue you had with PERL_VERSION.


----------



## tobik@ (Mar 8, 2017)

HL1234 said:


> So I think its a good idea to have this important program running standing alone an not sharing any libraries.


This is why the base system has svnlite(1). I don't understand why you need to statically link devel/subversion.



HL1234 said:


> Is this a bug in  devel/subversion that it can not found /usr/local/lib/db5/libdb-5.3.a?


Either that or it's a bug in databases/db5 in that it provides /usr/local/lib/db5/libdb-5.3.a but not /usr/local/lib/libdb-5.3.a. Try with this patch:

```
diff --git a/devel/subversion/Makefile b/devel/subversion/Makefile
index 212b03869ad1..9859cdd45301 100644
--- a/devel/subversion/Makefile
+++ b/devel/subversion/Makefile
@@ -72,7 +72,7 @@ USES+=			gettext-tools
 BDB_BUILD_DEPENDS=	yes
 .  endif
 OLD_LIB_DEPENDS:=	${LIB_DEPENDS:S!^!${LOCALBASE}/lib/!:C!(\.so|\.[0-9]+)?:!.a:!}
-BUILD_DEPENDS+=		${OLD_LIB_DEPENDS}
+BUILD_DEPENDS+=		${OLD_LIB_DEPENDS:C!lib${BDB_LIB_NAME}!db${BDB_VER}/lib${BDB_LIB_NAME}!}
 LIB_DEPENDS=
 .endif
```


----------



## HL1234 (Mar 8, 2017)

Hello,
thanks for your answers. In make.conf I have no entries such like "BDB_VERSION". The only one was from perl I has disabled now.
I've try to set a link for libdb-5.3.a:
`cd /usr/local/lib/db5`
`ln -sv /usr/local/lib/db5/libdb-5.3.a /usr/local/lib/libdb-5.3.a`
this has fixed the problem with BDB. But then I get another error

```
/usr/local/lib/libsqlite3.a(sqlite3.o): In function `fts5Bm25Function':
       (.text+0x8b9d8): undefined reference to `log'
       clang: error: linker command failed with exit code 1
```
so I decide know not to take the static version.
It seems that `svnlite` is know the recommended way to fetch the sources .


----------



## yagoo85 (Apr 17, 2017)

Hello, I had a similar problem, when I built subversion - "In function `fts5Bm25Function'", I reinstalled sqlite3 from ports without option FTS5 and make subversion successfully...


----------

