Bug 224072

Summary: ftp/curl would not build if archivers/brotli is installed
Product: Ports & Packages Reporter: Mikhail T. <mi>
Component: Individual Port(s)Assignee: Po-Chuan Hsieh <sunpoet>
Status: Closed FIXED    
Severity: Affects Only Me CC: freebsd, gessel, iron, osa, takefu
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
curl-7.56.1.patch none

Description Mikhail T. 2017-12-04 04:42:28 UTC
The curl port does not mention brotli, but the configure finds and enables it:

configure:21151: checking for BrotliDecoderDecompress in -lbrotlidec
configure:21173: cc -o conftest -isystem /usr/include -O2 -pipe -march=core2 -fs
tack-protector -isystem /opt/include -fno-strict-aliasing -Qunused-arguments -is
ystem /usr/include -isystem /usr/include -isystem /opt/include   -L/usr/lib  -L/
usr/lib -L/usr/lib -L/usr/lib -fstack-protector   conftest.c -lbrotlidec   -lz -
lkrb5 -lgssapi -lgssapi_krb5 -lcrypto -lkrb5 -lgssapi -lgssapi_krb5 -L/opt/lib >
&5
configure:21173: $? = 0
configure:21182: result: yes
configure:21196: checking brotli/decode.h usability
configure:21196: cc -c -isystem /usr/include -O2 -pipe -march=core2 -fstack-prot
ector -isystem /opt/include -fno-strict-aliasing -Qunused-arguments -isystem /us
r/include -isystem /usr/include -isystem /opt/include   conftest.c >&5
configure:21196: $? = 0
configure:21196: result: yes
configure:21196: checking brotli/decode.h presence
configure:21196: cpp -isystem /usr/include -isystem /usr/include -isystem /opt/i
nclude   conftest.c
configure:21196: $? = 0
configure:21196: result: yes
configure:21196: checking for brotli/decode.h
configure:21196: result: yes

Then, when curl is compiled, things break:

libtool: compile:  cc -DHAVE_CONFIG_H -I../include -I../lib -I../lib -DBUILDING_LIBCURL -DCURL_HIDDEN_SYMBOLS -isystem /usr/include -isystem /usr/include -isystem /opt/include -I/usr/include -I/usr/include/openssl -I/opt/include -I/opt/include -I/opt/include -I/opt/include -fvisibility=hidden -isystem /usr/include -O2 -pipe -march=core2 -fstack-protector -isystem /opt/include -fno-strict-aliasing -Qunused-arguments -MT libcurl_la-content_encoding.lo -MD -MP -MF .deps/libcurl_la-content_encoding.Tpo -c content_encoding.c  -fPIC -DPIC -o .libs/libcurl_la-content_encoding.o
content_encoding.c:549:8: error: use of undeclared identifier
      'BROTLI_DECODER_ERROR_COMPOUND_DICTIONARY'; did you mean
      'BROTLI_DECODER_ERROR_FORMAT_DICTIONARY'?
  case BROTLI_DECODER_ERROR_COMPOUND_DICTIONARY:
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       BROTLI_DECODER_ERROR_FORMAT_DICTIONARY
/opt/include/brotli/decode.h:114:35: note: 
      'BROTLI_DECODER_ERROR_FORMAT_DICTIONARY' declared here
  BROTLI_DECODER_ERROR_CODES_LIST(BROTLI_ERROR_CODE_ENUM_ITEM_, BROTLI_COMMA_)
                                  ^
/opt/include/brotli/decode.h:82:3: note: expanded from macro
      'BROTLI_DECODER_ERROR_CODES_LIST'
...

I guess, either brotli needs upgrading, or curl needs patching... In either case, brotli should become another option for curl.
Comment 1 iron 2017-12-04 23:49:54 UTC
I've got the same error.

