problems compiling simple SWIG example

belinda thom bthom at cs.hmc.edu
Sat Nov 11 21:35:20 PST 2006


Hi,

I've successfully installed SWIG via macports. I then try to run a  
very simple example as recommended in the manual (sect 2.3) http:// 
www.swig.org/Doc1.3/Introduction.html#Introduction_nn4.

I can successfully run:

swig -tcl example.i

But I run into problems compiling things. In particular,

gcc -c -fpic example.c example_wrap.c -I/usr/local/include

complains that -fpic isn't supported (and -fPIC is assumed).

gcc -shared example.o example_wrap.o -o example.so

doesn't run at all. complaints include: -shared not supported. the  
loader exits b/c many symbols are undefined (e.g. _main, _TclFreeObj,  
many other Tcl-related names).

I posted to the SWIG users group at sourceforge to find out what  
tricks one needs to play with gcc on OS X (assuming that flag usage  
is the problem) and they told me:

 >SWIG should correctly configure itself to build examples and tests  
on OS-X.
 >Look in the Examples directory and copy the compiler/linker flags  
that are used.

When I asked for where this directory lies, I was told:

 >SWIG/Examples
 >Should be part of every SWIG source distribution (download from  
www.swig.org).

I can't find any examples in the distribution I received. I could  
also not find any source. According to port:

6 % port contents swig
Port swig contains:
   /opt/local/bin/swig
   /opt/local/share/swig/1.3.29/allegrocl/allegrocl.swg
   [snip]
   /opt/local/share/swig/1.3.29/windows.i

I installed swig via sudo port -vd install swig (note: no clean flags  
were requested).

Please advise and thanks for the help.

--b
  
  



More information about the macports-users mailing list