简体   繁体   中英

Building Apache log4cxx with CMake

I am trying build Apache log4cxx 0.13.0 for mingw in windows platform

  1. I builder and installed apr and apr-util using MSYS2
  2. I downloaded log4cxx source from apache repository

but when configuring with CMake it shows this error:

CMake Error at src/cmake/FindAPR.cmake:17 (message):
apr-1-config --includedir failed with result %1 is not a valid Win32
application
Call Stack (most recent call first):
src/cmake/FindAPR.cmake:35 (_apr_invoke)
CMakeLists.txt:44 (find_package)

CMakeOutput.log

在此处输入图像描述

apu-1-config of the apr-util package is actually a *nix shell script.

CMake is trying to run apr-1-config directly but of course Windows has no clue how to execute it.

The solution is execute sh.exe with apr-1-config (and its arguments) as argument(s).

The following patch fixes this issue for me:

patch -ulbf src/cmake/FindAPR.cmake << EOF
@@ -10,3 +10,3 @@
     execute_process(
-        COMMAND \${APR_CONFIG_EXECUTABLE} \${ARGN}
+        COMMAND sh \${APR_CONFIG_EXECUTABLE} \${ARGN}
         OUTPUT_VARIABLE _apr_output
EOF
patch -ulbf src/cmake/FindAPR-Util.cmake << EOF
@@ -11,3 +11,3 @@
     execute_process(
-        COMMAND \${APR_UTIL_CONFIG_EXECUTABLE} \${ARGN}
+        COMMAND sh \${APR_UTIL_CONFIG_EXECUTABLE} \${ARGN}
         OUTPUT_VARIABLE _apr_output
EOF

I have updated my winlibs build script (which is mostly MSYS2 shell commands) so it now builds the most recent Apache Log4cxx 0.13.0. Besides this issue I had to add a few more workarounds though...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM