Bug 59755 - testxlate fails due to several APR-util makefile.win issues
Summary: testxlate fails due to several APR-util makefile.win issues
Status: NEW
Alias: None
Product: APR
Classification: Unclassified
Component: APR-util (show other bugs)
Version: 1.5.3
Hardware: PC Windows NT
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache Portable Runtime bugs mailinglist
Keywords: PatchAvailable
Depends on:
Reported: 2016-06-27 00:11 UTC by Stefan
Modified: 2016-06-27 21:44 UTC (History)
1 user (show)

patch to resolve testxlate related makefile.win issues (2.45 KB, patch)
2016-06-27 00:54 UTC, Stefan
Details | Diff
patch to resolve testxlate related makefile.win issues (2.44 KB, patch)
2016-06-27 21:14 UTC, Stefan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan 2016-06-27 00:11:51 UTC
There seem to be a couple of issues with the APR-util makefile on Windows which result in the APR-iconv testxlate test to fail to detect and load the dynamic DLLs.

1. wrong APR_ICONV1_PATH
APR_ICONV1_PATH is used as the environment variable in APR-iconv to locate the DLLs it needs to load.
The iconv DLLs are always located in their shared out dirs (see apr-util/Makefile.win which builds the ccs/ces projects always in BIND_MODE=shared which is specified in API/build/modules.mk.win as Release/Debug depending on the BUILD_MODE - note that the API out dir doesn't distinguish between 32- or 64-bit).
Hence, APR_ICONV1_PATH should be set to either $(API_PATH)\Release\iconv or $(API_PATH)\Debug\iconv.
The attached patch defines a new macro (based on the BUILD_MODE and _DEBUG macro) and uses that to determine the APR_ICONV1_PATH.

2. APR_ICONV1_PATH requires existing environment variable
Setting APR_ICONV1_PATH in the makefile will only update/change the environment variable, if one existed already. It won't create an environment variable however, if none exists (see: https://msdn.microsoft.com/en-us/library/99at5bh3.aspx). The attached patch changes this to make use of the set-command instead of the macro-redefinition style.

3.PATH is not pointing to DLL directories
The dynamically loaded DLLs refer to libapr-1.dll and libaprutil-1.dll. Hence, the directories these files are located in must be present in the PATH environment variable. Otherwise loading the DLLs will fail.
Atm PATH is only set if MODEL is set to dynamic. But for the testxlate test it's required to be present in both models.
Furthermore, it's required to point to the dynamic outdirs even in the static model, since the DLLs are located in these directories.
The patch sets the PATH unconditionally and modifies the provided paths to always point to their dynamic outdirs.

Note that this resolves the build system issues related to the testxlate test failures. It won't completely resolve the test failure however, due some remaining (independent) issues in APR-iconv (reference to the other bug will be added).
Comment 1 Stefan 2016-06-27 00:54:03 UTC
Created attachment 33989 [details]
patch to resolve testxlate related makefile.win issues
Comment 2 Stefan 2016-06-27 21:14:39 UTC
Created attachment 33993 [details]
patch to resolve testxlate related makefile.win issues

updated patch resolving the incorrectly placed comment related to the set command
Comment 3 Stefan 2016-06-27 21:41:47 UTC
The related UTF-7 issue (at least partially an APR-iconv issue): https://bz.apache.org/bugzilla/show_bug.cgi?id=59756
Comment 4 Stefan 2016-06-27 21:44:21 UTC
Further note that the path construction to create the path to the to be loaded iconv DLL is using forward slashes. According to the MSDN paths passed to LoadLirbaryEx should use backslashes: https://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx

However, the tests succeed in my case even when using forward slashes. Hence, correcting this would not necessarily be required to resolve the testxlate failures.