Re: Building on win32

Jun Omae <[email protected]>
Newsgroups gmane.comp.apache.apr.devel
Message-ID <CAEVLMaiwWizS=j-iBhS9qwUxLgRgyUbxV03SEy1602c2D+OJjQ@mail.gmail.com>
Hi,

On Mon, Jun 10, 2024 at 5:32 AM Daniel Sahlberg
<[email protected]> 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 <[email protected]> (大前 潤)
apr-1.7.4-nmake-test-makefile.patch (application/octet-stream, 577 B)
--- ../1.7.4/test/Makefile.win	2023-04-16 22:07:40.000000000 +0900
+++ test/Makefile.win	2024-06-10 17:29:26.033394600 +0900
@@ -133,7 +133,7 @@
 !ENDIF
 
 !IFDEF _DEBUG
-DEBUG_CFLAGS = /MDd
+DEBUG_CFLAGS = /MDd /D _DEBUG
 !ELSE
 DEBUG_CFLAGS = /MD 
 !ENDIF
@@ -142,7 +142,7 @@
 
 CFLAGS = /nologo /c /W3 /Gm /EHsc /Zi /Od $(INCLUDES) \
 	 $(STATIC_CFLAGS) $(DEBUG_CFLAGS) /D "BINPATH=$(OUTDIR:\=/)" \
-	 /D _DEBUG /D WIN32 /Fo"$(INTDIR)/" /FD
+	 /D WIN32 /Fo"$(INTDIR)/" /FD
 
 LD_LIBS = kernel32.lib advapi32.lib ws2_32.lib wsock32.lib \
 	  ole32.lib shell32.lib rpcrt4.lib
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.