[GRASS-dev] swig python compilation error in utils_wrap.c

Hi,

I have been downloading the latest GRASS 6.4 svn snapshot and tried to
compile it
on Mandriva 2010.0/64bit as RPM packages from their SPEC file. All except for
this one compiles:

make[1]: Entering directory
`/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python'
c++ -shared -o _utils.so
-L/root/rpmbuild/BUILD/grass-6.4.0RC6pre/dist.x86_64-mandriva-linux-gnu/lib
-Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,--export-dynamic
-Wl,-rpath-link,/root/rpmbuild/BUILD/grass-6.4.0RC6pre/dist.x86_64-mandriva-linux-gnu/lib
     -L/root/rpmbuild/BUILD/grass-6.4.0RC6pre/dist.x86_64-mandriva-linux-gnu/lib
-ldl -lpthread -lpthread -lpthread -lpthread -lutil -lm -lpython2.6
OBJ.x86_64-mandriva-linux-gnu/utils_wrap.o
OBJ.x86_64-mandriva-linux-gnu/utils_wrap.o: In function
`SWIG_Python_ErrorType':
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:919:
undefined reference to `PyExc_RuntimeError'
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:892:
undefined reference to `PyExc_RuntimeError'
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:889:
undefined reference to `PyExc_IOError'
...

Any ideas? Is a change in swig/include/python/utils.i needed?

thanks
Markus

I am getting something like this when compiling GRASS65 on RedHat Linux,
but GRASS runs fine (at least the modules that I use),

Helena

On Feb 26, 2010, at 10:46 AM, Markus Neteler wrote:

Hi,

I have been downloading the latest GRASS 6.4 svn snapshot and tried to
compile it
on Mandriva 2010.0/64bit as RPM packages from their SPEC file. All except for
this one compiles:

make[1]: Entering directory
`/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python'
c++ -shared -o _utils.so
-L/root/rpmbuild/BUILD/grass-6.4.0RC6pre/dist.x86_64-mandriva-linux-gnu/lib
-Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,--export-dynamic
-Wl,-rpath-link,/root/rpmbuild/BUILD/grass-6.4.0RC6pre/dist.x86_64-mandriva-linux-gnu/lib
    -L/root/rpmbuild/BUILD/grass-6.4.0RC6pre/dist.x86_64-mandriva-linux-gnu/lib
-ldl -lpthread -lpthread -lpthread -lpthread -lutil -lm -lpython2.6
OBJ.x86_64-mandriva-linux-gnu/utils_wrap.o
OBJ.x86_64-mandriva-linux-gnu/utils_wrap.o: In function
`SWIG_Python_ErrorType':
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:919:
undefined reference to `PyExc_RuntimeError'
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:892:
undefined reference to `PyExc_RuntimeError'
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:889:
undefined reference to `PyExc_IOError'
...

Any ideas? Is a change in swig/include/python/utils.i needed?

thanks
Markus
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Markus Neteler wrote:

OBJ.x86_64-mandriva-linux-gnu/utils_wrap.o: In function `SWIG_Python_ErrorType':
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:919: undefined reference to `PyExc_RuntimeError'
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:892: undefined reference to `PyExc_RuntimeError'
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:889: undefined reference to `PyExc_IOError'
...

Any ideas? Is a change in swig/include/python/utils.i needed?

Those variables don't appear in the .i files; they only appear in the
code generated by SWIG. However, they do end up in all of the *_wrap.c
files.

As you're getting an error at link time, rather than compile time, I'd
suspect a library mismatch. I note that the only -L switches are those
which refer to dist.<arch>.

