Opened 15 years ago

Closed 6 years ago

#423 closed defect (fixed)

ClientServices build failure with 3.3.2RC2 on 64bit linux

Reported by: warmerdam Owned by: gregboone
Priority: minor Milestone:
Component: FDO API Version: 3.3.2
Severity: 3 Keywords: 64bit
Cc: External ID:

Description

 g++ -DPACKAGE_NAME=\"FDO\" -DPACKAGE_TARNAME=\"fdo\" -DPACKAGE_VERSION=\"3.3.0\
" "-DPACKAGE_STRING=\"FDO 3.3.0\"" -DPACKAGE_BUGREPORT=\"http://fdo.osgeo.org\" 
-DPACKAGE=\"fdo\" -DVERSION=\"3.3.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHA
VE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STR
INGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=
1 -I. -I../../Inc -I../Nls -I../Common -I../Geometry -I/wrk/home/warmerda/wrk/fd
o/OpenSource_FDO/Thirdparty/apache/xml-xerces/c/src -O2 -MMD -MT -DFULLPROTO -D_
_USE_GNU -DLINUX -DENABLE_BINRELOC -MT prefix.lo -MD -MP -MF .deps/prefix.Tpo -c
 ClientServices/prefix.cpp  -fPIC -DPIC -o .libs/prefix.o
ClientServices/prefix.cpp: In function 'char* br_locate(void*)':
ClientServices/prefix.cpp:132: error: cast from 'void*' to 'unsigned int' loses 
precision

Change History (2)

comment:1 by warmerdam, 15 years ago

I will note this represents an actual problem on my system with the code in question which appears to process /proc/self/maps on linux to get a list of loaded shared libraries. The code is:

		unsigned int start, end;

		if (!fgets (line, sizeof (line), f))
			continue;
		if (!strstr (line, " r-xp ") || !strchr (line, '/'))
			continue;

		sscanf (line, "%x-%x ", &start, &end);
		if (((unsigned int) symbol) >= start && ((unsigned int) symbol) < end)
		{

But on my system /proc/self/maps looks like:

2b9a8d4a1000-2b9a8d4a3000 rw-p 00154000 03:02 1045194                    /lib/libc-2.6.1.so

So the start and end values really should be longs and the sscanf should be using %lx. Even this somewhat better approach seems to be a bit risky as far as portability goes. Frankly - I'm not clear why we even need such esoteric functionality.

I have patched things with:

                unsigned long start, end;

		if (!fgets (line, sizeof (line), f))
			continue;
		if (!strstr (line, " r-xp ") || !strchr (line, '/'))
			continue;

		sscanf (line, "%lx-%lx ", &start, &end);
		if (((unsigned long) symbol) >= start && ((unsigned long) symbol) < end)
		{

this seems to build cleanly though I don't know how to exercise it.

comment:2 by jng, 6 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.