# unable to update to curl 7.31.0



## Mayhem30 (Jul 11, 2013)

I'm trying to upgrade to the latest version of curl on the ports system. It appears to build fine, but errors out at the end with this:


```
../lib/.libs/libcurl.so: undefined reference to `ERR_remove_thread_state'
*** Error code 1
1 error
*** Error code 2
1 error
*** Error code 1
1 error
*** Error code 1

Stop in /usr/ports/ftp/curl.
*** Error code 1

Stop in /usr/ports/ftp/curl.
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portupgrade20130711-10443-8xml9j env UPGRADE_TOOL=portupgrade UPGRADE_PORT=curl-7.24.0_4 UPGRADE_PORT_VER=7.24.0_4 make
** Fix the problem and try again.
** Listing the failed packages (-:ignored / *:skipped / !:failed)
        ! ftp/curl (curl-7.24.0_4)      (linker error)
localhost#
```

Any ideas how to fix this?


----------



## ShelLuser (Jul 11, 2013)

I'm just done with the updates on my box and curl built cleanly, so I'm tempted to blame your environment. Which FreeBSD version do you use and what have you got in /etc/make.conf?


----------



## EricM (Jul 11, 2013)

Same problem here.

I found this thread while googling for the error.

FreeBSD 9.1-RELEASE-p4

make.conf contents:

```
WITH_OPENSSL_PORT=yes

# added by use.perl 2013-07-10 21:05:23
PERL_VERSION=5.14.4
```
I would take a guess that WITH_OPENSSL_PORT might be the problem, but I don't want to build curl with the old OpenSSL (0.9.8y) of the base system.


----------



## Mayhem30 (Jul 11, 2013)

ShelLuser said:
			
		

> I'm just done with the updates on my box and curl built cleanly, so I'm tempted to blame your environment. Which FreeBSD version do you use and what have you got in /etc/make.conf?



FreeBSD 8.3-RELEASE-p3

make.conf contents*:*

```
MAKE_JOBS_NUMBER=8