I also note that there is no utils_LIBS variable in
swig/python/Makefile (as it doesn't depend upon any GRASS libraries).
As everything except utils and date[1] has $(GISLIB) as a dependency
(directly or indirectly), I suspect that it may be fixed by defining
utils_LIBS as either some subset of $(XDRLIB) $(SOCKLIB) $(INTLLIB) or
as $(GISLIB).

[1] However, if the date module compiles, that undermines this theory.

Beyond that, I can only suggest comparing the successful linking
commands for the other modules against the failed command for the
utils module.

--
Glynn Clements <glynn@gclements.plus.com>

On Fri, Feb 26, 2010 at 9:58 PM, Glynn Clements
<glynn@gclements.plus.com> wrote:

Markus Neteler wrote:

OBJ.x86_64-mandriva-linux-gnu/utils_wrap.o: In function `SWIG_Python_ErrorType':
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:919: undefined reference to `PyExc_RuntimeError'
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:892: undefined reference to `PyExc_RuntimeError'
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:889: undefined reference to `PyExc_IOError'
...

Any ideas? Is a change in swig/include/python/utils.i needed?

Those variables don't appear in the .i files; they only appear in the
code generated by SWIG. However, they do end up in all of the *_wrap.c
files.

As you're getting an error at link time, rather than compile time, I'd
suspect a library mismatch.

It is a newly installed machine (if that matters).

I note that the only -L switches are those
which refer to dist.<arch>.

I also note that there is no utils_LIBS variable in
swig/python/Makefile (as it doesn't depend upon any GRASS libraries).
As everything except utils and date[1] has $(GISLIB) as a dependency
(directly or indirectly), I suspect that it may be fixed by defining
utils_LIBS as either some subset of $(XDRLIB) $(SOCKLIB) $(INTLLIB) or
as $(GISLIB).

I have tried this to no avail.

[1] However, if the date module compiles, that undermines this theory.

Beyond that, I can only suggest comparing the successful linking
commands for the other modules against the failed command for the
utils module.

Since I am a bit lost here, I have posted the full swig compile sequence
excerpt here:
http://osgeo.pastebin.com/JxVbCwMz

utils_wrap.c is compiled as well as the others. Perhaps you could take
another look?

thanks
Markus

On Fri, Feb 26, 2010 at 10:59 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Fri, Feb 26, 2010 at 9:58 PM, Glynn Clements
<glynn@gclements.plus.com> wrote:

Markus Neteler wrote:

OBJ.x86_64-mandriva-linux-gnu/utils_wrap.o: In function `SWIG_Python_ErrorType':
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:919: undefined reference to `PyExc_RuntimeError'
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:892: undefined reference to `PyExc_RuntimeError'
/root/rpmbuild/BUILD/grass-6.4.0RC6pre/swig/python/utils_wrap.c:889: undefined reference to `PyExc_IOError'
...

Any ideas? Is a change in swig/include/python/utils.i needed?

Those variables don't appear in the .i files; they only appear in the
code generated by SWIG. However, they do end up in all of the *_wrap.c
files.

As you're getting an error at link time, rather than compile time, I'd
suspect a library mismatch.

It is a newly installed machine (if that matters).

I note that the only -L switches are those
which refer to dist.<arch>.

I also note that there is no utils_LIBS variable in
swig/python/Makefile (as it doesn't depend upon any GRASS libraries).
As everything except utils and date[1] has $(GISLIB) as a dependency
(directly or indirectly), I suspect that it may be fixed by defining
utils_LIBS as either some subset of $(XDRLIB) $(SOCKLIB) $(INTLLIB) or
as $(GISLIB).

I have tried this to no avail.

[1] However, if the date module compiles, that undermines this theory.

Beyond that, I can only suggest comparing the successful linking
commands for the other modules against the failed command for the
utils module.

Since I am a bit lost here, I have posted the full swig compile sequence
excerpt here:
http://osgeo.pastebin.com/JxVbCwMz

utils_wrap.c is compiled as well as the others. Perhaps you could take
another look?

(above was the compilation as RPM, using a renamed snapshot:
rpmbuild -ba grass.spec [1]
)

When I compile locally/"manually", then it compiles fine (excerpt):
http://osgeo.pastebin.com/6QJveQV3
Apparently, there is a compiler flag in the RPM process which
disturbs the compilation of swig/python/.

Markus

[1] http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/grass/current/SPECS/grass.spec?view=markup

Markus Neteler wrote:

Since I am a bit lost here, I have posted the full swig compile sequence
excerpt here:
http://osgeo.pastebin.com/JxVbCwMz

utils_wrap.c is compiled as well as the others. Perhaps you could take
another look?

That only shows the linking of utils.so; the others have already been
built so there is nothing to compare it to.

You need to run "make clean" on that directory first.

--
Glynn Clements <glynn@gclements.plus.com>