Harbour build using MSVC fails with HB_USER_CFLAGS=-DHB_FM_STATISTICS set

96 views
Skip to first unread message

Ron Christie

unread,
Nov 21, 2022, 12:22:08 PM11/21/22
to Harbour Developers
Hi all,
I'm attempting to build the current harbour (a git clone on today's date) with the following environment variables set:
HB_BUILD_CONTRIB_DYN=no
HB_BUILD_DEBUG=yes
HB_BUILD_DYN=no
HB_BUILD_OPTIM=no
HB_CPU=x86
HB_INSTALL_PREFIX=c:\harbour
HB_PATH=c:\harbour
HB_TR_LEVEL=HB_TR_WARNING
HB_TR_OUTPUT=c:\smdev\hb_debug.log
HB_USER_CFLAGS=-DHB_FM_STATISTICS
HB_USER_PRGFLAGS=-w3
HB_WITH_ADS=c:\ads\6.2\acesdk
HB_WITH_CURL=c:\curl\curl-7.65.3\include

The build fails when compiling nortl.c, as follows:
cl.exe   -I. -I../../../../../include -nologo -TP -W4 -wd4127 -Zi -DHB_TR_LEVEL_DEBUG  -DUNICODE -DHB_FM_STATISTICS -Fonortl.obj  -c ../../../nortl.c
nortl.c
../../../nortl.c(280) : warning C4244: '=' : conversion from 'int' to 'char', possible loss of data
../../../nortl.c(281) : warning C4244: '=' : conversion from 'int' to 'char', possible loss of data
../../../nortl.c(318) : error C2036: 'void *' : unknown size
../../../../../config/rules.mk:88: recipe for target 'nortl.obj' failed

However, if the HB_USER_CFLAGS switch is removed, the build succeeds. The code that fails has been present since at least the summer of 2019, if not earlier.

I'm trying to chase down a problem in my app which causes it to hang without an error messages after anywhere from one to three weeks of continuous operation, depending on activity, and I was thinking that the HB_FM_STATISTICS option might yield some useful information.

Thoughts?

Aleksander Czajczynski

unread,
Nov 23, 2022, 6:58:57 AM11/23/22
to harbou...@googlegroups.com
Hello!

Ron Christie wrote:
>
> The build fails when compiling nortl.c, as follows:
> cl.exe -I. -I../../../../../include -nologo -TP -W4 -wd4127 -Zi
> -DHB_TR_LEVEL_DEBUG -DUNICODE -DHB_FM_STATISTICS -Fonortl.obj -c
> ../../../nortl.c
> nortl.c
> ../../../nortl.c(280) : warning C4244: '=' : conversion from 'int' to
> 'char', possible loss of data
> ../../../nortl.c(281) : warning C4244: '=' : conversion from 'int' to
> 'char', possible loss of data
> ../../../nortl.c(318) : error C2036: 'void *' : unknown size
> ../../../../../config/rules.mk:88: recipe for target 'nortl.obj' failed
>
Now without going much into this, please try:

--- a/src/nortl/nortl.c
+++ b/src/nortl/nortl.c
@@ -313,7 +313,7 @@ void hb_xexit( void )

for( i = 1, pMemBlock = s_pMemBlocks; pMemBlock; ++i, pMemBlock
= pMemBlock->pNextBlock )
HB_TRACE( HB_TR_ERROR, ( "Block %i %p (size %" HB_PFS "u)
\"%s\"", i,
- ( void * ) pMemBlock + HB_MEMINFO_SIZE, pMemBlock->nSize,
+ ( char * ) pMemBlock + HB_MEMINFO_SIZE, pMemBlock->nSize,
hb_memToStr( szBuffer, ( char * ) pMemBlock +
HB_MEMINFO_SIZE,
pMemBlock->nSize ) ) );
}

I don't believe any other compiler would complain, but if it does, then
maybe this:
+ ( void * )( ( char * ) pMemBlock + HB_MEMINFO_SIZE ),
pMemBlock->nSize,

Best regards, Aleksander


Ron Christie

unread,
Nov 25, 2022, 1:26:41 AM11/25/22
to Harbour Developers
Hi Aleksander,
Changing the void pointer to a char pointer allowed harbour to build 
properly, and it doesn't seem to have impacted the behaviour of the 
FM_STATISTICS reporter. I don't believe I have write access to the git repository,
so could someone else make that change?

Thanks for the help.

Reply all
Reply to author
Forward
0 new messages