# added by use.perl 2013-06-20 09:52:17
PERL_VERSION=5.14.4
```


----------



## EricM (Jul 11, 2013)

EricM said:
			
		

> I would take a guess that WITH_OPENSSL_PORT might be the problem, but I don't want to build curl with the old OpenSSL (0.9.8y) of the base system.



Well I tried to remove WITH_OPENSSL_PORT and `make clean` and it still gives the same error.

This is a fresh install of freebsd FreeBSD, *I* just installed it an hour ago.


----------



## DutchDaemon (Jul 11, 2013)

With a clean `make config` (so port defaults), it doesn't build. 

@ShelLuser, can you post your /var/db/ports/ftp_curl/options? I dropped every option from `make config` I didn't need, and it did compile. So it is one of the options.


----------



## EricM (Jul 11, 2013)

DutchDaemon said:
			
		

> With a clean `make config` (so port defaults), it doesn't build.
> 
> @ShelLuser, post yor /var/db/ports/curl/options? I dropped every option from `make config` I didn't need, and it did compile. So it is one of the options.



Well if you remove all the options then you remove the OpenSSL option so yes it will build because the error is about linking with OpenSSL. But you will have curl without SSL support.


----------



## kpa (Jul 11, 2013)

EricM said:
			
		

> Well if you remove all the options then you remove the OpenSSL option so yes it will build because the error is about linking with OpenSSL. But you will have curl without SSL support.



Nobody is suggesting to remove all the options but to reset them to the defaults. The defaults do include the option to use OpenSSL.


----------



## DutchDaemon (Jul 11, 2013)

I never said 'all the options', only the ones I didn't need. And OpenSSL was still selected. This was the one that built for me:


```
OPTIONS_FILE_SET+=CA_BUNDLE
OPTIONS_FILE_UNSET+=COOKIES
OPTIONS_FILE_UNSET+=CURL_DEBUG
OPTIONS_FILE_UNSET+=DEBUG
OPTIONS_FILE_UNSET+=DOCS
OPTIONS_FILE_UNSET+=EXAMPLES
OPTIONS_FILE_UNSET+=GSSAPI
OPTIONS_FILE_UNSET+=IDN
OPTIONS_FILE_UNSET+=IPV6
OPTIONS_FILE_UNSET+=LDAP
OPTIONS_FILE_UNSET+=LDAPS
OPTIONS_FILE_UNSET+=LIBSSH2
OPTIONS_FILE_UNSET+=NTLM
OPTIONS_FILE_UNSET+=PROXY
OPTIONS_FILE_UNSET+=RTMP
OPTIONS_FILE_UNSET+=SPNEGO
OPTIONS_FILE_UNSET+=TLS_SRP
OPTIONS_FILE_UNSET+=CARES
OPTIONS_FILE_UNSET+=THREADED_RESOLVER
OPTIONS_FILE_UNSET+=CYASSL
OPTIONS_FILE_UNSET+=GNUTLS
OPTIONS_FILE_UNSET+=NSS
OPTIONS_FILE_SET+=OPENSSL
OPTIONS_FILE_UNSET+=POLARSSL
```


----------



## Mayhem30 (Jul 12, 2013)

Thank you, it upgraded fine with only CA_BUNDLE, COOKIES and OPENSSL enabled in the configuration file.


----------



## EricM (Jul 12, 2013)

The problem is GSSAPI which is enabled by default. Removing it from the options allows curl to compile.


----------



## DutchDaemon (Jul 12, 2013)

ACK. If someone could launch a PR or contact the maintainter, that would be appreciated.


----------



## ShelLuser (Jul 12, 2013)

DutchDaemon said:
			
		

> @ShelLuser, can you post your /var/db/ports/ftp_curl/options? I dropped every option from `make config` I didn't need, and it did compile. So it is one of the options.


Sure I can, and it's not GSSAPI as you (everyone) can see:


```
# This file is auto-generated by 'make config'.
# Options for curl-7.31.0                                                       _OPTIONS_READ=curl-7.31.0                                                       _FILE_COMPLETE_OPTIONS_LIST=CA_BUNDLE COOKIES CURL_DEBUG DEBUG DOCS EXAMPLES GSS
API IDN IPV6 LDAP LDAPS LIBSSH2 NTLM PROXY RTMP SPNEGO TLS_SRP CARES THREADED_RESOLVER CYASSL GNUTLS NSS OPENSSL POLARSSL                                       OPTIONS_FILE_SET+=CA_BUNDLE                                                     OPTIONS_FILE_SET+=COOKIES
OPTIONS_FILE_UNSET+=CURL_DEBUG
OPTIONS_FILE_UNSET+=DEBUG
OPTIONS_FILE_SET+=DOCS
OPTIONS_FILE_SET+=EXAMPLES
OPTIONS_FILE_SET+=GSSAPI
OPTIONS_FILE_UNSET+=IDN
OPTIONS_FILE_SET+=IPV6
OPTIONS_FILE_UNSET+=LDAP
OPTIONS_FILE_UNSET+=LDAPS
OPTIONS_FILE_UNSET+=LIBSSH2
OPTIONS_FILE_UNSET+=NTLM
OPTIONS_FILE_SET+=PROXY
OPTIONS_FILE_UNSET+=RTMP
OPTIONS_FILE_UNSET+=SPNEGO
OPTIONS_FILE_SET+=TLS_SRP
OPTIONS_FILE_UNSET+=CARES
OPTIONS_FILE_SET+=THREADED_RESOLVER
OPTIONS_FILE_UNSET+=CYASSL
OPTIONS_FILE_UNSET+=GNUTLS
OPTIONS_FILE_UNSET+=NSS
OPTIONS_FILE_SET+=OPENSSL
OPTIONS_FILE_UNSET+=POLARSSL
```
For the record I ran `# make build` before posting this because I wanted to be absolutely sure. This setup compiles for me.

Just to make this as complete as possible, this is my /etc/make.conf:


```
# Pre-define Apache's suexec root directory
SUEXEC_DOCROOT=/home

# Options for building FreeBSD documentation
#DOC_LANG="en_US.ISO8859-1"
#FORMATS=html-split txt

# Port collection restoration
#PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig
#FORCE_PKG_REGISTER

# added by use.perl 2013-07-08 18:19:02
PERL_VERSION=5.14.4
```

* For extra context: I had an issue in the past with print/ghostscript9 vs. print/ghostscipt9-nox11. And the fact that I used an by then obsoleted port (portmanager) didn't really help. I had to use some drastic measures to fix a major mess and the remains are what you see up there. I haven't had the time to document these options properly (and remove them afterwards) just yet.


