Apache Lounge


About Forum Index Downloads Search Register Log in RSS X

Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.



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.
Post new topic   Forum Index -> Building & Member Downloads View previous topic :: View next topic
Reply to topic   Topic: Compiling httpd + libapr-2 failed on Windows

Joined: 20 Dec 2016
Posts: 198
Location: Lille, FR, EU

PostPosted: Thu 16 May '24 11:07    Post subject: Compiling httpd + libapr-2 failed on Windows Reply with quote

I currently try to compile httpd with libapr-2 (trunk) "for fun"
Itís seeming to be able to be done (see https://github.com/apache/httpd/blob/trunk/CMakeLists.txt#L35) but Iím facing some issues:

1. Compiling apr trunk with CMake (shared):
- I had to patch CMakeLists.txt to add mysql dbd support
- With APR_MODULAR_DSO=ON, APR_MODULE_DECLARE_DATA not seems to be set with __declspec(dllexport) (for apr_dbd_sqlite3 & apr_dbd_mysql) - working fine with APR_MODULAR_DSO=OFF
- LDAP support (with CMakeLists.txt to patched too) failed with many missing imports

Finally I can have a working release of libapr-2 with this config

-DMYSQL_LIBRARY=%PATH_MYSQL:\=/%/lib/mysqlclient.lib ^

2. Compiling httpd with libapr-2 (without ldap support...)
-- APR_HAS_LDAP ............. : FALSE
-- APR_HAS_XLATE ............ : TRUE
-- APU_HAVE_CRYPTO .......... : TRUE
--   APR include directory ........... : C:/sdk/release/vs17_x64-avx2/include/apr-2
--   APR libraries ................... : C:/sdk/release/vs17_x64-avx2/lib/libapr-2.lib

I have breaking errors 'IF_WIN_OS_IS_UNICODE': undeclared identifier
And effectively, IF_WIN_OS_IS_UNICODE had disappeared from arch/win32/apr_arch_misc.h (see https://github.com/apache/apr/blob/1.8.x/include/arch/win32/apr_arch_misc.h#L140)

Is it known that libapr-2 is not supported with https on windows?
Have someone tried to do it with success?

Back to top

Joined: 16 Aug 2020
Posts: 326
Location: UK

PostPosted: Sun 09 Jun '24 20:53    Post subject: Reply with quote

I've been tied up lately, so not been able to pick up on your interesting post over building libapr-2 with CMake. At some point this will be directly relevant to the Apache build with CMake How-To script I put together some years ago.

Having built libapr-2 with CMake using the apr-trunk as you did, I forsee problems ahead.

The build evidently checks for a number of support packages, viz:

-- The C compiler identification is MSVC 19.40.33811.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found EXPAT: C:/Apache24/lib/libexpat.lib (found version "2.2.6")
-- Found LibXml2: C:/Apache24/lib/libxml2.lib (found version "2.9.9")             *** => was actually 2.12.7
-- Found OpenSSL: C:/Apache24/lib/libcrypto.lib (found version "3.1.6") 
-- Could NOT find Iconv (missing: Iconv_LIBRARY Iconv_INCLUDE_DIR)
-- Could NOT find SQLite3 (missing: SQLite3_INCLUDE_DIR SQLite3_LIBRARY)

The lack of Iconv is a problem, since the official libiconv package is GNU based and doesn't currently support building with CMake. That's why to date I've stuck with the old apr-iconv package with nmake.

There are a number of GIT forks of libiconv out there, where people have crafted a CMakeLists.txt file, but they're several revisions down from the latest libiconv package at release 1.17 (2022).

Even if we can find/craft a suitable CMakeLists.txt file, I'm equally not sure where we stand LGPL license wise.

I'd want to crack this libiconv issue before trying to refine the overall HTTPD build script further.
Back to top

Joined: 20 Dec 2016
Posts: 198
Location: Lille, FR, EU

PostPosted: Wed 12 Jun '24 15:12    Post subject: Reply with quote

Thx @tangent for your feedback!
I see that we are more or less at the same point...

Regarding libiconv, I use https://github.com/pffang/libiconv-for-Windows with MSBuild (gnu version iso src, with additional includes - probably coming from a MinGW ./configure)

Not CMake but the release remains fully compatible with the build chain
I can release an apr-2 binary with libiconv support but, as mentioned above, other problems are blocking its integration with httpd.
-- APR configuration summary:
--   Build type ...................... : RelWithDebInfo
--   Install .pdb (if available)...... : ON
--   Install prefix .................. : C:/sdk/release/vs17_x64-avx2
--     Directory for binary files .... : PREFIX/bin
--     Directory for library files ... : PREFIX/lib
--     Directory for include files ... : PREFIX/include/apr-2
--   C compiler ...................... : C:/sdk/softs/vs22/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe
--   IPv6 ............................ : ON
--   DBD ODBC driver ................. : ON
--   DBD SQLite3 driver .............. : ON
--   DBD MySQL driver ................ : ON
--   Use Expat ....................... : OFF
--   Use LibXml2 ..................... : ON
--   Use XmlLite ..................... : OFF
--   Have Crypto ..................... : ON
--   Have Iconv ...................... : ON
--   Library files for XML ........... : C:/sdk/release/vs17_x64-avx2/lib/libxml2.lib
--   DSO build of modular components.. : OFF
--   Turn on pools debugging ..........: OFF
--   Build shared libs ............... : ON
--   Build static libs ............... : OFF
--   Build test suite ................ : OFF
--     (testing dynamic libraries)
--   Install private .h for httpd .... : ON
-- Configuring done (3.1s)

Regarding this, I give up for the moment and will probably come back to dig when everything will be drier (or if you have some point for me to dig Wink)
Back to top

Joined: 09 Mar 2012
Posts: 1258
Location: Amsterdam, NL, EU

PostPosted: Wed 12 Jun '24 15:51    Post subject: Reply with quote

Regarding libiconv: clone https://github.com/winlibs/libiconv
And run this in the MSVC16 dir:
msbuild libiconv.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64
Back to top

Joined: 16 Aug 2020
Posts: 326
Location: UK

PostPosted: Wed 12 Jun '24 21:11    Post subject: Reply with quote

Thanks both for the feedback over libiconv. Much appreciated.

I've spent some time on this too, and since my challenge is to stick with CMake, had landed on the following site: https://github.com/vovythevov/libiconv-cmake

This provided a well structured CMakeLists.txt file as a starting point, albeit for libiconv 1.14, and have since managed to update this to build the latest release 1.17.

I've tried extending this to build iconv.exe, but accepted this relies on a GNU build environment rather than MSVC, so have for now given up. It's not essential, so when I recover I'll try using this libiconv variant to progress building with APR-2.

@nono303 - I notice you've chosen libxml2 over expat for XML support (APR-2 requires you to choose one or the other).

Extract from APR-2 CMakeLists.txt
  MESSAGE(FATAL_ERROR "Only one of Expat and LibXml2 can be selected")

What was the reason you chose libxml2?
Back to top

Joined: 20 Dec 2016
Posts: 198
Location: Lille, FR, EU

PostPosted: Thu 13 Jun '24 9:52    Post subject: Reply with quote

Hi @tangent,

Was looking at CMake libiconv and found https://github.com/AiMiDi/libiconv_cmake which works fine for on 1.17 (and seems to be active).
I'll stick on it.
Just have issued to apply these 2 patches:
What was the reason you chose libxml2?

Good question!Iím clearly not an expert on that and if there are good reasons to use expat instead of libxml2, Iíll switch eyes closed 😉
Back to top
James Blond

Joined: 19 Jan 2006
Posts: 7321
Location: Germany, Next to Hamburg

PostPosted: Mon 17 Jun '24 11:13    Post subject: Reply with quote

Expat is part of apr-util. One of the reasons was mod_proxy_html. At first, it was a standalone project[1] but got integrated into the httpd Apache project. And for that module, you need an XML DOM parser. Expat lags that.

About libiconv, I wonder since Apache has its version[2]

[1] http://apache.webthing.com/mod_proxy_html/
[2] https://apr.apache.org/download.cgi
Back to top

Joined: 16 Aug 2020
Posts: 326
Location: UK

PostPosted: Mon 17 Jun '24 20:48    Post subject: Reply with quote

Hi @nono303,

Re libiconv, despite several attempts I failed to build the variant at https://github.com/AiMiDi/libiconv_cmake, and accepting their CMakeLists.txt file is somewhat complicated, ended up revising the simpler CMakeLists.txt file that came with https://github.com/vovythevov/libiconv-cmake (still at release 1.14).

The variant I have builds the official libiconv-1.17 source release at https://ftp.gnu.org/gnu/libiconv, albeit without iconv.exe (am sticking to MSVC rather than a GNU build environment). However, the libraries are all we need for building APR-2 and then in turn HTTPD.

APR-2 then duly built, though I haven't tried to add dbd or sqlite3 as yet.

Concerning item 2 in your original post, compiling HTTPD with libapr-2, I've managed to reproduce the results you got, namely it failed with 'IF_WIN_OS_IS_UNICODE': undeclared identifier. And yes, if you compare apr_arch_misc.h with the variant in apr-1.7.4, it's clear this definition along with a block of related logic has been removed.

So, as it stands, it would appear HTTPD won't build with APR-2 on Windows.

I'm no developer, and so don't feel able to post anything back to the APR contributors on this, but am surprised this issue hasn't been spotted and addressed aleady.
Back to top

Joined: 15 Oct 2005
Posts: 3059
Location: Hilversum, NL, EU

PostPosted: Tue 18 Jun '24 8:56    Post subject: Reply with quote

Is apr_crypto_openssl-1.dll building ?
Back to top

Joined: 20 Dec 2016
Posts: 198
Location: Lille, FR, EU

PostPosted: Tue 18 Jun '24 12:15    Post subject: Reply with quote


@tangent, concerning libiconv:
1. https://github.com/AiMiDi/libiconv_cmake works fine for me building libcharset.dll & libiconv.dll
- The two patch I issued ( https://github.com/AiMiDi/libiconv_cmake/issues?q=is%3Aissue+author%3Anono303 ) were merged at current HEAD ( https://github.com/AiMiDi/libiconv_cmake/commit/efdd10399dc49b047e6a50631e0358474a448288 )
2. for /libiconv submodule (src) you must checkout branch [fix-C2016](https://github.com/AiMiDi/libiconv/tree/fix-C2016) for MSVC build _(see https://github.com/AiMiDi/libiconv/issues/1)_

@steffen, compiling apr2 :
1. apr_crypto_openssl is building (named apr_crypto_openssl-2.dll) when DSO=ON
2. but if DSO=ON, I canít build apr_dbd_sqlite3-2 and apr_dbd_mysql_driver with:
LNK2001: unresolved external symbol apr_dbd_sqlite3_driver / apr_dbd_mysql_driver

only apr_dbd_odbc-2.dll can be build
I checked symbols export difference between odbc and sqlite3 / mysql to figure out the issue but didnít see flagrant linking difference
CMakeLists.txt:659:  SET_PROPERTY(TARGET apr_dbd_odbc-2 APPEND PROPERTY LINK_FLAGS /export:apr_dbd_odbc_driver)
CMakeLists.txt:670:  SET_PROPERTY(TARGET apr_dbd_sqlite3-2 APPEND PROPERTY LINK_FLAGS /export:apr_dbd_sqlite3_driver)
CMakeLists.txt:682:  SET_PROPERTY(TARGET apr_dbd_mysql-2 APPEND PROPERTY LINK_FLAGS /export:apr_dbd_mysql_driver)
dbd/apr_dbd_mysql.c:1303:APR_MODULE_DECLARE_DATA const apr_dbd_driver_t apr_dbd_mysql_driver
dbd/apr_dbd_odbc.c:1700:APR_MODULE_DECLARE_DATA const apr_dbd_driver_t ODBC_DRIVER_ENTRY
dbd/apr_dbd_sqlite3.c:882:APR_MODULE_DECLARE_DATA const apr_dbd_driver_t apr_dbd_sqlite3_driver

3. if DSO=OFF I can have libapr-2 buildind with crypto_openssl dbd_mysql dbd_sqlite3 dbd_odbc embeded
4. still have ldap failing to build: sasl mandatory now for apr-2 and I don't have it on my build chain
5. finally, trying to build httpd (mod_ldap disabled) I had
C:\sdk\src\httpd\os\win32\util_win32.c(35): error C2065: 'IF_WIN_OS_IS_UNICODE': undeclared identifier

Here is my current status
Back to top
James Blond

Joined: 19 Jan 2006
Posts: 7321
Location: Germany, Next to Hamburg

PostPosted: Fri 21 Jun '24 9:20    Post subject: Reply with quote

APR 1.7 still has IF_WIN_OS_IS_UNICODE [1]
While Trunk doesn't [2]

[1] https://github.com/apache/apr/blob/1.7.x/include/arch/win32/apr_arch_misc.h#L145
[2] https://github.com/apache/apr/blob/trunk/include/arch/win32/apr_arch_misc.h
Back to top

Reply to topic   Topic: Compiling httpd + libapr-2 failed on Windows View previous topic :: View next topic
Post new topic   Forum Index -> Building & Member Downloads