# Locating dependencies for Apache server



## c00kie (Jan 15, 2016)

With an up-to-date ports tree running on FreeBSD 10.2-RELEASE

`cd /usr/ports/www/apache24/ && make install clean`

```
===>  apache24-2.4.18 depends on executable: autoconf-2.69 - not found
===>  autoconf-2.69 depends on executable: gm4 - not found
===>  autoconf-2.69 depends on executable: gm4 - not found
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/devel/autoconf
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/apache24
*** Error code 1

Stop.
make: stopped in /usr/ports/www/apache24
```

Oh dear, Apache won't install.

Working backwards - I tried `cd /usr/ports/devel/autoconf && make install clean` but am thwarted with:

```
===>  autoconf-2.69 depends on executable: gm4 - not found
===>  autoconf-2.69 depends on executable: gm4 - not found
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/autoconf
```

OK, where does gm4 hang out? Anyways, pkg() should be smart enough to find these guys, no?

Thanks in advance.


----------



## SirDice (Jan 15, 2016)

c00kie said:


> Anyways, pkg() should be smart enough to find these guys, no?


Yes, but pkg(8) has nothing to do with this. A port checks for the existence of a specific executable or library to see if its dependencies are installed.


----------



## c00kie (Jan 15, 2016)

SirDice said:


> Yes, but pkg(8) has nothing to do with this. A port checks for the existence of a specific executable or library to see if its dependencies are installed.



Hang on, am I getting closer following:

http://www.freshports.org/www/apache24/

and installing:


```
[LIST=1]
[*]libcrypto.so.8 : security/openssl
[*]autoconf-2.69 : devel/autoconf
[*]autoheader-2.69 : devel/autoconf
[*]autoreconf-2.69 : devel/autoconf
[*]aclocal-1.15 : devel/automake
[*]automake-1.15 : devel/automake
[*]libtoolize : devel/libtool
[/LIST]
```


prior to Apache?


----------



## tobik@ (Jan 15, 2016)

c00kie said:


> OK, where does gm4 hang out?


It's in devel/m4. But something odd is going on here. It should be build and installed automatically if it is not there.

You can list all dependencies of a port with `make all-depends-list`.


----------



## kpa (Jan 15, 2016)

Anything in your /etc/make.conf ?


----------



## c00kie (Jan 15, 2016)

kpa said:


> Anything in your /etc/make.conf ?


Erm...it seems this is undefined:

`ls -l /etc/`

```
...
-rw-r--r--  1 root  wheel  566 Aug 12 11:27 mac.conf
drwxr-xr-x  3 root  wheel  512 Aug 17 09:58 mail
-rw-r--r--  1 root  wheel  106 Aug 12 11:27 mail.rc
-rw-------  1 root  wheel  1838 Nov 22 04:17 master.passwd
-rw-r--r--  1 root  wheel  937 Aug 17 09:58 motd
drwxr-xr-x  2 root  wheel  512 Aug 12 11:27 mtree
...
```


----------



## tobik@ (Jan 15, 2016)

c00kie said:


> Erm...it seems this is undefined:


That's good


----------



## c00kie (Jan 15, 2016)

tobik said:


> But something odd is going on here.


 It sure is.

I go in search of my dependencies:

`cd /usr/ports/devel/m4/ && make install clean
# cd /usr/ports/misc/help2man/ && make install clean`

```
autoconf-2.69 depends on executable: autoconf-wrapper - not found
```
`cd /usr/ports/devel/autoconf-wrapper/ && make install clean`



```
cd /usr/ports/www/apache24/ && make install clean
===>  apache24-2.4.18 depends on executable: autoconf-2.69 - found
===>  apache24-2.4.18 depends on executable: autoheader-2.69 - found
===>  apache24-2.4.18 depends on executable: autoreconf-2.69 - found
===>  apache24-2.4.18 depends on executable: aclocal-1.15 - found
===>  apache24-2.4.18 depends on executable: automake-1.15 - found
===>  apache24-2.4.18 depends on executable: libtoolize - found
===>  apache24-2.4.18 depends on shared library: libexpat.so - found (/usr/local/lib/libexpat.so)
===>  apache24-2.4.18 depends on shared library: libapr-1.so - not found
===>  apr-1.5.2.1.5.4 depends on shared library: libexpat.so - found (/usr/local/lib/libexpat.so)
===>  apr-1.5.2.1.5.4 depends on shared library: libgdbm.so - not found
===>  apr-1.5.2.1.5.4 depends on shared library: libgdbm.so - not found
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/devel/apr1
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/devel/apr1
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/apache24
*** Error code 1

Stop.
make: stopped in /usr/ports/www/apache24
```


OK. What now? (Wipe the disk) It shouldn't be this tricky. Really?


----------



## kpa (Jan 15, 2016)

I remember the autoconf ports being quite broken if you somehow manage to leave behind files from the previous installs, the ports fail then to recognize the need to install their dependencies properly. Try installing devel/m4, devel/autoconf and devel/autoconf-wrapper from packages:

`# pkg install devel/autoconf devel/autoconf-wrapper devel/m4`

If that fails with some error use `pkg install -f` instead.


----------



## c00kie (Jan 15, 2016)

kpa said:


> leave behind files from the previous installs, the ports fail then to recognize the need to install their dependencies properly.


Are you, or do you know of a command which can clean-up broken or fragmented partially installed ports?


----------



## c00kie (Jan 15, 2016)

c00kie said:


> Are you, or do you know of a command which can clean-up broken or fragmented partially installed ports?


I just tried: `pkg autoremove` and
`cd /usr/ports/www/apache24/ && make clean`


----------



## kpa (Jan 15, 2016)

c00kie said:


> Are you, or do you know of a command which can clean-up broken or fragmented partially installed ports?



I have occasionally used something like, finds files and symbolic links that are not part of an installed package:

`# find /usr/local\( -type f -or -type l \) -exec pkg which {} \; | grep "not found in the database"`

You'll have to then inspect the output and decide if a file is a leftover, something under /usr/local/bin is very likely a leftover, /usr/local/etc is a different story because that's where your own configuration files go.


----------



## kpa (Jan 15, 2016)

You could try out the newest addition to the package builder tool family, ports-mgmt/synth. It avoids a lot of the problems like these with leftover files when building ports over a live system. I've had good success with it so far.


----------



## DutchDaemon (Jan 15, 2016)

Make sure your ports tree is up to date as well.


----------



## c00kie (Jan 16, 2016)

DutchDaemon said:


> Make sure your ports tree is up to date as well.


I took this advice, re-extracted the ports tree, update and re-install Apache and, voila...works. I'm pretty sure I did this originally, strange :/.


----------



## marian_cerny (Oct 9, 2016)

c00kie said:


> I ... re-extracted the ports tree, update and re-install Apache and, voila...works.



I had the same problem and re-extracting the ports tree using `portsnap extract` did help. Before I did `portsnap fetch update`.


----------

