0

在交叉构建 apache2 2.4.12 时,我在编译期间收到以下错误:

    ptxdist/platform/build-target/httpd-2.4.12/modules/mappers  -prefer-non-pic -static -c exports.c && touch exports.lo
    exports.c:4117:55: error: 'apr_hash_this_key' undeclared here (not in a function)
    exports.c:4121:59: error: 'apr_hash_this_key_len' undeclared here (not in a function)
    exports.c:4125:55: error: 'apr_hash_this_val' undeclared here (not in a function)
    exports.c:4568:62: error: 'apr_sockaddr_is_wildcard' undeclared here (not in a function)
    exports.c:5307:55: error: 'apr_shm_create_ex' undeclared here (not in a function)
    exports.c:5323:55: error: 'apr_shm_attach_ex' undeclared here (not in a function)

似乎有一个肮脏的黑客在编译期间从文件 make_exports.awk 生成 httpd-2.4.12/server/exports.c

如何调整这个 make_exports.awk 文件以获得适用于 arm 的交叉构建?

4

1 回答 1

0

解决方案是为 apr-1.5.1 创建一个补丁,禁用 apr_hash_this_key、apr_hash_this_key_len 等。然后重新编译apr、apr-util和apache 2.4.12。

diff -rupN AY/include/apr_hash.h AZ/include/apr_hash.h
--- AY/include/apr_hash.h   2015-02-27 10:35:07.436548295 +0100
+++ AZ/include/apr_hash.h   2015-02-27 10:33:30.038497258 +0100
@@ -171,21 +171,21 @@ APR_DECLARE(void) apr_hash_this(apr_hash
  * @param hi The iteration state
  * @return The pointer to the key
  */
-APR_DECLARE(const void*) apr_hash_this_key(apr_hash_index_t *hi);
+//APR_DECLARE(const void*) apr_hash_this_key(apr_hash_index_t *hi);

 /**
  * Get the current entry's key length from the iteration state.
  * @param hi The iteration state
  * @return The key length
  */
-APR_DECLARE(apr_ssize_t) apr_hash_this_key_len(apr_hash_index_t *hi);
+//APR_DECLARE(apr_ssize_t) apr_hash_this_key_len(apr_hash_index_t *hi);

 /**
  * Get the current entry's value from the iteration state.
  * @param hi The iteration state
  * @return The pointer to the value
  */
-APR_DECLARE(void*) apr_hash_this_val(apr_hash_index_t *hi);
+//APR_DECLARE(void*) apr_hash_this_val(apr_hash_index_t *hi);

 /**
  * Get the number of key/value pairs in the hash table.
diff -rupN AY/include/apr_network_io.h AZ/include/apr_network_io.h
--- AY/include/apr_network_io.h 2013-12-06 18:10:34.000000000 +0100
+++ AZ/include/apr_network_io.h 2015-02-27 11:50:10.847966181 +0100
@@ -730,7 +730,7 @@ APR_DECLARE(int) apr_sockaddr_equal(cons
  * @remark The return value will be non-zero if the address is
  * initialized and is the wildcard address.
  */
-APR_DECLARE(int) apr_sockaddr_is_wildcard(const apr_sockaddr_t *addr);
+//APR_DECLARE(int) apr_sockaddr_is_wildcard(const apr_sockaddr_t *addr);

 /**
 * Return the type of the socket.
diff -rupN AY/include/apr_shm.h AZ/include/apr_shm.h
--- AY/include/apr_shm.h    2015-02-27 12:00:01.119541200 +0100
+++ AZ/include/apr_shm.h    2015-02-27 12:02:01.294089137 +0100
@@ -111,12 +111,12 @@ APR_DECLARE(apr_status_t) apr_shm_create
  *         function will return the first usable byte of memory.
  * 
  */
-APR_DECLARE(apr_status_t) apr_shm_create_ex(apr_shm_t **m,
+/*APR_DECLARE(apr_status_t) apr_shm_create_ex(apr_shm_t **m,
                                             apr_size_t reqsize,
                                             const char *filename,
                                             apr_pool_t *pool,
                                             apr_int32_t flags);
-
+*/
 /**
  * Remove named resource associated with a shared memory segment,
  * preventing attachments to the resource, but not destroying it.
@@ -164,11 +164,11 @@ APR_DECLARE(apr_status_t) apr_shm_attach
  *        structure for this process.
  * @param flags mask of APR_SHM_* (defined above)
  */
-APR_DECLARE(apr_status_t) apr_shm_attach_ex(apr_shm_t **m,
+/*APR_DECLARE(apr_status_t) apr_shm_attach_ex(apr_shm_t **m,
                                             const char *filename,
                                             apr_pool_t *pool,
                                             apr_int32_t flags);
-
+*/
 /**
  * Detach from a shared memory segment without destroying it.
  * @param m The shared memory structure representing the segment
diff -rupN AY/Makefile.in AZ/Makefile.in
--- AY/Makefile.in  2015-02-27 10:17:32.817392979 +0100
+++ AZ/Makefile.in  2015-02-27 10:17:44.075619396 +0100
@@ -113,7 +113,7 @@ apr.exp: exports.c export_vars.c
    @echo "#! lib@APR_LIBNAME@.so" > $@
    @echo "* This file was AUTOGENERATED at build time." >> $@
    @echo "* Please do not edit by hand." >> $@
-   $(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$$/\1/' >> $@
+   #$(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$$/\1/' >> $@
    $(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$$/d' >> $@

 dox:
于 2015-03-02T15:16:56.650 回答