Problem compiling with MinGW from SVN

View: New views
5 Messages — Rating Filter:   Alert me  

Problem compiling with MinGW from SVN

by Nicklas Avén :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hallo
 
I tried to compile from SVN wich has worked great before. I think the problem is strtok_r() used in lwgeom_geos, that is supposed to be found in string.h as I understand it. In my version in MinGW there is no strtok_r() in string.h, but strtok(). Is it a problem of versions or?
 
the error message is as follows when running make, starting with a warning.
 
lwgeom_geos.c: In function `buffer':
lwgeom_geos.c:891: warning: implicit declaration of function `strtok_r'
lwgeom_geos.c:891: warning: assignment makes pointer from integer without a cast
lwgeom_geos.c:895: warning: assignment makes pointer from integer without a cast
lwgeom_geos.c:900: warning: assignment makes pointer from integer without a cast
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv  -I/c/pg84/include -I/c/proj/include -I../liblwgeom -I. -Ic:/pg84/include/POSTGR~1/server -Ic:/pg84/include/POSTGR~1/internal -I./src/include/port/win32 -DEXEC_BACKEND  "-Ic:/pg84/lib/POSTGR~1/pgxs/src/MAKEFI~1/../../src/include/port/win32" -Ic:/pg84/include/POSTGR~1/server/port/win32  -c -o lwgeom_geos_prepared.o lwgeom_geos_prepared.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv  -I/c/pg84/include -I/c/proj/include -I../liblwgeom -I. -Ic:/pg84/include/POSTGR~1/server -Ic:/pg84/include/POSTGR~1/internal -I./src/include/port/win32 -DEXEC_BACKEND  "-Ic:/pg84/lib/POSTGR~1/pgxs/src/MAKEFI~1/../../src/include/port/win32" -Ic:/pg84/include/POSTGR~1/server/port/win32  -c -o lwgeom_svg.o lwgeom_svg.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv  -I/c/pg84/include -I/c/proj/include -I../liblwgeom -I. -Ic:/pg84/include/POSTGR~1/server -Ic:/pg84/include/POSTGR~1/internal -I./src/include/port/win32 -DEXEC_BACKEND  "-Ic:/pg84/lib/POSTGR~1/pgxs/src/MAKEFI~1/../../src/include/port/win32" -Ic:/pg84/include/POSTGR~1/server/port/win32  -c -o lwgeom_gml.o lwgeom_gml.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv  -I/c/pg84/include -I/c/proj/include -I../liblwgeom -I. -Ic:/pg84/include/POSTGR~1/server -Ic:/pg84/include/POSTGR~1/internal -I./src/include/port/win32 -DEXEC_BACKEND  "-Ic:/pg84/lib/POSTGR~1/pgxs/src/MAKEFI~1/../../src/include/port/win32" -Ic:/pg84/include/POSTGR~1/server/port/win32  -c -o lwgeom_kml.o lwgeom_kml.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv  -I/c/pg84/include -I/c/proj/include -I../liblwgeom -I. -Ic:/pg84/include/POSTGR~1/server -Ic:/pg84/include/POSTGR~1/internal -I./src/include/port/win32 -DEXEC_BACKEND  "-Ic:/pg84/lib/POSTGR~1/pgxs/src/MAKEFI~1/../../src/include/port/win32" -Ic:/pg84/include/POSTGR~1/server/port/win32  -c -o lwgeom_geojson.o lwgeom_geojson.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv  -I/c/pg84/include -I/c/proj/include -I../liblwgeom -I. -Ic:/pg84/include/POSTGR~1/server -Ic:/pg84/include/POSTGR~1/internal -I./src/include/port/win32 -DEXEC_BACKEND  "-Ic:/pg84/lib/POSTGR~1/pgxs/src/MAKEFI~1/../../src/include/port/win32" -Ic:/pg84/include/POSTGR~1/server/port/win32  -c -o lwgeom_triggers.o lwgeom_triggers.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv  -I/c/pg84/include -I/c/proj/include -I../liblwgeom -I. -Ic:/pg84/include/POSTGR~1/server -Ic:/pg84/include/POSTGR~1/internal -I./src/include/port/win32 -DEXEC_BACKEND  "-Ic:/pg84/lib/POSTGR~1/pgxs/src/MAKEFI~1/../../src/include/port/win32" -Ic:/pg84/include/POSTGR~1/server/port/win32  -c -o lwgeom_dump.o lwgeom_dump.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv  -I/c/pg84/include -I/c/proj/include -I../liblwgeom -I. -Ic:/pg84/include/POSTGR~1/server -Ic:/pg84/include/POSTGR~1/internal -I./src/include/port/win32 -DEXEC_BACKEND  "-Ic:/pg84/lib/POSTGR~1/pgxs/src/MAKEFI~1/../../src/include/port/win32" -Ic:/pg84/include/POSTGR~1/server/port/win32  -c -o lwgeom_functions_lrs.o lwgeom_functions_lrs.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv  -I/c/pg84/include -I/c/proj/include -I../liblwgeom -I. -Ic:/pg84/include/POSTGR~1/server -Ic:/pg84/include/POSTGR~1/internal -I./src/include/port/win32 -DEXEC_BACKEND  "-Ic:/pg84/lib/POSTGR~1/pgxs/src/MAKEFI~1/../../src/include/port/win32" -Ic:/pg84/include/POSTGR~1/server/port/win32  -c -o long_xact.o long_xact.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv  -I/c/pg84/include -I/c/proj/include -I../liblwgeom -I. -Ic:/pg84/include/POSTGR~1/server -Ic:/pg84/include/POSTGR~1/internal -I./src/include/port/win32 -DEXEC_BACKEND  "-Ic:/pg84/lib/POSTGR~1/pgxs/src/MAKEFI~1/../../src/include/port/win32" -Ic:/pg84/include/POSTGR~1/server/port/win32  -c -o lwgeom_sqlmm.o lwgeom_sqlmm.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv  -I/c/pg84/include -I/c/proj/include -I../liblwgeom -I. -Ic:/pg84/include/POSTGR~1/server -Ic:/pg84/include/POSTGR~1/internal -I./src/include/port/win32 -DEXEC_BACKEND  "-Ic:/pg84/lib/POSTGR~1/pgxs/src/MAKEFI~1/../../src/include/port/win32" -Ic:/pg84/include/POSTGR~1/server/port/win32  -c -o lwgeom_rtree.o lwgeom_rtree.c
dlltool --export-all  --output-def libpostgis-1.5dll.def lwgeom_pg.o lwgeom_debug.o lwgeom_accum.o lwgeom_spheroid.o lwgeom_ogc.o lwgeom_functions_analytic.o lwgeom_inout.o lwgeom_estimate.o lwgeom_functions_basic.o lwgeom_gist.o lwgeom_btree.o lwgeom_transform.o lwgeom_box.o lwgeom_box3d.o lwgeom_box2dfloat4.o lwgeom_chip.o lwgeom_geos.o lwgeom_geos_prepared.o lwgeom_svg.o lwgeom_gml.o lwgeom_kml.o lwgeom_geojson.o lwgeom_triggers.o lwgeom_dump.o lwgeom_functions_lrs.o long_xact.o lwgeom_sqlmm.o lwgeom_rtree.o
dllwrap  -o postgis-1.5.dll --dllname postgis-1.5.dll  --def libpostgis-1.5dll.def lwgeom_pg.o lwgeom_debug.o lwgeom_accum.o lwgeom_spheroid.o lwgeom_ogc.o lwgeom_functions_analytic.o lwgeom_inout.o lwgeom_estimate.o lwgeom_functions_basic.o lwgeom_gist.o lwgeom_btree.o lwgeom_transform.o lwgeom_box.o lwgeom_box3d.o lwgeom_box2dfloat4.o lwgeom_chip.o lwgeom_geos.o lwgeom_geos_prepared.o lwgeom_svg.o lwgeom_gml.o lwgeom_kml.o lwgeom_geojson.o lwgeom_triggers.o lwgeom_dump.o lwgeom_functions_lrs.o long_xact.o lwgeom_sqlmm.o lwgeom_rtree.o -Lc:/pg84/lib -lpostgres -L/c/pg84/lib -L/c/proj/lib -Lc:/pg84/lib -lgeos_c -lproj ../liblwgeom/liblwgeom.a
lwgeom_geos.o:lwgeom_geos.c:(.text+0x3624): undefined reference to `strtok_r'
lwgeom_geos.o:lwgeom_geos.c:(.text+0x3644): undefined reference to `strtok_r'
lwgeom_geos.o:lwgeom_geos.c:(.text+0x3667): undefined reference to `strtok_r'
collect2: ld returned 1 exit status
c:\mingw\bin\dllwrap.exe: c:\mingw\bin\gcc exited with status 1
make[1]: *** [postgis-1.5.dll] Error 1
make[1]: Leaving directory `/c/thesrc/pg15/postgis'
make: *** [postgis] Error 2

