amazonlinux / amazon-linux-2023

Amazon Linux 2023
https://aws.amazon.com/linux/amazon-linux-2023/
Other
535 stars 40 forks source link

[Bug] - Not able to build mod_jk module in the container using amazonlinux:2023 docker image #333

Open hyryo513 opened 1 year ago

hyryo513 commented 1 year ago

Describe the bug Trying to build mod_jk module for apache http server running in container using the latest amazonlinux:2023 docker image but running into error.

To Reproduce Run below commands following the instructions documented here - https://tomcat.apache.org/connectors-doc/webserver_howto/apache.html

docker run -it amazonlinux:latest /bin/bash yum -y install tar wget gcc make httpd-devel wget https://dlcdn.apache.org/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.48-src.tar.gz tar -xzf tomcat-connectors-1.2.48-src.tar.gz cd tomcat-connectors-1.2.48-src/native/ LDFLAGS=-lc ./configure -with-apxs=/usr/bin/apxs make

Expected behavior mod_jk.so binary should be created in /tomcat-connectors-1.2.48-src/native/apache-2.0

Screenshots

al2023_mod_jk_error

Additional context This is working with amazonlinux:2 docker image

ozbenh commented 1 year ago

So what seems to be happening is that the Makefile uses the output of apxs -q LDLFAGS to pass to libtool:

$ apxs -q LDFLAGS
-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1

Now while these are fine if passed to gcc, it's more complicated via libtool. The latter tries to strip the -Wl, components and passes the gcc-only -spec= directly down which is wrong. Arguably it's a libtool issue but ...

That said, on RHEL9:

$ apxs -q LDFLAGS
-Wl,-z,relro,-z,now

(and on AL2 as well), so there's something going on with how apxs is generated. We will dig into this

ozbenh commented 1 year ago

Fedora 38 has the same issue:

[fedora ~]$ apxs -q LDFLAGS
-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1

(which results in a similar albeit not completely identical error on f38)