Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: HOWTO: Building Apache and dependencies using CMake |
Page Previous 1, 2, 3, 4, 5, 6 |
| Author |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 432 Location: UK
|
Posted: Thu 12 Mar '26 22:46 Post subject: |
|
|
A number of things don't make sense here.
Firstly, to confirm, if I take the current (4.5) build_all.bat file, set API_BUILD_CCS_CES=ON and use the batch file as is, then I duly get all the CCS/CES files produced below C:\Apache24\bin\iconv. I presume you're using the current "CMakeLists - apr-iconv-1.2.2.txt" file downloaded from https://pastebin.com/axU1miF0.
Secondly, from the snippet of log you've posted, it's not clear why your build is not creating static apriconv-1.lib and shared libapriconv-1.lib, since these should be built by CMake BEFORE conditionally trying to build any CCS/CES files.
Your log starts at 0% with: | Code: | [ 0%] Building C object CMakeFiles/cp285.dir/ccs/cp285.c.obj
cp285.c |
whereas mine builds the apriconv libraries first (up to 3%), and then starts on the first CCS file adobe-stdenc.c
| Code: | ...
[ 3%] Building C object CMakeFiles/libapriconv.dir/lib/iconv_uc.c.obj
iconv_uc.c
[ 3%] Linking C shared library libapriconv-1.dll
[ 3%] Built target libapriconv
[ 3%] Building C object CMakeFiles/adobe-stdenc.dir/ccs/adobe-stdenc.c.obj
adobe-stdenc.c
[ 3%] Linking C shared library adobe-stdenc.so
[ 3%] Built target adobe-stdenc |
Thirdly, why is your first CCS file cp285.c, when the first source file in the CCS folder is abobe-stdenc.c? I count 196 C source files in that folder.
I also note you are placing your CMake build files below
-- Build files have been written to: C:/httpd/srclib/apr-iconv-1.2.2 whereas mine get placed here (package name with no version number details)
-- Build files have been written to: C:/Development/apache24/build/apr-iconv This rather suggests you've changed the BUILD_BASE and/or script logic, in which case I can't really advise further.
I like keeping the build files away from the source tree, but from what you've posted I can't decide if that's what you've done. |
|
| Back to top |
|
tanquang
Joined: 21 Mar 2020 Posts: 82 Location: Vietnam
|
Posted: Fri 13 Mar '26 14:33 Post subject: |
|
|
| tangent wrote: | A number of things don't make sense here.
Firstly, to confirm, if I take the current (4.5) build_all.bat file, set API_BUILD_CCS_CES=ON and use the batch file as is, then I duly get all the CCS/CES files produced below C:\Apache24\bin\iconv. I presume you're using the current "CMakeLists - apr-iconv-1.2.2.txt" file downloaded from https://pastebin.com/axU1miF0. |
Yes, I used the "CMakeLists - apr-iconv-1.2.2.txt" file downloaded from there.
| tangent wrote: | Secondly, from the snippet of log you've posted, it's not clear why your build is not creating static apriconv-1.lib and shared libapriconv-1.lib, since these should be built by CMake BEFORE conditionally trying to build any CCS/CES files.
Thirdly, why is your first CCS file cp285.c, when the first source file in the CCS folder is abobe-stdenc.c? I count 196 C source files in that folder.
I like keeping the build files away from the source tree, but from what you've posted I can't decide if that's what you've done.
|
It's true that there are some path differences; I moved all dependencies to Apache's "srclib" directory for Linux compatibility, but basically, apart from the paths, there are no differences in the command-line compilation.
This is the output when API_BUILD_CCS_CES=ON:
| Code: | ...
C:\httpd\srclib\apr-1.7.6>cd C:\httpd\srclib\apr-iconv-1.2.2
C:\httpd\srclib\apr-iconv-1.2.2>CMAKE -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=/phpStudy/Apache -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/phpStudy/Apache/lib -DAPI_BUILD_CCS_CES=OFF -DINSTALL_PDB=OFF
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.
-- The C compiler identification is MSVC 19.29.30159.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x86/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/httpd/srclib/apr-iconv-1.2.2
C:\httpd\srclib\apr-iconv-1.2.2>NMAKE
Microsoft (R) Program Maintenance Utility Version 14.29.30159.0
Copyright (C) Microsoft Corporation. All rights reserved.
[ 0%] Building C object CMakeFiles/cp285.dir/ccs/cp285.c.obj
cp285.c
NMAKE : fatal error U1073: don't know how to make 'libapriconv-1.lib'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\nmake.exe"' : return code
'0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\nmake.exe"' : return code
'0x2'
Stop. |
And this is the output when API_BUILD_CCS_CES=OFF (I deleted the apr-iconv folder that had previously failed to compile and then re-extracted the apr-iconv folder before compiling):
| Code: | ...
C:\httpd\srclib\apr-iconv-1.2.2>CMAKE -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=/phpStudy/Apache -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/phpStudy/Apache/lib -DAPI_BUILD_CCS_CES=OFF -DINSTALL_PDB=OFF
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.
-- The C compiler identification is MSVC 19.29.30159.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x86/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/httpd/srclib/apr-iconv-1.2.2
C:\httpd\srclib\apr-iconv-1.2.2>NMAKE
Microsoft (R) Program Maintenance Utility Version 14.29.30159.0
Copyright (C) Microsoft Corporation. All rights reserved.
[ 6%] Building C object CMakeFiles/apriconv.dir/lib/iconv.c.obj
iconv.c
[ 12%] Building C object CMakeFiles/apriconv.dir/lib/iconv_ces.c.obj
iconv_ces.c
[ 18%] Building C object CMakeFiles/apriconv.dir/lib/iconv_ces_euc.c.obj
iconv_ces_euc.c
[ 25%] Building C object CMakeFiles/apriconv.dir/lib/iconv_ces_iso2022.c.obj
iconv_ces_iso2022.c
[ 31%] Building C object CMakeFiles/apriconv.dir/lib/iconv_int.c.obj
iconv_int.c
[ 37%] Building C object CMakeFiles/apriconv.dir/lib/iconv_module.c.obj
iconv_module.c
[ 43%] Building C object CMakeFiles/apriconv.dir/lib/iconv_uc.c.obj
iconv_uc.c
[ 50%] Linking C static library apriconv-1.lib
[ 50%] Built target apriconv
[ 56%] Building C object CMakeFiles/libapriconv.dir/lib/iconv.c.obj
iconv.c
[ 62%] Building C object CMakeFiles/libapriconv.dir/lib/iconv_ces.c.obj
iconv_ces.c
[ 68%] Building C object CMakeFiles/libapriconv.dir/lib/iconv_ces_euc.c.obj
iconv_ces_euc.c
[ 75%] Building C object CMakeFiles/libapriconv.dir/lib/iconv_ces_iso2022.c.obj
iconv_ces_iso2022.c
[ 81%] Building C object CMakeFiles/libapriconv.dir/lib/iconv_int.c.obj
iconv_int.c
[ 87%] Building C object CMakeFiles/libapriconv.dir/lib/iconv_module.c.obj
iconv_module.c
[ 93%] Building C object CMakeFiles/libapriconv.dir/lib/iconv_uc.c.obj
iconv_uc.c
[100%] Linking C shared library libapriconv-1.dll
[100%] Built target libapriconv
C:\httpd\srclib\apr-iconv-1.2.2>NMAKE INSTALL
Microsoft (R) Program Maintenance Utility Version 14.29.30159.0
Copyright (C) Microsoft Corporation. All rights reserved.
Consolidate compiler generated dependencies of target apriconv
[ 50%] Built target apriconv
Consolidate compiler generated dependencies of target libapriconv
[100%] Built target libapriconv
Install the project...
-- Install configuration: "Release"
-- Installing: /phpStudy/Apache/lib/apriconv-1.lib
-- Installing: /phpStudy/Apache/lib/libapriconv-1.lib
-- Installing: /phpStudy/Apache/bin/libapriconv-1.dll
-- Installing: /phpStudy/Apache/include/api_version.h
-- Installing: /phpStudy/Apache/include/apr_iconv.h |
The version of cmake I'm using is installed directly through the C++ CMake tools for Windows individual component of the Visual Studio Installer:
| Code: | C:\httpd\srclib\apr-iconv-1.2.2>cmake --version
cmake version 3.20.21032501-MSVC_2
CMake suite maintained and supported by Kitware (kitware.com/cmake). |
The compilation command line is different except for the value of API_BUILD_CCS_CES; ON will cause an error, OFF will not. |
|
| Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 432 Location: UK
|
Posted: Fri 13 Mar '26 18:29 Post subject: |
|
|
I've been looking at your follow-up post details, and run your build commands locally, and can't reproduce the effect your seeing.
As mentioned before, for me things build as expected on both VS2026 and VS2022, but suffice to say your final comment reveals your running an older version of CMake; the one that comes with Visual Studio 2019, and I suspect that's the issue here.
| Code: | C:\httpd\srclib\apr-iconv-1.2.2>cmake --version
cmake version 3.20.21032501-MSVC_2 |
My VS18 CMake is currently at V3.29.2, and VS17 CMake at V3.31.6
Looking at file "CMakeLists - apr-iconv-1.2.2.txt", the code to add the APR-ICONV libraries comes before the conditional block to build the CCS/CES files; yet with your CMake it appears to try and build the CCS/CES files first.
| Code: | IF(API_BUILD_CCS_CES)
# Define additional libraries for linking CCS/CES modules
#
SET(API_LIBRARIES ${CMAKE_BINARY_DIR}/libapriconv-1.lib)
# Define list of CCS source files.
#
FILE(GLOB APICONV_CCS_SOURCES ccs/*.c)
FOREACH(CCS_NAME ${APICONV_CCS_SOURCES})
# Define module name
#
STRING(REGEX REPLACE ".*/([^\\+]+).c" "\\1" MOD_NAME ${CCS_NAME})
ADD_LIBRARY(${MOD_NAME} SHARED ${CCS_NAME})
SET(INSTALL_CCS ${INSTALL_CCS} ${CMAKE_BINARY_DIR}/${MOD_NAME}.so)
TARGET_LINK_LIBRARIES(${MOD_NAME} ${APR_LIBRARIES} ${API_LIBRARIES} ${EXTRA_LIBRARIES})
SET_TARGET_PROPERTIES(${MOD_NAME} PROPERTIES OUTPUT_NAME ${MOD_NAME})
SET_TARGET_PROPERTIES(${MOD_NAME} PROPERTIES SUFFIX .so)
SET_TARGET_PROPERTIES(${MOD_NAME} PROPERTIES COMPILE_FLAGS "-DNDEBUG -DWIN32 -D_WINDOWS")
ENDFOREACH()
|
Note the TARGET_LINK_LIBRARIES() dependency includes ${API_LIBRARIES}, which should be built beforehand.
However, CMake schedules targets and their build order based on a dependency tree it deduces at configure time, and I suspect the later versions of CMake include improvements in how they resolve target link dependencies.
I don't have access to this older version of CMake, so could I suggest you change the following lines in your CMakeLists.txt file (two of them), and let me know if that solves the problem.
Change
TARGET_LINK_LIBRARIES(${MOD_NAME} ${APR_LIBRARIES} ${API_LIBRARIES} ${EXTRA_LIBRARIES})
to
TARGET_LINK_LIBRARIES(${MOD_NAME} libapriconv ${APR_LIBRARIES} ${EXTRA_LIBRARIES}) If that works, I'll update the Pastebin "CMakeLists - apr-iconv-1.2.2.txt" file accordingly.
Re your CCS/CES files starting with cp285.c rather than abobe-stdenc.c; could there be some difference in the older version of the CMake FILE(GLOB) command that builds the list of CCS/CES files to compile, whereby the returned list isn't pre-sorted? Just a guess. |
|
| Back to top |
|
tanquang
Joined: 21 Mar 2020 Posts: 82 Location: Vietnam
|
Posted: Fri 13 Mar '26 20:05 Post subject: |
|
|
| tangent wrote: | Change
TARGET_LINK_LIBRARIES(${MOD_NAME} ${APR_LIBRARIES} ${API_LIBRARIES} ${EXTRA_LIBRARIES})
to
TARGET_LINK_LIBRARIES(${MOD_NAME} libapriconv ${APR_LIBRARIES} ${EXTRA_LIBRARIES})
If that works, I'll update the Pastebin "CMakeLists - apr-iconv-1.2.2.txt" file accordingly.
|
That's exactly the problem here, I fixed it as you said:
| Code: | ...
FOREACH(CCS_NAME ${APICONV_CCS_SOURCES})
...
TARGET_LINK_LIBRARIES(${MOD_NAME} libapriconv ${APR_LIBRARIES} ${EXTRA_LIBRARIES})
...
ENDFOREACH()
...
FOREACH(CES_NAME ${APICONV_CES_SOURCES})
...
TARGET_LINK_LIBRARIES(${MOD_NAME} libapriconv ${APR_LIBRARIES} ${EXTRA_LIBRARIES})
...
ENDFOREACH() |
It fixed the error and built apr-iconv + CCS/CES.
Here's a comparison of the differences between the two CMakeLists.txt files (before and after modification): https://www.diffchecker.com/Uo37EO3e/ |
|
| Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 432 Location: UK
|
Posted: Fri 13 Mar '26 21:03 Post subject: |
|
|
Glad that fixed your problem.
Pastebin "CMakeLists - apr-iconv-1.2.2.txt" file updated. |
|
| Back to top |
|
|
|
|
|
|