_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

Re: Problem compiling with MinGW from SVN

by strk-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Jul 05, 2009 at 12:35:25PM +0200, nicklas.aven@... wrote:
>
> Hallo
>  
> I tried to compile from SVN wich has worked great before. I think the problem is strtok_r() used in lwgeom_geos, that is supposed to be found in string.h as I understand it. In my version in MinGW there is no strtok_r() in string.h, but strtok(). Is it a problem of versions or?

According to my manual page, strtok_r is compatible with POSIX.1-2001.
The non _r version is not reentrant, if other developers are fine with
that I could change to use it.

--strk;

 Free GIS & Flash consultant/developer      ()  ASCII Ribbon Campaign
 http://foo.keybit.net/~strk/services.html  /\  Keep it simple!
_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

Re: Problem compiling with MinGW from SVN

by strk-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nicklas,
Please try the attached patch, it uses the non-reentrant version
and manual scans for the inner loop. We shouldn't really need
reentrancy in postgis ...

--strk;

 Free GIS & Flash consultant/developer      ()  ASCII Ribbon Campaign
 http://foo.keybit.net/~strk/services.html  /\  Keep it simple!

On Sun, Jul 05, 2009 at 02:32:54PM +0200, strk wrote:
> On Sun, Jul 05, 2009 at 12:35:25PM +0200, nicklas.aven@... wrote:
> >
> > Hallo
> >  
> > I tried to compile from SVN wich has worked great before. I think the problem is strtok_r() used in lwgeom_geos, that is supposed to be found in string.h as I understand it. In my version in MinGW there is no strtok_r() in string.h, but strtok(). Is it a problem of versions or?
>
> According to my manual page, strtok_r is compatible with POSIX.1-2001.
> The non _r version is not reentrant, if other developers are fine with
> that I could change to use it.

