You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Daniel Sahlberg <da...@gmail.com> on 2024/06/09 20:30:41 UTC
Building on win32
Hi,
I'm trying to wrap my head around building APR on Windows.
The website [1] contains instructions on running for running msdev on
aprutil.dsw or to open aprutil.dsw in Visual Studio. However I don't have
msdev on my installation (Visual Studio Community 2022) and the support for
.dsw files was deprecated in Visual Studio 2022.
The README file suggests to run nmake but that failed out of the box with
an error in apr_arch_misc.h:
[[[
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error
C2143: syntax error: missing ')' before '*'
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error
C2143: syntax error: missing '{' before '*'
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error
C2059: syntax error: ')'
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error
C2061: syntax error: identifier 'apr_winapi_pfn_if_indextoname'
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error
C2059: syntax error: ';'
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error
C2513: ' ': no variable declared before '='
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error
C2065: 'apr_winapi_pfn_if_indextoname': undeclared identifier
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): warning
C4047: '=': 'int' differs in levels of indirection from 'int *(__cdecl
*)(NET_IFINDEX,PCHAR)'
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error
C2146: syntax error: missing ';' before identifier 'apr_load_dll_func'
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error
C2100: illegal indirection
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error
C2064: term does not evaluate to a function taking 0 arguments
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): warning
C4033: 'apr_winapi_if_indextoname' must return a value
]]]
Editing include\apr.hw and changing _WIN32_WINNT to 0x0601 made the build
go a lot further but it ended with:
[[[
link.exe /nologo /debug /subsystem:console /incremental:no
/out:"LibR\testall.exe" LibR\testutil.obj LibR\testtime.obj
LibR\teststr.obj LibR\testvsn.obj LibR\testipsub.obj LibR\testmmap.obj
LibR\testud.obj LibR\testtable.obj LibR\testsleep.obj LibR\testpools.obj
LibR\testfmt.obj LibR\testfile.obj LibR\testdir.obj LibR\testfileinfo.obj
LibR\testrand.obj LibR\testdso.obj LibR\testoc.obj LibR\testdup.obj
LibR\testsockets.obj LibR\testproc.obj LibR\testpoll.obj LibR\testlock.obj
LibR\testsockopt.obj LibR\testpipe.obj LibR\testthread.obj
LibR\testhash.obj LibR\testargs.obj LibR\testnames.obj LibR\testuser.obj
LibR\testpath.obj LibR\testenv.obj LibR\testprocmutex.obj
LibR\testfnmatch.obj LibR\testatomic.obj LibR\testflock.obj
LibR\testshm.obj LibR\testsock.obj LibR\testglobalmutex.obj
LibR\teststrnatcmp.obj LibR\testfilecopy.obj LibR\testtemp.obj
LibR\testlfs.obj LibR\testcond.obj LibR\testescape.obj
LibR\testskiplist.obj LibR\testencode.obj LibR\abts.obj ..\LibR\apr-1.lib
kernel32.lib advapi32.lib ws2_32.lib wsock32.lib ole32.lib shell32.lib
rpcrt4.lib
testutil.obj : error LNK2019: unresolved external symbol
__imp__CrtSetReportFile referenced in function initialize
testutil.obj : error LNK2019: unresolved external symbol
__imp__CrtSetReportMode referenced in function initialize
LibR\testall.exe : fatal error LNK1120: 2 unresolved externals
NMAKE : fatal error U1077: 'link.exe /nologo /debug /subsystem:console
/incremental:no /out:"LibR\testall.exe" LibR\testutil.obj LibR\testtime.obj
LibR\teststr.obj LibR\testvsn.obj LibR\testipsub.obj LibR\testmmap.obj
LibR\testud.obj LibR\testtable.obj LibR\testsleep.obj LibR\testpools.obj
LibR\testfmt.obj LibR\testfile.obj LibR\testdir.obj LibR\testfileinfo.obj
LibR\testrand.obj LibR\testdso.obj LibR\testoc.obj LibR\testdup.obj
LibR\testsockets.obj LibR\testproc.obj LibR\testpoll.obj LibR\testlock.obj
LibR\testsockopt.obj LibR\testpipe.obj LibR\testthread.obj
LibR\testhash.obj LibR\testargs.obj LibR\testnames.obj LibR\testuser.obj
LibR\testpath.obj LibR\testenv.obj LibR\testprocmutex.obj
LibR\testfnmatch.obj LibR\testatomic.obj LibR\testflock.obj
LibR\testshm.obj LibR\testsock.obj LibR\testglobalmutex.obj
LibR\teststrnatcmp.obj LibR\testfilecopy.obj LibR\testtemp.obj
LibR\testlfs.obj LibR\testcond.obj LibR\testescape.obj
LibR\testskiplist.obj LibR\testencode.obj LibR\abts.obj ..\LibR\apr-1.lib
kernel32.lib advapi32.lib ws2_32.lib wsock32.lib ole32.lib shell32.lib
rpcrt4.lib' : return code '0x460'
Stop.
]]]
I'm surely doing something wrong here... appreciating any advice and/or
pointers!
Kind regards,
Daniel Sahlberg
[1] https://apr.apache.org/compiling_win32.html
[2]
https://learn.microsoft.com/en-us/cpp/porting/upgrading-projects-from-earlier-versions-of-visual-cpp?view=msvc-170
Re: Building on win32
Posted by Daniel Sahlberg <da...@gmail.com>.
Den mån 10 juni 2024 kl 21:56 skrev Timofey Zhakov <ti...@chemodax.net>:
> On Sun, Jun 9, 2024 at 10:32 PM Daniel Sahlberg
> <da...@gmail.com> wrote:
> >
> > Hi,
> >
> > I'm trying to wrap my head around building APR on Windows.
> >
> > The website [1] contains instructions on running for running msdev on
> aprutil.dsw or to open aprutil.dsw in Visual Studio. However I don't have
> msdev on my installation (Visual Studio Community 2022) and the support for
> .dsw files was deprecated in Visual Studio 2022.
> >
> > The README file suggests to run nmake but that failed out of the box
> with an error in apr_arch_misc.h:
> >
> > [[[
> > C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error
> C2143: syntax error: missing ')' before '*'
> > C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error
> C2143: syntax error: missing '{' before '*'
> > C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error
> C2059: syntax error: ')'
> > C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error
> C2061: syntax error: identifier 'apr_winapi_pfn_if_indextoname'
> > C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error
> C2059: syntax error: ';'
> > C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error
> C2513: ' ': no variable declared before '='
> > C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error
> C2065: 'apr_winapi_pfn_if_indextoname': undeclared identifier
> > C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): warning
> C4047: '=': 'int' differs in levels of indirection from 'int *(__cdecl
> *)(NET_IFINDEX,PCHAR)'
> > C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error
> C2146: syntax error: missing ';' before identifier 'apr_load_dll_func'
> > C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error
> C2100: illegal indirection
> > C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error
> C2064: term does not evaluate to a function taking 0 arguments
> > C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): warning
> C4033: 'apr_winapi_if_indextoname' must return a value
> > ]]]
> >
> > Editing include\apr.hw and changing _WIN32_WINNT to 0x0601 made the
> build go a lot further but it ended with:
> >
> > [[[
> > link.exe /nologo /debug /subsystem:console /incremental:no
> /out:"LibR\testall.exe" LibR\testutil.obj LibR\testtime.obj
> LibR\teststr.obj LibR\testvsn.obj LibR\testipsub.obj LibR\testmmap.obj
> LibR\testud.obj LibR\testtable.obj LibR\testsleep.obj LibR\testpools.obj
> LibR\testfmt.obj LibR\testfile.obj LibR\testdir.obj LibR\testfileinfo.obj
> LibR\testrand.obj LibR\testdso.obj LibR\testoc.obj LibR\testdup.obj
> LibR\testsockets.obj LibR\testproc.obj LibR\testpoll.obj LibR\testlock.obj
> LibR\testsockopt.obj LibR\testpipe.obj LibR\testthread.obj
> LibR\testhash.obj LibR\testargs.obj LibR\testnames.obj LibR\testuser.obj
> LibR\testpath.obj LibR\testenv.obj LibR\testprocmutex.obj
> LibR\testfnmatch.obj LibR\testatomic.obj LibR\testflock.obj
> LibR\testshm.obj LibR\testsock.obj LibR\testglobalmutex.obj
> LibR\teststrnatcmp.obj LibR\testfilecopy.obj LibR\testtemp.obj
> LibR\testlfs.obj LibR\testcond.obj LibR\testescape.obj
> LibR\testskiplist.obj LibR\testencode.obj LibR\abts.obj ..\LibR\apr-1.lib
> kernel32.lib advapi32.lib ws2_32.lib wsock32.lib ole32.lib shell32.lib
> rpcrt4.lib
> > testutil.obj : error LNK2019: unresolved external symbol
> __imp__CrtSetReportFile referenced in function initialize
> > testutil.obj : error LNK2019: unresolved external symbol
> __imp__CrtSetReportMode referenced in function initialize
> > LibR\testall.exe : fatal error LNK1120: 2 unresolved externals
> > NMAKE : fatal error U1077: 'link.exe /nologo /debug /subsystem:console
> /incremental:no /out:"LibR\testall.exe" LibR\testutil.obj LibR\testtime.obj
> LibR\teststr.obj LibR\testvsn.obj LibR\testipsub.obj LibR\testmmap.obj
> LibR\testud.obj LibR\testtable.obj LibR\testsleep.obj LibR\testpools.obj
> LibR\testfmt.obj LibR\testfile.obj LibR\testdir.obj LibR\testfileinfo.obj
> LibR\testrand.obj LibR\testdso.obj LibR\testoc.obj LibR\testdup.obj
> LibR\testsockets.obj LibR\testproc.obj LibR\testpoll.obj LibR\testlock.obj
> LibR\testsockopt.obj LibR\testpipe.obj LibR\testthread.obj
> LibR\testhash.obj LibR\testargs.obj LibR\testnames.obj LibR\testuser.obj
> LibR\testpath.obj LibR\testenv.obj LibR\testprocmutex.obj
> LibR\testfnmatch.obj LibR\testatomic.obj LibR\testflock.obj
> LibR\testshm.obj LibR\testsock.obj LibR\testglobalmutex.obj
> LibR\teststrnatcmp.obj LibR\testfilecopy.obj LibR\testtemp.obj
> LibR\testlfs.obj LibR\testcond.obj LibR\testescape.obj
> LibR\testskiplist.obj LibR\testencode.obj LibR\abts.obj ..\LibR\apr-1.lib
> kernel32.lib advapi32.lib ws2_32.lib wsock32.lib ole32.lib shell32.lib
> rpcrt4.lib' : return code '0x460'
> > Stop.
> > ]]]
> >
> > I'm surely doing something wrong here... appreciating any advice and/or
> pointers!
> >
> > Kind regards,
> > Daniel Sahlberg
> >
> >
> > [1] https://apr.apache.org/compiling_win32.html
> > [2]
> https://learn.microsoft.com/en-us/cpp/porting/upgrading-projects-from-earlier-versions-of-visual-cpp?view=msvc-170
> >
>
> Hello Daniel,
>
> I want to recommend you to use CMake for building APR on Windows. I
> think it is simpler and more supported nowadays.
>
> The only commands you need to build:
>
> ```
> # Configure
> cmake -B out -G "Visual Studio 17 2022"
>
> # Build
> cmake --build out --config Release
>
> # Install
> cmake --install out
> # The default install dir is `C:/Program Files (x86)/APR` on Windows,
> but you can choose another by specifying the `--prefix` ARG.
> ```
>
> The script above is similar to the vcpkg port [1] and to the GitHub
> Actions script [2]. Additionally, as a follow-up to Stephen's answer,
> you can pass `-disableMetrics` ARG to the bootstrap-vcpkg command, if
> you want to prevent telemetry.
>
> If you are building APR Util, you have to do the same as for APR, but
> you have to specify the directory where APR is installed. You can do
> this by adding the `-DCMAKE_INSTALL_PREFIX=/apr/install/dir` argument
> to your CMake configure command.
>
> [1] vcpkg APR port:
>
> https://github.com/microsoft/vcpkg/blob/ad25766aefb5313b6bc4e2a4b78a2946f84fbf66/ports/apr/portfile.cmake#L23
> [2] https://github.com/apache/apr/blob/1.7.x/.github/workflows/windows.yml
>
> --
> Timofei Zhakov
>
Thanks Timofei, I will try this tomorrow!
Kind regards,
Daniel
(If only someone could commit a CMake build system to Subversion... oh,
wait, seems you recently submitted a patch for that - thanks! - now I have
the APR to review your patch ;-) )
Re: Building on win32
Posted by Timofey Zhakov <ti...@chemodax.net>.
On Sun, Jun 9, 2024 at 10:32 PM Daniel Sahlberg
<da...@gmail.com> wrote:
>
> Hi,
>
> I'm trying to wrap my head around building APR on Windows.
>
> The website [1] contains instructions on running for running msdev on aprutil.dsw or to open aprutil.dsw in Visual Studio. However I don't have msdev on my installation (Visual Studio Community 2022) and the support for .dsw files was deprecated in Visual Studio 2022.
>
> The README file suggests to run nmake but that failed out of the box with an error in apr_arch_misc.h:
>
> [[[
> C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error C2143: syntax error: missing ')' before '*'
> C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error C2143: syntax error: missing '{' before '*'
> C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error C2059: syntax error: ')'
> C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error C2061: syntax error: identifier 'apr_winapi_pfn_if_indextoname'
> C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error C2059: syntax error: ';'
> C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error C2513: ' ': no variable declared before '='
> C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error C2065: 'apr_winapi_pfn_if_indextoname': undeclared identifier
> C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): warning C4047: '=': 'int' differs in levels of indirection from 'int *(__cdecl *)(NET_IFINDEX,PCHAR)'
> C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error C2146: syntax error: missing ';' before identifier 'apr_load_dll_func'
> C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error C2100: illegal indirection
> C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error C2064: term does not evaluate to a function taking 0 arguments
> C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): warning C4033: 'apr_winapi_if_indextoname' must return a value
> ]]]
>
> Editing include\apr.hw and changing _WIN32_WINNT to 0x0601 made the build go a lot further but it ended with:
>
> [[[
> link.exe /nologo /debug /subsystem:console /incremental:no /out:"LibR\testall.exe" LibR\testutil.obj LibR\testtime.obj LibR\teststr.obj LibR\testvsn.obj LibR\testipsub.obj LibR\testmmap.obj LibR\testud.obj LibR\testtable.obj LibR\testsleep.obj LibR\testpools.obj LibR\testfmt.obj LibR\testfile.obj LibR\testdir.obj LibR\testfileinfo.obj LibR\testrand.obj LibR\testdso.obj LibR\testoc.obj LibR\testdup.obj LibR\testsockets.obj LibR\testproc.obj LibR\testpoll.obj LibR\testlock.obj LibR\testsockopt.obj LibR\testpipe.obj LibR\testthread.obj LibR\testhash.obj LibR\testargs.obj LibR\testnames.obj LibR\testuser.obj LibR\testpath.obj LibR\testenv.obj LibR\testprocmutex.obj LibR\testfnmatch.obj LibR\testatomic.obj LibR\testflock.obj LibR\testshm.obj LibR\testsock.obj LibR\testglobalmutex.obj LibR\teststrnatcmp.obj LibR\testfilecopy.obj LibR\testtemp.obj LibR\testlfs.obj LibR\testcond.obj LibR\testescape.obj LibR\testskiplist.obj LibR\testencode.obj LibR\abts.obj ..\LibR\apr-1.lib kernel32.lib advapi32.lib ws2_32.lib wsock32.lib ole32.lib shell32.lib rpcrt4.lib
> testutil.obj : error LNK2019: unresolved external symbol __imp__CrtSetReportFile referenced in function initialize
> testutil.obj : error LNK2019: unresolved external symbol __imp__CrtSetReportMode referenced in function initialize
> LibR\testall.exe : fatal error LNK1120: 2 unresolved externals
> NMAKE : fatal error U1077: 'link.exe /nologo /debug /subsystem:console /incremental:no /out:"LibR\testall.exe" LibR\testutil.obj LibR\testtime.obj LibR\teststr.obj LibR\testvsn.obj LibR\testipsub.obj LibR\testmmap.obj LibR\testud.obj LibR\testtable.obj LibR\testsleep.obj LibR\testpools.obj LibR\testfmt.obj LibR\testfile.obj LibR\testdir.obj LibR\testfileinfo.obj LibR\testrand.obj LibR\testdso.obj LibR\testoc.obj LibR\testdup.obj LibR\testsockets.obj LibR\testproc.obj LibR\testpoll.obj LibR\testlock.obj LibR\testsockopt.obj LibR\testpipe.obj LibR\testthread.obj LibR\testhash.obj LibR\testargs.obj LibR\testnames.obj LibR\testuser.obj LibR\testpath.obj LibR\testenv.obj LibR\testprocmutex.obj LibR\testfnmatch.obj LibR\testatomic.obj LibR\testflock.obj LibR\testshm.obj LibR\testsock.obj LibR\testglobalmutex.obj LibR\teststrnatcmp.obj LibR\testfilecopy.obj LibR\testtemp.obj LibR\testlfs.obj LibR\testcond.obj LibR\testescape.obj LibR\testskiplist.obj LibR\testencode.obj LibR\abts.obj ..\LibR\apr-1.lib kernel32.lib advapi32.lib ws2_32.lib wsock32.lib ole32.lib shell32.lib rpcrt4.lib' : return code '0x460'
> Stop.
> ]]]
>
> I'm surely doing something wrong here... appreciating any advice and/or pointers!
>
> Kind regards,
> Daniel Sahlberg
>
>
> [1] https://apr.apache.org/compiling_win32.html
> [2] https://learn.microsoft.com/en-us/cpp/porting/upgrading-projects-from-earlier-versions-of-visual-cpp?view=msvc-170
>
Hello Daniel,
I want to recommend you to use CMake for building APR on Windows. I
think it is simpler and more supported nowadays.
The only commands you need to build:
```
# Configure
cmake -B out -G "Visual Studio 17 2022"
# Build
cmake --build out --config Release
# Install
cmake --install out
# The default install dir is `C:/Program Files (x86)/APR` on Windows,
but you can choose another by specifying the `--prefix` ARG.
```
The script above is similar to the vcpkg port [1] and to the GitHub
Actions script [2]. Additionally, as a follow-up to Stephen's answer,
you can pass `-disableMetrics` ARG to the bootstrap-vcpkg command, if
you want to prevent telemetry.
If you are building APR Util, you have to do the same as for APR, but
you have to specify the directory where APR is installed. You can do
this by adding the `-DCMAKE_INSTALL_PREFIX=/apr/install/dir` argument
to your CMake configure command.
[1] vcpkg APR port:
https://github.com/microsoft/vcpkg/blob/ad25766aefb5313b6bc4e2a4b78a2946f84fbf66/ports/apr/portfile.cmake#L23
[2] https://github.com/apache/apr/blob/1.7.x/.github/workflows/windows.yml
--
Timofei Zhakov
FW: Building on win32
Posted by Stephen Webb via dev <de...@apr.apache.org>.
Hi Daniel,
I would recommend you use vcpkg [1] for a more productive Windows development life:
> git clone https://github.com/Microsoft/vcpkg.git
> cd vcpkg
> .\bootstrap-vcpkg.bat
> .\vcpkg install apr
Then, to hook up user-wide Visual Studio integration, run (note: requires admin on first use)
> .\vcpkg integrate install
[1] https://learn.microsoft.com/en-us/vcpkg/get_started/overview
From: Daniel Sahlberg <daniel.l.sahlberg@gmail.com <ma...@gmail.com> >
Sent: Monday, June 10, 2024 6:31 AM
To: APR Developer List <dev@apr.apache.org <ma...@apr.apache.org> >
Subject: Building on win32
Hi,
I'm trying to wrap my head around building APR on Windows.
The website [1] contains instructions on running for running msdev on aprutil.dsw or to open aprutil.dsw in Visual Studio. However I don't have msdev on my installation (Visual Studio Community 2022) and the support for .dsw files was deprecated in Visual Studio 2022.
The README file suggests to run nmake but that failed out of the box with an error in apr_arch_misc.h:
[[[
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error C2143: syntax error: missing ')' before '*'
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error C2143: syntax error: missing '{' before '*'
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error C2059: syntax error: ')'
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error C2061: syntax error: identifier 'apr_winapi_pfn_if_indextoname'
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error C2059: syntax error: ';'
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error C2513: ' ': no variable declared before '='
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error C2065: 'apr_winapi_pfn_if_indextoname': undeclared identifier
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): warning C4047: '=': 'int' differs in levels of indirection from 'int *(__cdecl *)(NET_IFINDEX,PCHAR)'
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(510): error C2146: syntax error: missing ';' before identifier 'apr_load_dll_func'
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error C2100: illegal indirection
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): error C2064: term does not evaluate to a function taking 0 arguments
C:\Devel\apr_1.7.4\apr\include\arch\win32\apr_arch_misc.h(507): warning C4033: 'apr_winapi_if_indextoname' must return a value
]]]
Editing include\apr.hw and changing _WIN32_WINNT to 0x0601 made the build go a lot further but it ended with:
[[[
link.exe /nologo /debug /subsystem:console /incremental:no /out:"LibR\testall.exe" LibR\testutil.obj LibR\testtime.obj LibR\teststr.obj LibR\testvsn.obj LibR\testipsub.obj LibR\testmmap.obj LibR\testud.obj LibR\testtable.obj LibR\testsleep.obj LibR\testpools.obj LibR\testfmt.obj LibR\testfile.obj LibR\testdir.obj LibR\testfileinfo.obj LibR\testrand.obj LibR\testdso.obj LibR\testoc.obj LibR\testdup.obj LibR\testsockets.obj LibR\testproc.obj LibR\testpoll.obj LibR\testlock.obj LibR\testsockopt.obj LibR\testpipe.obj LibR\testthread.obj LibR\testhash.obj LibR\testargs.obj LibR\testnames.obj LibR\testuser.obj LibR\testpath.obj LibR\testenv.obj LibR\testprocmutex.obj LibR\testfnmatch.obj LibR\testatomic.obj LibR\testflock.obj LibR\testshm.obj LibR\testsock.obj LibR\testglobalmutex.obj LibR\teststrnatcmp.obj LibR\testfilecopy.obj LibR\testtemp.obj LibR\testlfs.obj LibR\testcond.obj LibR\testescape.obj LibR\testskiplist.obj LibR\testencode.obj LibR\abts.obj ..\LibR\apr-1.lib kernel32.lib advapi32.lib ws2_32.lib wsock32.lib ole32.lib shell32.lib rpcrt4.lib
testutil.obj : error LNK2019: unresolved external symbol __imp__CrtSetReportFile referenced in function initialize
testutil.obj : error LNK2019: unresolved external symbol __imp__CrtSetReportMode referenced in function initialize
LibR\testall.exe : fatal error LNK1120: 2 unresolved externals
NMAKE : fatal error U1077: 'link.exe /nologo /debug /subsystem:console /incremental:no /out:"LibR\testall.exe" LibR\testutil.obj LibR\testtime.obj LibR\teststr.obj LibR\testvsn.obj LibR\testipsub.obj LibR\testmmap.obj LibR\testud.obj LibR\testtable.obj LibR\testsleep.obj LibR\testpools.obj LibR\testfmt.obj LibR\testfile.obj LibR\testdir.obj LibR\testfileinfo.obj LibR\testrand.obj LibR\testdso.obj LibR\testoc.obj LibR\testdup.obj LibR\testsockets.obj LibR\testproc.obj LibR\testpoll.obj LibR\testlock.obj LibR\testsockopt.obj LibR\testpipe.obj LibR\testthread.obj LibR\testhash.obj LibR\testargs.obj LibR\testnames.obj LibR\testuser.obj LibR\testpath.obj LibR\testenv.obj LibR\testprocmutex.obj LibR\testfnmatch.obj LibR\testatomic.obj LibR\testflock.obj LibR\testshm.obj LibR\testsock.obj LibR\testglobalmutex.obj LibR\teststrnatcmp.obj LibR\testfilecopy.obj LibR\testtemp.obj LibR\testlfs.obj LibR\testcond.obj LibR\testescape.obj LibR\testskiplist.obj LibR\testencode.obj LibR\abts.obj ..\LibR\apr-1.lib kernel32.lib advapi32.lib ws2_32.lib wsock32.lib ole32.lib shell32.lib rpcrt4.lib' : return code '0x460'
Stop.
]]]
I'm surely doing something wrong here... appreciating any advice and/or pointers!
Kind regards,
Daniel Sahlberg
[1] https://apr.apache.org/compiling_win32.html
[2] https://learn.microsoft.com/en-us/cpp/porting/upgrading-projects-from-earlier-versions-of-visual-cpp?view=msvc-170
--
This email has been checked for viruses by Avast antivirus software.
www.avast.com
Re: Building on win32
Posted by Jun Omae <ju...@gmail.com>.
On Tue, Jun 11, 2024 at 4:58 AM Daniel Sahlberg
<da...@gmail.com> wrote:
>
> Den mån 10 juni 2024 kl 10:55 skrev Jun Omae <ju...@gmail.com>:
>>
>> > I'm surely doing something wrong here... appreciating any advice and/or pointers!
>>
>> _CrtSetReportFile and _CrtSetReportMode routines are available only
>> for debug versions. So that /MDd flag should be passed but not in
>> test/Makefile.win. See attached patch.
>
>
> Thanks Jun, unfortunately the patch didn't make any difference. In the end it turned out that I needed to specify ARCH="x64 Release" on the command line. I found this by reading the comments in Makefile.win.
It is needed to delete *.obj files because the patch changes CFLAGS.
Please retry after `del test\LibR\*.obj`.
p.s. `clean` task is defined in test/Makefile.win but no task is
defined to invoke the `clean` task in Makefile.win.
--
Jun Omae <ju...@gmail.com> (大前 潤)
Re: Building on win32
Posted by Ivan Zhakov <ch...@gmail.com>.
On Tue, 11 Jun 2024 at 09:37, Ivan Zhakov <ch...@gmail.com> wrote:
> On Mon, 10 Jun 2024 at 21:58, Daniel Sahlberg <da...@gmail.com>
> wrote:
>
>> Den mån 10 juni 2024 kl 10:55 skrev Jun Omae <ju...@gmail.com>:
>>
>>> Hi,
>>>
>>> On Mon, Jun 10, 2024 at 5:32 AM Daniel Sahlberg
>>
>>
> [...]
>
>
>>
>>
>>>
>>> Of course, you can use cmake to build apr on Windows. I use cmake to
>>> build apr, apr-util and httpd as dependencies of subversion on
>>> Windows.
>>>
>>
>> I also tried this, since my longterm goal is to build Subversion, where
>> there is some work going on to add a cmake based build system.
>>
>> It seems there are at least four different options, with the
>> documentation in various stage of completeness:
>> * .DSW files
>> * Makefile.win
>> * CMake
>> * vcpkg
>>
>> Cleanup of .dsw and NMake (Makefile.win) builds was proposed four years
> ago [1], but people objected to this idea. So .dsw and Makefile.win are
> still there, but as far as I know they have many limitations compared to
> CMake. I recommend using CMake to build APR on Windows. In my opinion CMake
> has many quirks, but it's a clear winner these days and most projects using
> it to build on Windows.
>
>
> I guess what I'm trying to say is that the bar to get started with APR is
>> relatively high. Please don't take this as complaints - I'd be happy to
>> help in any way I can to improve the documentation.
>>
>> It would be great! Patches welcome!
>
>
Missed link to the discussion:
[1] https://lists.apache.org/thread/bkpphm954olxxh2kdkmh3tzqjmdslxzc
--
Ivan Zhakov
Re: Building on win32
Posted by Ivan Zhakov <ch...@gmail.com>.
On Mon, 10 Jun 2024 at 21:58, Daniel Sahlberg <da...@gmail.com>
wrote:
> Den mån 10 juni 2024 kl 10:55 skrev Jun Omae <ju...@gmail.com>:
>
>> Hi,
>>
>> On Mon, Jun 10, 2024 at 5:32 AM Daniel Sahlberg
>
>
[...]
>
>
>>
>> Of course, you can use cmake to build apr on Windows. I use cmake to
>> build apr, apr-util and httpd as dependencies of subversion on
>> Windows.
>>
>
> I also tried this, since my longterm goal is to build Subversion, where
> there is some work going on to add a cmake based build system.
>
> It seems there are at least four different options, with the documentation
> in various stage of completeness:
> * .DSW files
> * Makefile.win
> * CMake
> * vcpkg
>
> Cleanup of .dsw and NMake (Makefile.win) builds was proposed four years
ago [1], but people objected to this idea. So .dsw and Makefile.win are
still there, but as far as I know they have many limitations compared to
CMake. I recommend using CMake to build APR on Windows. In my opinion CMake
has many quirks, but it's a clear winner these days and most projects using
it to build on Windows.
I guess what I'm trying to say is that the bar to get started with APR is
> relatively high. Please don't take this as complaints - I'd be happy to
> help in any way I can to improve the documentation.
>
> It would be great! Patches welcome!
--
Ivan Zhakov
Re: Building on win32
Posted by Daniel Sahlberg <da...@gmail.com>.
Den mån 10 juni 2024 kl 10:55 skrev Jun Omae <ju...@gmail.com>:
> Hi,
>
> On Mon, Jun 10, 2024 at 5:32 AM Daniel Sahlberg
> <da...@gmail.com> wrote:
> > [[[
> > link.exe /nologo /debug /subsystem:console /incremental:no
> /out:"LibR\testall.exe" LibR\testutil.obj LibR\testtime.obj
> LibR\teststr.obj LibR\testvsn.obj LibR\testipsub.obj LibR\testmmap.obj
> LibR\testud.obj LibR\testtable.obj LibR\testsleep.obj LibR\testpools.obj
> LibR\testfmt.obj LibR\testfile.obj LibR\testdir.obj LibR\testfileinfo.obj
> LibR\testrand.obj LibR\testdso.obj LibR\testoc.obj LibR\testdup.obj
> LibR\testsockets.obj LibR\testproc.obj LibR\testpoll.obj LibR\testlock.obj
> LibR\testsockopt.obj LibR\testpipe.obj LibR\testthread.obj
> LibR\testhash.obj LibR\testargs.obj LibR\testnames.obj LibR\testuser.obj
> LibR\testpath.obj LibR\testenv.obj LibR\testprocmutex.obj
> LibR\testfnmatch.obj LibR\testatomic.obj LibR\testflock.obj
> LibR\testshm.obj LibR\testsock.obj LibR\testglobalmutex.obj
> LibR\teststrnatcmp.obj LibR\testfilecopy.obj LibR\testtemp.obj
> LibR\testlfs.obj LibR\testcond.obj LibR\testescape.obj
> LibR\testskiplist.obj LibR\testencode.obj LibR\abts.obj ..\LibR\apr-1.lib
> kernel32.lib advapi32.lib ws2_32.lib wsock32.lib ole32.lib shell32.lib
> rpcrt4.lib
> > testutil.obj : error LNK2019: unresolved external symbol
> __imp__CrtSetReportFile referenced in function initialize
> > testutil.obj : error LNK2019: unresolved external symbol
> __imp__CrtSetReportMode referenced in function initialize
> > LibR\testall.exe : fatal error LNK1120: 2 unresolved externals
> > NMAKE : fatal error U1077: 'link.exe /nologo /debug /subsystem:console
> /incremental:no /out:"LibR\testall.exe" LibR\testutil.obj LibR\testtime.obj
> LibR\teststr.obj LibR\testvsn.obj LibR\testipsub.obj LibR\testmmap.obj
> LibR\testud.obj LibR\testtable.obj LibR\testsleep.obj LibR\testpools.obj
> LibR\testfmt.obj LibR\testfile.obj LibR\testdir.obj LibR\testfileinfo.obj
> LibR\testrand.obj LibR\testdso.obj LibR\testoc.obj LibR\testdup.obj
> LibR\testsockets.obj LibR\testproc.obj LibR\testpoll.obj LibR\testlock.obj
> LibR\testsockopt.obj LibR\testpipe.obj LibR\testthread.obj
> LibR\testhash.obj LibR\testargs.obj LibR\testnames.obj LibR\testuser.obj
> LibR\testpath.obj LibR\testenv.obj LibR\testprocmutex.obj
> LibR\testfnmatch.obj LibR\testatomic.obj LibR\testflock.obj
> LibR\testshm.obj LibR\testsock.obj LibR\testglobalmutex.obj
> LibR\teststrnatcmp.obj LibR\testfilecopy.obj LibR\testtemp.obj
> LibR\testlfs.obj LibR\testcond.obj LibR\testescape.obj
> LibR\testskiplist.obj LibR\testencode.obj LibR\abts.obj ..\LibR\apr-1.lib
> kernel32.lib advapi32.lib ws2_32.lib wsock32.lib ole32.lib shell32.lib
> rpcrt4.lib' : return code '0x460'
> > Stop.
> > ]]]
> >
> > I'm surely doing something wrong here... appreciating any advice and/or
> pointers!
>
> _CrtSetReportFile and _CrtSetReportMode routines are available only
> for debug versions. So that /MDd flag should be passed but not in
> test/Makefile.win. See attached patch.
>
Thanks Jun, unfortunately the patch didn't make any difference. In the end
it turned out that I needed to specify ARCH="x64 Release" on the command
line. I found this by reading the comments in Makefile.win.
>
> Of course, you can use cmake to build apr on Windows. I use cmake to
> build apr, apr-util and httpd as dependencies of subversion on
> Windows.
>
I also tried this, since my longterm goal is to build Subversion, where
there is some work going on to add a cmake based build system.
It seems there are at least four different options, with the documentation
in various stage of completeness:
* .DSW files
* Makefile.win
* CMake
* vcpkg
I guess what I'm trying to say is that the bar to get started with APR is
relatively high. Please don't take this as complaints - I'd be happy to
help in any way I can to improve the documentation.
Kind regards,
Daniel
Re: Building on win32
Posted by Jun Omae <ju...@gmail.com>.
Hi,
On Mon, Jun 10, 2024 at 5:32 AM Daniel Sahlberg
<da...@gmail.com> wrote:
> [[[
> link.exe /nologo /debug /subsystem:console /incremental:no /out:"LibR\testall.exe" LibR\testutil.obj LibR\testtime.obj LibR\teststr.obj LibR\testvsn.obj LibR\testipsub.obj LibR\testmmap.obj LibR\testud.obj LibR\testtable.obj LibR\testsleep.obj LibR\testpools.obj LibR\testfmt.obj LibR\testfile.obj LibR\testdir.obj LibR\testfileinfo.obj LibR\testrand.obj LibR\testdso.obj LibR\testoc.obj LibR\testdup.obj LibR\testsockets.obj LibR\testproc.obj LibR\testpoll.obj LibR\testlock.obj LibR\testsockopt.obj LibR\testpipe.obj LibR\testthread.obj LibR\testhash.obj LibR\testargs.obj LibR\testnames.obj LibR\testuser.obj LibR\testpath.obj LibR\testenv.obj LibR\testprocmutex.obj LibR\testfnmatch.obj LibR\testatomic.obj LibR\testflock.obj LibR\testshm.obj LibR\testsock.obj LibR\testglobalmutex.obj LibR\teststrnatcmp.obj LibR\testfilecopy.obj LibR\testtemp.obj LibR\testlfs.obj LibR\testcond.obj LibR\testescape.obj LibR\testskiplist.obj LibR\testencode.obj LibR\abts.obj ..\LibR\apr-1.lib kernel32.lib advapi32.lib ws2_32.lib wsock32.lib ole32.lib shell32.lib rpcrt4.lib
> testutil.obj : error LNK2019: unresolved external symbol __imp__CrtSetReportFile referenced in function initialize
> testutil.obj : error LNK2019: unresolved external symbol __imp__CrtSetReportMode referenced in function initialize
> LibR\testall.exe : fatal error LNK1120: 2 unresolved externals
> NMAKE : fatal error U1077: 'link.exe /nologo /debug /subsystem:console /incremental:no /out:"LibR\testall.exe" LibR\testutil.obj LibR\testtime.obj LibR\teststr.obj LibR\testvsn.obj LibR\testipsub.obj LibR\testmmap.obj LibR\testud.obj LibR\testtable.obj LibR\testsleep.obj LibR\testpools.obj LibR\testfmt.obj LibR\testfile.obj LibR\testdir.obj LibR\testfileinfo.obj LibR\testrand.obj LibR\testdso.obj LibR\testoc.obj LibR\testdup.obj LibR\testsockets.obj LibR\testproc.obj LibR\testpoll.obj LibR\testlock.obj LibR\testsockopt.obj LibR\testpipe.obj LibR\testthread.obj LibR\testhash.obj LibR\testargs.obj LibR\testnames.obj LibR\testuser.obj LibR\testpath.obj LibR\testenv.obj LibR\testprocmutex.obj LibR\testfnmatch.obj LibR\testatomic.obj LibR\testflock.obj LibR\testshm.obj LibR\testsock.obj LibR\testglobalmutex.obj LibR\teststrnatcmp.obj LibR\testfilecopy.obj LibR\testtemp.obj LibR\testlfs.obj LibR\testcond.obj LibR\testescape.obj LibR\testskiplist.obj LibR\testencode.obj LibR\abts.obj ..\LibR\apr-1.lib kernel32.lib advapi32.lib ws2_32.lib wsock32.lib ole32.lib shell32.lib rpcrt4.lib' : return code '0x460'
> Stop.
> ]]]
>
> I'm surely doing something wrong here... appreciating any advice and/or pointers!
_CrtSetReportFile and _CrtSetReportMode routines are available only
for debug versions. So that /MDd flag should be passed but not in
test/Makefile.win. See attached patch.
Of course, you can use cmake to build apr on Windows. I use cmake to
build apr, apr-util and httpd as dependencies of subversion on
Windows.
--
Jun Omae <ju...@gmail.com> (大前 潤)