# e2Guardian error cannot find "-lresolv"



## nosferatu (Dec 3, 2016)

Hello, 

I am getting a compiler error says it cannot find "-lresolv". How can I fix that problem?


----------



## kpa (Dec 3, 2016)

What's wrong with using the port www/e2guardian ?


----------



## nosferatu (Dec 3, 2016)

kpa said:


> What's wrong with using the port www/e2guardian ?



I am already using the ports collection. I am getting the error while port is being compiled.


----------



## chrbr (Dec 3, 2016)

Dear nosferatu,
I have tried a test build using ports-mgmt/poudriere. It shows no issues with www/e2guardian. Please use script(1) to log all the output of the console to a file. Then you can post the relevant parts here easily including which command you have launched to compile the port. The content of /etc/make.conf could be of interest as well. This file is for global compilation options. It is not necessary that it exists. Do not worry if you do not have it.


----------



## nosferatu (Dec 3, 2016)

chrbr said:


> Dear nosferatu,
> I have tried a test build using ports-mgmt/poudriere. It shows no issues with www/e2guardian. Please use script(1) to log all the output of the console to a file. Then you can post the relevant parts here easily including which command you have launched to compile the port. The content of /etc/make.conf could be of interest as well. This file is for global compilation options. It is not necessary that it exists. Do not worry if you do not have it.






