I will try to provide you with a step-by-step guide for a RHEL 8 vanilla
installation. Please feel free to tweak according to your needs.

1) Make sure the required packages are installed:
$ *dnf install apr-devel openssl-devel java-11-openjdk-devel*

2) Fetch the tomcat-native from the official site
$ *wget
https://dlcdn.apache.org/tomcat/tomcat-connectors/native/1.3.1/source/tomcat-native-1.3.1-src.tar.gz
<https://dlcdn.apache.org/tomcat/tomcat-connectors/native/1.3.1/source/tomcat-native-1.3.1-src.tar.gz>*
(Optional but recommended: Compare the hashes found at
https://tomcat.apache.org/download-native.cgi)

3) Extract the compressed file and move to the native directory:
$ *tar -xvf tomcat-native-1.3.1-src.tar.gz && cd
tomcat-native-1.3.1-src/native/*

4) Run the configuration script:
$ *./configure --with-java-home=$(dirname $(dirname $(readlink $(readlink
$(which javac)))))*
(You can simply replace
`--with-java-home=/usr/lib/jvm/java-11-openjdk-11.0.25.0.9-2.el8.x86_64` .
The command above conveniently detects the relevant path.)

The logs will be something like the following:
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
Tomcat Native Version: 1.3.1
checking for chosen layout... tcnative
checking for APR... yes
configure: APR 1.6.3 detected.
  setting CC to "gcc"
  setting CPP to "gcc -E"
checking JAVA_HOME... /usr/lib/jvm/java-11-openjdk-11.0.25.0.9-2.el8.x86_64
  adding "-I/usr/lib/jvm/java-11-openjdk-11.0.25.0.9-2.el8.x86_64/include"
to TCNATIVE_PRIV_INCLUDES
checking for JDK os include directory...  linux
  adding
"-I/usr/lib/jvm/java-11-openjdk-11.0.25.0.9-2.el8.x86_64/include/linux" to
TCNATIVE_PRIV_INCLUDES
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for OpenSSL library... using openssl from /usr/lib64 and
/usr/include
checking OpenSSL library version >= 1.1.1... ok
checking for OpenSSL DSA support... yes
  setting TCNATIVE_LDFLAGS to "-lssl -lcrypto"
  adding "-DHAVE_OPENSSL" to CFLAGS
  setting TCNATIVE_LIBS to ""
  setting TCNATIVE_LIBS to " /usr/lib64/libapr-1.la  -lpthread -ldl"
  adding "-DTCNATIVE_LINUX" to CFLAGS
checking for apr_pollset_wakeup in -lapr-1... yes
  adding "-DHAVE_POLLSET_WAKEUP" to CFLAGS
configure: creating ./config.status
config.status: creating Makefile
config.status: executing default commands

You can tweak the configure script at your needs. By running `*./configure
--help*` you will see all the arguments that can be provided.

5) Build the libraries:
$ *make*
(There is a high probability that you'll face the following error on a rhel
machine : `gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such
file or directory` . This can be resolved by installing $ dnf install
redhat-rpm-config rpm-build . Rerun the make command)

6) Install the libraries:
$ *make install *

7) The default installation path is /usr/local/apr/lib/ (since we have not
provided a value to the --prefix argument of the configure script). By
listing the files, you should see the following:
$ *ls /usr/local/apr/lib/*
libtcnative-1.a  libtcnative-1.la  libtcnative-1.so  libtcnative-1.so.0
 libtcnative-1.so.0.3.1

I hope this clears it up for you.

Kind regards,
Dimitris

On Thu, Feb 6, 2025 at 2:39 AM Darryl Baker <darryl.ba...@northwestern.edu>
wrote:

> Trying to build 1.3.1 I did the fit manipulations as suggested (I know
> very little about git) and I get
> [root@evfediamdv1 tomcat-native-1.3.1-src]# ./jnirelease.sh -f
> --with-apr=/root/rpmbuild/SOURCES/apr-1.6.3 --ver=1.3.1
>
> Using apr source from: `/root/rpmbuild/SOURCES/apr-1.6.3'
> Using: /bin/elinks -dump -dump-width 80 -dump-charset iso-8859-1
> -no-numbering -no-references -no-home ...
> Using /bin/perl
> Using GIT repo       : `
> https://gitbox.apache.org/repos/asf/tomcat-native.git`
> <https://gitbox.apache.org/repos/asf/tomcat-native.git>
> Using version        : `1.3.1`
> HEAD is now at 0d6da8c122 Tag Tomcat Native 1.3.1
> Fetching tcjava
> WARNING: git subtree is not up to date with
>          https://gitbox.apache.org/repos/asf/tomcat.git
>          Either correct now by running
>          'git checkout 1.3.x'
>          'git rm -rf java/org/apache/tomcat/jni'
>          'git read-tree --prefix=java/org/apache/tomcat/jni/ -u
> tcjava/9.0.x:java/org/apache/tomcat/jni'
>          'git commit'
>          or run this script with -f (force)
> FORCED run chosen
> #define TCN_IS_DEV_VERSION      0
> Buildfile:
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/xdocs/build.xml
>
> build-prepare:
>     [mkdir] Created dir:
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/build
>     [mkdir] Created dir:
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/build/docs
>
> build-static:
>     [mkdir] Created dir:
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/build/docs/images
>      [copy] Copying 13 files to
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/build/docs/images
>      [xslt] Transforming into
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/build/docs/miscellaneous
>      [xslt] Processing
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/xdocs/miscellaneous/changelog.xml
> to
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/build/docs/miscellaneous/changelog.html
>      [xslt] Loading stylesheet
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/xdocs/style.xsl
>      [xslt] Processing
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/xdocs/miscellaneous/tls-renegotiation.xml
> to
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/build/docs/miscellaneous/tls-renegotiation.html
>      [xslt] Transforming into
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/build/docs/news
>      [xslt] Processing
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/xdocs/news/2024.xml
> to
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/build/docs/news/2024.html
>      [xslt] Loading stylesheet
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/xdocs/style.xsl
>
> build-main:
>      [xslt] Transforming into
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/build/docs
>      [xslt] Processing
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/xdocs/index.xml
> to
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/build/docs/index.html
>      [xslt] Loading stylesheet
> /usr/local/src/tomcat-native-1.3.1-src/tomcat-native-1.3.1-src/xdocs/style.xsl
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
>
> Looking for apr source in /root/rpmbuild/SOURCES/apr-1.6.3
> Creating configure ...
> Generating 'make' outputs ...
> Traceback (most recent call last):
>   File "/root/rpmbuild/SOURCES/apr-1.6.3/build/gen-build.py", line 230, in
> <module>
>     main()
>   File "/root/rpmbuild/SOURCES/apr-1.6.3/build/gen-build.py", line 47, in
> main
>     headers = get_files(parser.get('options', 'headers'))
>   File "/root/rpmbuild/SOURCES/apr-1.6.3/build/gen-build.py", line 223, in
> get_files
>     for pat in string.split(patterns):
> AttributeError: module 'string' has no attribute 'split'
> Creating build-outputs.mk failed
> [root@evfediamdv1 tomcat-native-1.3.1-src]#
>
> Darryl Baker, GSEC, GCLD (he/him/his)
> Sr. System Administrator
> Distributed Application Platform Services
> Northwestern University
> 4th Floor
> 2020 Ridge Avenue
> Evanston, IL 60208-0801
> darryl.ba...@northwestern.edu <mailto:darryl.ba...@northwestern.edu>
> (847) 467-6674 <tel:+18474676674>
>
>
>
>
> On 2/4/25, 5:00 PM, "Dimitris Soumis" <dsou...@apache.org <mailto:
> dsou...@apache.org>> wrote:
>
>
> The latest available APR devel package on RHEL 8 is version 1.6.3. (i.e
> apr-devel-1.6.3-12.el8.x86_64)
>
>
> If you attempt to build *tomcat-native 2.0.8*, you will encounter the
> following error:
>
>
> configure: error: Found APR 1.6.3. You need version 1.7.0 or newer
> > installed.
> >
>
>
> However, *tomcat-native 1.3.1* is compatible with APR 1.6.3 and should be
> built without issues.
>
>
> For tomcat-native 2.0.8, since the APR version provided by the distribution
> is obsolete, your only option would be to build a static version of APR
> 1.7.0 or later to meet the requirement.
>
>
> There is no tomcat-native package available for RHEL 8.
> Kind regards,
> Dimitris
>
>
> On Wed, Feb 5, 2025 at 12:27 AM Christopher Schultz <
> ch...@christopherschultz.net <mailto:ch...@christopherschultz.net>> wrote:
>
>
> > Darryl,
> >
> > On 2/3/25 1:17 PM, Darryl Baker wrote:
> > > Would someone please point me to the documentation on building
> > tomcat-native on RHEL 8 using the Red Hat supplied APR package?
> >
> > Do you need to build from source, or can you use the RHEL binary?
> >
> > $ sudo yum search tomcat-native
> > ===== Name Exactly Matched: tomcat-native =====
> > tomcat-native.x86_64 : Tomcat native library
> >
> > If you truly need to build, we can probably update the documentation to
> > indicate which popular packages would be necessary before building from
> > source.
> >
> > -chris
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org <mailto:
> users-unsubscr...@tomcat.apache.org>
> > For additional commands, e-mail: users-h...@tomcat.apache.org <mailto:
> users-h...@tomcat.apache.org>
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

Reply via email to