Index: postgis/lwgeom_geos.c
===================================================================
--- postgis/lwgeom_geos.c (revision 4261)
+++ postgis/lwgeom_geos.c (working copy)
@@ -862,7 +862,6 @@
  int joinStyle  = DEFAULT_JOIN_STYLE;
  char *param;
  char *params = NULL;
- char *saveptr = NULL;
 
 
  PROFSTART(PROF_QRUN);
@@ -887,24 +886,21 @@
 
  for (param=params; ; param=NULL)
  {
- char *saveptr2, *key, *val;
- param = strtok_r(param, " ", &saveptr);
+ char *key, *val;
+ param = strtok(param, " ");
  if ( param == NULL ) break;
- /* lwnotice("Param: %s", param); */
+ POSTGIS_DEBUGF(3, "Param: %s", param);
 
- key = strtok_r(param, "=", &saveptr2);
- if ( key == NULL ) {
- lwerror("Malformed buffer parameter");
- break;
- }
- val = strtok_r(NULL, "=", &saveptr2);
- if ( val == NULL ) {
+ key = param;
+ val = strchr(key, '=');
+ if ( val == NULL || *(val+1) == '\0' ) {
  lwerror("Missing value for buffer "
         "parameter %s", key);
  break;
  }
+ *val = '\0'; ++val;
 
- /* lwnotice("Param: %s : %s", key, val); */
+ POSTGIS_DEBUGF(3, "Param: %s : %s", key, val);
 
  if ( !strcmp(key, "endcap") )
  {
@@ -926,7 +922,7 @@
  else
  {
  lwerror("Invalid buffer end cap "
-        "style: %s (accept "
+        "style: %s (accept: "
         "'round', 'flat' or 'square'"
         ")", val);
  break;
@@ -950,7 +946,7 @@
  else
  {
  lwerror("Invalid buffer end cap "
-        "style: %s (accept "
+        "style: %s (accept: "
         "'round', 'mitre' or 'bevel'"
         ")", val);
  break;
@@ -968,7 +964,7 @@
  }
  else
  {
- lwerror("Invalid buffer parameter: %s (accept"
+ lwerror("Invalid buffer parameter: %s (accept: "
         "'endcap', 'join', 'mitre_limit' and "
         "'quad_segs')", key);
  break;

_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

Re: Problem compiling with MinGW from SVN

by strk-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

FYI: I committed the patch to r4262.

--strk;

On Mon, Jul 06, 2009 at 05:52:38PM +0200, strk wrote:
> Nicklas,
> Please try the attached patch, it uses the non-reentrant version
> and manual scans for the inner loop. We shouldn't really need
> reentrancy in postgis ...
_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel

Parent Message unknown Re: Problem compiling with MinGW from SVN

by Nicklas Avén :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, it seems to work :-)
 
/Nicklas

2009-07-06 strk wrote:

FYI: I committed the patch to r4262.
>
>--strk;
>
>On Mon, Jul 06, 2009 at 05:52:38PM +0200, strk wrote:
>> Nicklas,
>> Please try the attached patch, it uses the non-reentrant version
>> and manual scans for the inner loop. We shouldn't really need
>> reentrancy in postgis ...
>
>

_______________________________________________
postgis-devel mailing list
postgis-devel@...
http://postgis.refractions.net/mailman/listinfo/postgis-devel