Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
140 views
in Technique[技术] by (71.8m points)

linux - Why are there some warnings when cross compiling Apache (httpd-2.4.46)?

When I cross-compile httpd-2.4.46, follow this link and fix this issue1 and issue2 and issue3, then configure and compile.

Note: my system is Debian.

Step 1: install apr

cd apr-1.6.5/
./configure CC=aarch64-linux-gnu-gcc
make
make clean

Step 2: install expat

cd expat-2.2.6
./configure CC=aarch64-linux-gnu-gcc
make
make install

Step 3: install apr-util

cd apr-util-1.6.1/
./configure --with-apr=/usr/local/apr  CC=aarch64-linux-gnu-gcc
make
make clean

Step 4: install httpd

cd httpd-2.4.46/
./configure --prefix=/usr/local/apache CC=aarch64-linux-gnu-gcc  --with-apr=/usr/local/apr   --enable-so
make
make install

Step 5: run httpd

cd /usr/local/apache/bin/
./apachectl -k start

An error occurred,

httpd: Syntax error on line 66 of /usr/local/apache/conf/httpd.conf:
Cannot load modules/mod_authn_file.so into server:
/usr/local/apache/modules/mod_authn_file.so: cannot open shared object
file: No such file or directory

Step 6: find *.so

find / -name "mod_authn_file*"
/usr/local/apache/modules/mod_authn_file.a
/usr/local/apache/modules/mod_authn_file.la
/usr/local/apache/manual/mod/mod_authn_file.html.ja.utf8
/usr/local/apache/manual/mod/mod_authn_file.html
/usr/local/apache/manual/mod/mod_authn_file.html.ko.euc-kr
/usr/local/apache/manual/mod/mod_authn_file.html.en
/usr/local/apache/manual/mod/mod_authn_file.html.fr.utf8
/data/httpd-2.4.46/docs/manual/mod/mod_authn_file.html.ja.utf8
/data/httpd-2.4.46/docs/manual/mod/mod_authn_file.html
/data/httpd-2.4.46/docs/manual/mod/mod_authn_file.html.ko.euc-kr
/data/httpd-2.4.46/docs/manual/mod/mod_authn_file.html.en
/data/httpd-2.4.46/docs/manual/mod/mod_authn_file.html.fr.utf8
/data/httpd-2.4.46/modules/aaa/mod_authn_file.dsp
/data/httpd-2.4.46/modules/aaa/mod_authn_file.c
/data/httpd-2.4.46/modules/aaa/mod_authn_file.lo
/data/httpd-2.4.46/modules/aaa/mod_authn_file.mak
/data/httpd-2.4.46/modules/aaa/mod_authn_file.slo
/data/httpd-2.4.46/modules/aaa/mod_authn_file.la
/data/httpd-2.4.46/modules/aaa/mod_authn_file.o
/data/httpd-2.4.46/modules/aaa/mod_authn_file.dep
/data/httpd-2.4.46/modules/aaa/.libs/mod_authn_file.a
/data/httpd-2.4.46/modules/aaa/.libs/mod_authn_file.la
/data/httpd-2.4.46/modules/aaa/.libs/mod_authn_file.lai
/data/httpd-trunk/docs/manual/mod/mod_authn_file.html.ja.utf8
/data/httpd-trunk/docs/manual/mod/mod_authn_file.xml
/data/httpd-trunk/docs/manual/mod/mod_authn_file.html
/data/httpd-trunk/docs/manual/mod/mod_authn_file.html.en.utf8
/data/httpd-trunk/docs/manual/mod/mod_authn_file.xml.ja
/data/httpd-trunk/docs/manual/mod/mod_authn_file.html.ko.euc-kr
/data/httpd-trunk/docs/manual/mod/mod_authn_file.xml.meta
/data/httpd-trunk/docs/manual/mod/mod_authn_file.xml.fr
/data/httpd-trunk/docs/manual/mod/mod_authn_file.xml.ko
/data/httpd-trunk/docs/manual/mod/mod_authn_file.html.fr.utf8
/data/httpd-trunk/modules/aaa/mod_authn_file.dsp
/data/httpd-trunk/modules/aaa/mod_authn_file.c

Step 7: cat /usr/local/apache/conf/httpd.conf