```
===>  Building for e2guardian-3.4.0.3
--- all ---
/usr/bin/make  all-recursive
--- all-recursive ---
Making all in .
Making all in doc
Making all in data
--- all-recursive ---
Making all in languages
Making all in .
Making all in scripts
--- all-recursive ---
Making all in .
Making all in configs
--- all-recursive ---
Making all in lists
--- all-recursive ---
Making all in phraselists
Making all in .
Making all in authplugins
--- all-recursive ---
Making all in .
Making all in bannedrooms
--- all-recursive ---
Making all in .
Making all in contentscanners
--- all-recursive ---
Making all in .
Making all in downloadmanagers
--- all-recursive ---
Making all in .
Making all in downloadmanagers
--- all-recursive ---
Making all in .
Making all in authplugins
--- all-recursive ---
Making all in .
Making all in .
Making all in contentscanners
--- all-recursive ---
Making all in .
Making all in src
--- e2guardian ---
c++ -I/usr/local/include  -O2 -pipe -I/usr/local/include -D__SSLMITM -D__SSLCERT -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing  -DLIBICONV_PLUG   -lssl -lcrypto -fstack-protector -o e2guardian e2guardian-String.o  e2guardian-FDTunnel.o  e2guardian-ConnectionHandler.o  e2guardian-DataBuffer.o  e2guardian-HTTPHeader.o  e2guardian-NaughtyFilter.o  e2guardian-BackedStore.o e2guardian-RegExp.o  e2guardian-FDFuncs.o e2guardian-BaseSocket.o  e2guardian-Socket.o e2guardian-FatController.o  e2guardian-UDSocket.o e2guardian-SysV.o  e2guardian-ListContainer.o e2guardian-Auth.o  e2guardian-HTMLTemplate.o  e2guardian-LanguageContainer.o  e2guardian-DynamicURLList.o  e2guardian-DynamicIPList.o  e2guardian-ImageContainer.o  e2guardian-IPList.o  e2guardian-OptionContainer.o  e2guardian-FOptionContainer.o  e2guardian-ListManager.o e2guardian-md5.o  e2guardian-DownloadManager.o  e2guardian-ConfigVar.o  e2guardian-ContentScanner.o  e2guardian-SocketArray.o  e2guardian-e2guardian.o  e2guardian-CertificateAuthority.o contentscanners/e2guardian-icapscan.o  contentscanners/e2guardian-kavdscan.o contentscanners/e2guardian-clamdscan.o   contentscanners/e2guardian-commandlinescan.o downloadmanagers/e2guardian-default.o downloadmanagers/e2guardian-fancy.o  downloadmanagers/e2guardian-trickle.o authplugins/e2guardian-proxy.o authplugins/e2guardian-ident.o  authplugins/e2guardian-ip.o authplugins/e2guardian-dnsauth.o authplugins/e2guardian-port.o  authplugins/e2guardian-ntlm.o authplugins/e2guardian-digest.o -lpcreposix -L/usr/local/lib -lpcre  -lz   -lresolv
/usr/bin/ld: cannot find -lresolv
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** [e2guardian] Error code 1

make[4]: stopped in /usr/ports/www/e2guardian/work/e2guardian-3.4.0.3/src
1 error

make[4]: stopped in /usr/ports/www/e2guardian/work/e2guardian-3.4.0.3/src
*** [all-recursive] Error code 1

make[3]: stopped in /usr/ports/www/e2guardian/work/e2guardian-3.4.0.3
1 error

make[3]: stopped in /usr/ports/www/e2guardian/work/e2guardian-3.4.0.3
*** [all] Error code 2

make[2]: stopped in /usr/ports/www/e2guardian/work/e2guardian-3.4.0.3

make[2]: stopped in /usr/ports/www/e2guardian/work/e2guardian-3.4.0.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/www/e2guardian
*** Error code 1

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


I don't have any make.conf file.

I tried make_jobs_unsafe to, still no luck.


----------



## chrbr (Dec 3, 2016)

Dear nosferatu,
I have tried that in a setup which is not clean. I did `cd /usr/ports/www/e2guardian` and `make`. I have used the default configuration of the port. I did not found anything in the output about lresolv. The same result with `make all`. But I have not updated the ports tree in this environment. I have seen that the version of www/e2guardian is similar to yours. Have you also just run `make`? How about the configuration options?
EDIT I am running FreeBSD 10.3. What version do you use?


----------



## nosferatu (Dec 3, 2016)

chrbr said:


> Dear nosferatu,
> I have tried that in a setup which is not clean. I did `cd /usr/ports/www/e2guardian` and `make`. I have used the default configuration of the port. I did not found anything in the output about lresolv. The same result with `make all`. But I have not updated the ports tree in this environment. I have seen that the version of www/e2guardian is similar to yours. Have you also just run `make`? How about the configuration options?
> EDIT I am running FreeBSD 10.3. What version do you use?



First time I changed the configuration options, after the error I did make rmconfig and tried again. Still no luck. I've just installed it using the package instead of port. I don't know what is it either. I enabled some security options while installing FreeBSD 11. Maybe it is because of that?


----------



## chrbr (Dec 3, 2016)

nosferatu said:


> I enabled some security options while installing FreeBSD 11. Maybe it is because of that?


I do now know. At least the default configuration should work. http://portsmon.freebsd.org/portoverview.py?category=www&portname=e2guardian is a good place to verify that. Seeking for lresolv I saw reports about topics related to SASL and SSL. All results are old but if I am not wrong there have been changes recently with respect to SSL.


----------



## nosferatu (Dec 3, 2016)

chrbr said:


> I do now know. At least the default configuration should work. http://portsmon.freebsd.org/portoverview.py?category=www&portname=e2guardian is a good place to verify that. Seeking for lresolv I saw reports about topics related to SASL and SSL. All results are old but if I am not wrong there have been changes recently with respect to SSL.



Maybe. I had some problem with SSL a short time ago with some ports. I will configure the e2guardian tomorrow. If it works i will post the results tomorrow. If it doesn't, I think I should reinstall the FreeBSD default.


----------



## chrbr (Dec 3, 2016)

Dear nosferatu,
now I have enabled dns which is off by default and run into the same error as you have shown. May be you have something which enables that setting somehow. At least it is good that the problem can be reproduced.


----------



## nosferatu (Dec 4, 2016)

chrbr said:


> Dear nosferatu,
> now I have enabled dns which is off by default and run into the same error as you have shown. May be you have something which enables that setting somehow. At least it is good that the problem can be reproduced.



Thank you then I can disable DNS and use the port instead of package. Should I send a bug report for this?


----------



## chrbr (Dec 4, 2016)

nosferatu said:


> Should I send a bug report for this?


It might be better to contact the maintainer first. The address appears by `make maintainer`. May be there is already some solution. I have just verified that the error appears also in a clear environment using port-mgmt/poudriere when DNS is selected.


----------



## chrbr (Dec 4, 2016)

Dear nosferatu,
I have tried to find out where the parameter lresolv comes from and I found it in configure.ac. Without understanding what I am doing I just deleted that parameter and now the port compiles with DNS active. If you like to test it put the lines below

```
--- configure.ac.orig   2016-03-14 15:21:42 UTC
+++ configure.ac
@@ -612,7 +612,7 @@ else
    AC_MSG_RESULT(yes)
    dnsauth=true
    DNSAUTHSUPPORT=""
