https://bz.apache.org/bugzilla/show_bug.cgi?id=62188

            Bug ID: 62188
           Summary: Link error for support/ab when --with-openssl is not
                    base OpenSSL
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: support
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Version: 2.4.32, 2.4.33

FreeBSD 11.1, 10.3
Base OpenSSL 1.0.2, Ports OpenSSL LibreSSL 2.6.4
Base LibreSSL 2.6.4, Ports OpenSSL 1.1.0

When building Apache httpd with non-default openssl libraries, linking fails:

> /usr/local/share/apr/build-1/libtool --silent --mode=link cc    -O2 
> -fno-strict-aliasing -pipe -march=native -DLIBICONV_PLUG -fstack-protector    
>   -Wl,-rpath,/usr/local/lib -fstack-protector -L/usr/lib -L/usr/local/lib -o 
> ab  ab.lo       -L/usr/local/lib -R/usr/local/lib -laprutil-1 -lexpat 
> -L/usr/local/lib -R/usr/local/lib -lapr-1 -lcrypt -lpthread -lm 
> -L/usr/local/lib -lssl -lcrypto -lcrypt -lpthread
> ab.o: In function `main':
> ab.c:(.text+0xb7f): undefined reference to `OPENSSL_init_ssl'
> ab.c:(.text+0xb88): undefined reference to `OPENSSL_init_ssl'
> ab.c:(.text+0xbd7): undefined reference to `SSL_CTX_set_options'
> ab.c:(.text+0x1258): undefined reference to `SSL_in_init'
> ab.o: In function `ssl_state_cb':
> ab.c:(.text+0x2632): undefined reference to `SSL_in_init'
> ab.c:(.text+0x263e): undefined reference to `SSL_is_server'
> ab.o: In function `ssl_proceed_handshake':
> ab.c:(.text+0x417e): undefined reference to `OPENSSL_sk_num'
> ab.c:(.text+0x4196): undefined reference to `OPENSSL_sk_value'
> ab.o: In function `ssl_print_cert_info':
> ab.c:(.text+0x5235): undefined reference to `X509_get_version'
> ab.c:(.text+0x525f): undefined reference to `X509_getm_notBefore'
> ab.c:(.text+0x5290): undefined reference to `X509_getm_notAfter'
> cc: error: linker command failed with exit code 1 (use -v to see invocation)

This is most likely caused by a difference of order of /usr and /usr/local in
CFLAGS and LDFLAGS. (Ports' headers/libs at compile time, Base headers/libs at
link time).

For the Apache 2.4.32 port I was preparing, I fixed this by moving
EXTRA_LDFLAGS to the end in build/rules.mk

> < ALL_LDFLAGS  = $(MOD_LDFLAGS) $(EXTRA_LDFLAGS) $(NOTEST_LDFLAGS) $(LDFLAGS)
> > ALL_LDFLAGS  = $(MOD_LDFLAGS) $(NOTEST_LDFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS)

Doesn't work for 2.4.33, will report back how I fix that.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to