Options        :
	CARES          : off
	CA_BUNDLE      : on
	COOKIES        : on
	CURL_DEBUG     : off
	DEBUG          : off
	DOCS           : off
	EXAMPLES       : off
	GNUTLS         : off
	GSSAPI_BASE    : off
	GSSAPI_HEIMDAL : off
	GSSAPI_MIT     : off
	GSSAPI_NONE    : on
	HTTP2          : off
	IDN            : on
	IPV6           : on
	LDAP           : off
	LDAPS          : off
	LIBSSH2        : on
	METALINK       : off
	NSS            : off
	OPENSSL        : on
	POLARSSL       : off
	PROXY          : on
	PSL            : off
	RTMP           : off
	SMB            : off
	THREADED_RESOLVER: on
	TLS_SRP        : off
	WOLFSSL        : off
Comment 2 takefu 2017-12-05 05:06:47 UTC
Created attachment 188536 [details]
curl-7.56.1.patch

Adhoc patch :-)
Comment 3 iron 2017-12-05 09:28:20 UTC
(In reply to takefu from comment #2)
It would be good to have option to add brotli support for curl.
Comment 4 gessel 2017-12-05 09:48:49 UTC
Same error with 
curl-7.56.1       <   needs updating (index has 7.57.0)
brotli-0.6.0_1,1  =   up-to-date with index
FreeBSD 10.3-RELEASE #0 r322073

content_encoding.c:549:8: error: use of undeclared identifier 'BROTLI_DECODER_ERROR_COMPOUND_DICTIONARY'; did you mean 'BROTLI_DECODER_ERROR_FORMAT_DICTIONARY'?
  case BROTLI_DECODER_ERROR_COMPOUND_DICTIONARY:
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       BROTLI_DECODER_ERROR_FORMAT_DICTIONARY
/usr/local/include/brotli/decode.h:114:35: note: 'BROTLI_DECODER_ERROR_FORMAT_DICTIONARY' declared here
  BROTLI_DECODER_ERROR_CODES_LIST(BROTLI_ERROR_CODE_ENUM_ITEM_, BROTLI_COMMA_)
                                  ^
/usr/local/include/brotli/decode.h:82:3: note: expanded from macro 'BROTLI_DECODER_ERROR_CODES_LIST'
  BROTLI_ERROR_CODE(_ERROR_FORMAT_, DICTIONARY, -12) SEPARATOR             \
  ^
/usr/local/include/brotli/decode.h:113:5: note: expanded from macro 'BROTLI_ERROR_CODE_ENUM_ITEM_'
    BROTLI_DECODER ## PREFIX ## NAME = CODE
    ^
<scratch space>:119:1: note: expanded from here
BROTLI_DECODER_ERROR_FORMAT_DICTIONARY
^
content_encoding.c:550:8: errorlibtool: compile:  cc -DHAVE_CONFIG_H -I../include -I../lib -I../lib -DBUILDING_LIBCURL -DCURL_HIDDEN_SYMBOLS -isystem /usr/local/include -isystem /usr/local/include -I/usr/local/include -I/usr/local/include/openssl -I/usr/local/include -I/usr/local/include -I/usr/local/include -fvisibility=hidden -O2 -pipe -march=amdfam10 -march=amdfam10 -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -Qunused-arguments -pthread -MT libcurl_la-http_digest.lo -MD -MP -MF .deps/libcurl_la-http_digest.Tpo -c http_digest.c  -fPIC -DPIC -o .libs/libcurl_la-http_digest.o

All non-curl dependent ports rebuild (including archivers/brotli).  Apache24 brotli option is set and it builds fine (and is shown as dependent on brotli by # pkg info -r

The fix in comment #2 solves the problem for me.  Thank you, takefu.
Comment 5 Peter Putzer 2017-12-05 19:52:08 UTC
I have the same problem and I assume this is all due to bug #223966. Since this conflict was apparently known beforehand, I'm a bit disappointed that the new port was published without providing a workaround.
Comment 6 commit-hook freebsd_committer 2017-12-07 16:53:17 UTC
A commit references this bug:

Author: sunpoet
Date: Thu Dec  7 16:53:06 UTC 2017
New revision: 455739
URL: https://svnweb.freebsd.org/changeset/ports/455739

Log:
  Disable brotli support to fix build with old brotli installed

  Brotli support will be added as an option after archivers/brotli being updated
  to a newer version.

  PR:             224072
  Reported by:    mi

Changes:
  head/ftp/curl/Makefile