-   LIBS="${LIBS} -lresolv"
+   LIBS="${LIBS}"
    AC_DEFINE([PRT_DNSAUTH],[],[Define to enable DNS auth plugin])
 fi],
 [
```
to files/patch-configure.ac. There is already an other file e2guardian.in. The change just removes -lresolv when `make patch` is applied. This happens from the normal `make` automatically. With this patch even port-mgmt/poudriere is happy when DNS is activated. Please try if the software is functional or not. I have no idea. Hopefully the patch is all to make the DNS option work. To be on the safe side it might be owrth to ask the maintainer about his opinion about the patch, even if it works for you.


----------



## kpa (Dec 4, 2016)

As far as I know Linux and Solaris have libresolv library (there may be others) and FreeBSD doesn't. The correct fix would be to make autoconf properly detect if the system has a libresolv library or not.


----------



## chrbr (Dec 4, 2016)

Dear kpa,


kpa said:


> The correct fix would be to make autoconf properly detect if the system has a libresolv library or not.


I have only very limited experience with autoconf. Does that mean that www/e2guardian is fine but devel/autoconf should be fixed? If yes, this should be clearly better than work around on other ports.


----------



## kpa (Dec 4, 2016)

chrbr said:


> Dear kpa,
> 
> I have only very limited experience with autoconf. Does that mean that www/e2guardian is fine but devel/autoconf should be fixed? If yes, this should be clearly better than work around on other ports.



No the upstream software and also the FreeBSD port of it is broken. Autoconf can detect the library or lack of it if configured properly in the configure.ac file of the port. Your fix only removes the library unconditionally which is probably fine for FreeBSD but breaks it for other platforms so your fix is ok only as FreeBSD local patch for the port.


----------



## chrbr (Dec 4, 2016)

kpa said:


> Your fix only removes the library unconditionally which is probably fine for FreeBSD but breaks it for other platforms so your fix is ok only as FreeBSD local patch for the port.


Ok, then I will try to find a better fix for configure.ac. This should be also good to get some knowledge about autoconf. Currently it is somehow magic for me.


----------



## chrbr (Dec 4, 2016)

Dear kpa,
I have tried to understand https://autotools.io/autoconf/finding.html which says in the section 4.1. Searching For System Libraries

```
AC_SEARCH_LIBS(function, libraries-list, action-if-found, action-if-not-found, extra-libraries)
function
The name of the symbol to look for in the libraries.
libraries-list
A whitespace-separated list of libraries, in library-name format, that have to be searched for the function listed before. This list does not require the C library to be specified, as the first test will be done with just the libraries present in the LIBS variable.
action-if-found, action-if-not-found
As usual, the macro supports expanding code for success and failure. In this instance, each will be called at most once, and the default action-if-found code, adding the library to the LIBS variables, is always executed, even if a parameter is passed.
extra-libraries
...additonal info...
```
In configure.ac I found the line

```
AC_SEARCH_LIBS([inet_aton], [resolv])
```
with inet_aton as a function provided by resolv. Therefore I guess that -lresolv in the line

```
LIBS="${LIBS} -lresolv"
```
might be not necessary. From my understanding it should be already appended by AC_SEARCH_LIBS if it is available. What do you think?


----------



## nosferatu (Dec 4, 2016)

I will try the patch after current make. Hope it works. I have some obsession to use ports instead of packages. I will contact the maintainer after the result. Thank you for help chrbr.


----------



## chrbr (Dec 4, 2016)

nosferatu said:


> I will try the patch after current make. Hope it works. I have some obsession to use ports instead of packages. I will contact the maintainer after the result. Thank you for help chrbr.


I am curious about the result and the opinion of the maintainer. As you see from the postings above I am learning as well, for example from kpa . This forum is great.


----------



## nosferatu (Dec 4, 2016)

chrbr said:


> I am curious about the result and the opinion of the maintainer. As you see from the postings above I am learning as well, for example from kpa . This forum is great.



I will post it here after I got the response then. Yes, I guess I like FreeBSD because of this forum even if I do mostly reading it is quite educating experience for me.


----------



## nosferatu (Dec 4, 2016)

Dear chrbr,

Some other configuration options also outputs the same error. Probably maintainer only considered the default instillation. I will mail him this thread.


----------



## chrbr (Dec 6, 2016)

nosferatu said:


> Some other configuration options also outputs the same error. Probably maintainer only considered the default instillation. I will mail him this thread.


This is a good idea. Then the maintainer has all information.


----------



## PaddyMac (Sep 23, 2017)

I encountered this same issue. Did you ever contact the maintainer? I didn't find any open bugs on the bug tracker.


----------



## nosferatu (Oct 6, 2017)

PaddyMac said:


> I encountered this same issue. Did you ever contact the maintainer? I didn't find any open bugs on the bug tracker.



I mailed him/her but he/she never answered.


----------