----------



## ShelLuser (Jul 12, 2013)

Apologies for 2 messages quickly after one another; figured I'd better not edit.

I tried running `# make distclean && make rmconfig && make build` on my port and when the configuration screen showed up I simply hit enter ('ok') and continued. It built cleanly for me:


```
root@smtp2:/usr/ports/ftp/curl # make showconfig
===> The following configuration options are available for curl-7.31.0:
     CA_BUNDLE=on: Install CA bundle for OpenSSL
     COOKIES=off: Cookies support
     CURL_DEBUG=off: cURL debug memory tracking
     DEBUG=off: Install debug symbols
     DOCS=on: Build and/or install documentation
     EXAMPLES=on: Build and/or install examples
     GSSAPI=on: GSSAPI support
     IDN=off: International Domain Names support
     IPV6=on: IPv6 protocol support
     LDAP=off: LDAP support
     LDAPS=off: LDAPS support
     LIBSSH2=off: SCP/SFTP support via libssh2
     NTLM=off: NTLM authentication support
     PROXY=on: Proxy support
     RTMP=off: RTMP protocol support via librtmp
     SPNEGO=off
     TLS_SRP=on: TLS-SRP (Secure Remote Password) support
====> DNS resolving options: you can only select none or one of them
     CARES=off: Asynchronous DNS resolution via c-ares
     THREADED_RESOLVER=on: Threaded DNS resolver
====> SSL protocol support: you can only select none or one of them
     CYASSL=off
     GNUTLS=off: SSL/TLS support via GnuTLS
     NSS=off
     OPENSSL=on: SSL/TLS support via OpenSSL
     POLARSSL=off
===> Use 'make config' to modify these settings
```
One thing which occurred to me when re-reading this thread: I'm using openssl from the base system and not so much from the ports collection.

Quite frankly I can't help wonder how much impact that might have.


----------



## richardtoohey (Jul 12, 2013)

*This is where it goes wrong ...*

Happens to me on 8.3 and 9.1.  I _think_ it has more to do with having OpenSSL 1.0.1 installed.


```
checking for yaSSL using OpenSSL compatibility mode... no
configure: Added /usr/local/lib to LD_LIBRARY_PATH
checking for OpenSSL headers version... 1.0.1 - 0x1000105fL
checking for OpenSSL library version... 0.9.8
checking for OpenSSL headers and library versions matching... no
```

I'm wondering if you need to do something like this:
http://forums.freebsd.org/showthread.php?t=14051

You have to make a symlink so that the `openssl` command works - maybe the same for the library?


```
# mv /usr/lib/libssl.so /usr/lib/old-libssl.so
# ln -s /usr/local/lib/libssl.so /usr/lib
```

It will build after the change, but with this warning, so not convinced this is a good idea!  Just tried it on a development machine.


```
/usr/bin/ld: warning: libcrypto.so.8, needed by /usr/lib/libssl.so, may conflict with libcrypto.so.6
```

In the configure script it is building a test program and I think that links to the wrong library (the base 0.9.8 one) - so the configure script fails and it slowly goes down to deciding you've got 0.9.8.


----------



## SirDice (Jul 12, 2013)

richardtoohey said:
			
		

> You have to make a symlink so that the openssl command works - maybe the same for the lib?
> 
> 
> ```
> ...


Don't do things like this. In the long run it will cause a lot more problems than you already have.


----------



## richardtoohey (Jul 12, 2013)

OK, thanks.

It didn't seem like a good idea, and I know that someone put that warning there for a reason...

Anyway, the issue affects me on 8.3 i386 and 9.1 amd64 (both with OpenSSL 1.0.1 installed) and none of the suggested workarounds help, so it doesn't appear to be a question of a simple clean or configuration change.

I'll wait for wiser heads than mine to look at this.

Thank you.


----------



## richardtoohey (Jul 12, 2013)

It has been fixed:

http://svnweb.freebsd.org/ports/head/ftp/curl/

WB: that link will change over time, this goes to the specific revision: http://svnweb.freebsd.org/ports?view=revision&revision=322824.


----------



## DutchDaemon (Jul 12, 2013)

There we go.


----------