#
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/access_log"
# with ServerRoot set to "/usr/local/apache2" will be interpreted by the
# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log"
# will be interpreted as '/logs/access_log'.

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used.  If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "/usr/local/apache"

#
# Mutex: Allows you to set the mutex mechanism and mutex file directory
# for individual mutexes, or change the global defaults
#
# Uncomment and change the directory if mutexes are file-based and the default
# mutex file directory is not on a local disk or is not appropriate for some
# other reason.
#
# Mutex default:logs

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_socache_module modules/mod_authn_socache.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
#LoadModule authz_dbd_module modules/mod_authz_dbd.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_form_module modules/mod_auth_form.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule allowmethods_module modules/mod_allowmethods.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule cache_disk_module modules/mod_cache_disk.so
#LoadModule cache_socache_module modules/mod_cache_socache.so
#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
#LoadModule socache_dbm_module modules/mod_socache_dbm.so
#LoadModule socache_memcache_module modules/mod_socache_memcache.so
#LoadModule socache_redis_module modules/mod_socache_redis.so
#LoadModule watchdog_module modules/mod_watchdog.so
#LoadModule macro_module modules/mod_macro.so
#LoadModule dbd_module modules/mod_dbd.so
#LoadModule dumpio_module modules/mod_dumpio.so
#LoadModule buffer_module modules/mod_buffer.so
#LoadModule ratelimit_module modules/mod_ratelimit.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule request_module modules/mod_request.so
#LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
#LoadModule substitute_module modules/mod_substitute.so
#LoadModule sed_module modules/mod_sed.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_debug_module modules/mod_log_debug.so
#LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
#LoadModule remoteip_module modules/mod_remoteip.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
#LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so
#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_express_module modules/mod_proxy_express.so
#LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so
#LoadModule session_module modules/mod_session.so
#LoadModule session_cookie_module modules/mod_session_cookie.so
#LoadModule session_dbd_module modules/mod_session_dbd.so
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
#LoadModule ssl_module modules/mod_ssl.so
#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
LoadModule unixd_module modules/mod_unixd.so
#LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule info_module modules/mod_info.so
#LoadModule cgid_module modules/mod_cgid.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
#LoadModule actions_module modules/mod_actions.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
#LoadModule rewrite_module modules/mod_rewrite.so

<IfModule unixd_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon

</IfModule>

# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear in

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Take a backup before doing this. I am not responsible for data loss. Please read the tutorial carefully.

First, try to take a backup and remove all the files in /usr/local/apache if possible.

First try with the following command:

make clean && ./configure --prefix=/usr/local/apache --enable-mods-shared="reallyall" --enable-mpms-shared="all" --with-apr=/usr/local/apr

And then try to load that module.

If not working, then do the following.

Try the following to commands to configure apache:

To be clean, follow the same steps:

  1. Go to http://httpd.apache.org/download.cgi
  2. Right click and copy the link of the link like 'Source: httpd-2.4.46.tar.gz'
  3. Go to the terminal, and enter the following commands one by one and hit enter for no confusion:

a.

cd /usr/local/src

b.

sudo wget -O- <download-link> | tar -zxf -

c.

sudo apt install libnghttp2 libpcre3 libssl build-essential -y

d. Go to http://apr.apache.org/download.cgi and copy the link like 'Unix Source: apr-1.7.0.tar.gz'

sudo wget -O- <apr-download-link> | tar -zxf -

e. Go to http://apr.apache.org/download.cgi and copy the link like 'Unix Source: apr-util-1.6.1.tar.gz'

sudo wget -O- <apr-util-download-link> | tar -zxf -

f.

sudo mv apr-<apr-version> httpd-<apache-version>/srclib/apr

g.

sudo mv apr-util-<apr-util-version> httpd-<apache-version>/srclib/apr-util

h.

cd httpd-<apache-version>

i. According to me, this configuration is better than any other. The --prefix is where apache is installed.

sudo ./configure --prefix=/usr/local/apache --enable-mods-shared="reallyall" --enable-mpms-shared="all"

j.

sudo make

k.

sudo make install



These directories could be altered using the Step 'i'
The apache directory is /usr/local/apache.
The apache conf directory is /usr/local/apache/conf.
The apache main conf file is /usr/local/apache/conf/httpd.conf.
For more info go to http://httpd.apache.org/docs/current/install.html and https://httpd.apache.org/docs/2.4/programs/configure.html.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...