public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Building the python swig tutorial
@ 2021-03-27 12:58 Brad Bell
  2021-03-27 15:09 ` Hans-Bernhard Bröker
  2021-03-27 15:36 ` Marco Atzeri
  0 siblings, 2 replies; 5+ messages in thread
From: Brad Bell @ 2021-03-27 12:58 UTC (permalink / raw)
  To: cygwin

I am trying to build the swig tutorial on cygwin
http://www.swig.org/tutorial.html <http://www.swig.org/tutorial.html>

I changed the version of python to python3.8 (the version on my cygwin system) and that solved the 
include file error.

Now I am getting the following error during the ld command:

ld: example.o:example.c:(.text+0x54): undefined reference to `time'
example.o:example.c:(.text+0x54): relocation truncated to fit: R_X86_64_PC32 against undefined 
symbol `time'
ld: example.o:example.c:(.text+0x60): undefined reference to `ctime'
example.o:example.c:(.text+0x60): relocation truncated to fit: R_X86_64_PC32 against undefined 
symbol `ctime'

... snip ...

ld: example_wrap.o:example_wrap.c:(.rdata+0x750): undefined reference to `PyObject_GenericGetAttr'
ld: example_wrap.o:example_wrap.c:(.rdata+0x8f0): undefined reference to `PyObject_GenericGetAttr'
ld: 
example_wrap.o:example_wrap.c:(.rdata$.refptr.PyObject_GenericGetAttr[.refptr.PyObject_GenericGetAttr]+0x0): 
undefined reference to `PyObject_GenericGetAttr'


It appeard that I need to add an non-standard location to a path so that the linker can find these 
files ?

Does someone know where these files are on cygwin ?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Building the python swig tutorial
  2021-03-27 12:58 Building the python swig tutorial Brad Bell
@ 2021-03-27 15:09 ` Hans-Bernhard Bröker
  2021-03-28 12:22   ` Brad Bell
  2021-03-27 15:36 ` Marco Atzeri
  1 sibling, 1 reply; 5+ messages in thread
From: Hans-Bernhard Bröker @ 2021-03-27 15:09 UTC (permalink / raw)
  To: cygwin

Am 27.03.2021 um 13:58 schrieb Brad Bell:

> It appeard that I need to add an non-standard location to a path so that 
> the linker can find these files ?

Read those error messages again.  It's failing to find things _in_ any 
of those files, which means it did in fact find all files it was looking 
for just fine.

So no, this is almost certainly no issue with locations of files.  It's 
an issue of not telling the linker that it's supposed to be looking for 
certain libraries in the first place.

But it's virtually impossible to diagnose this sensibly, as you opted 
not to show any of the actual command(s) you used.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Building the python swig tutorial
  2021-03-27 12:58 Building the python swig tutorial Brad Bell
  2021-03-27 15:09 ` Hans-Bernhard Bröker
@ 2021-03-27 15:36 ` Marco Atzeri
  1 sibling, 0 replies; 5+ messages in thread
From: Marco Atzeri @ 2021-03-27 15:36 UTC (permalink / raw)
  To: cygwin

On 27.03.2021 13:58, Brad Bell wrote:
> I am trying to build the swig tutorial on cygwin
> http://www.swig.org/tutorial.html <http://www.swig.org/tutorial.html>
> 
> I changed the version of python to python3.8 (the version on my cygwin 
> system) and that solved the include file error.

have you installed the last swig package ?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Building the python swig tutorial
  2021-03-27 15:09 ` Hans-Bernhard Bröker
@ 2021-03-28 12:22   ` Brad Bell
  2021-03-28 15:07     ` Marco Atzeri
  0 siblings, 1 reply; 5+ messages in thread
From: Brad Bell @ 2021-03-28 12:22 UTC (permalink / raw)
  To: cygwin

It was unclear from my previous message that I am using the commands under the heading
     Building a Python Module
in the tutorial
     http://www.swig.org/tutorial.html
with the exception that python2.7 was changed to python3.8 because that is the version of python on 
my cygwin system.

These commands work fine on my Fedora system (with the proper version of python and without any 
extra libraries specified).

On 3/27/21 8:09 AM, Hans-Bernhard Bröker wrote:
> Am 27.03.2021 um 13:58 schrieb Brad Bell:
> 
>> It appeard that I need to add an non-standard location to a path so that the linker can find these 
>> files ?
> 
> Read those error messages again.  It's failing to find things _in_ any of those files, which means 
> it did in fact find all files it was looking for just fine.
> 
> So no, this is almost certainly no issue with locations of files.  It's an issue of not telling the 
> linker that it's supposed to be looking for certain libraries in the first place.
> 
> But it's virtually impossible to diagnose this sensibly, as you opted not to show any of the actual 
> command(s) you used.
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Building the python swig tutorial
  2021-03-28 12:22   ` Brad Bell
@ 2021-03-28 15:07     ` Marco Atzeri
  0 siblings, 0 replies; 5+ messages in thread
From: Marco Atzeri @ 2021-03-28 15:07 UTC (permalink / raw)
  To: cygwin

On 28.03.2021 14:22, Brad Bell wrote:
> It was unclear from my previous message that I am using the commands 
> under the heading
>      Building a Python Module
> in the tutorial
>      http://www.swig.org/tutorial.html
> with the exception that python2.7 was changed to python3.8 because that 
> is the version of python on my cygwin system.
> 
> These commands work fine on my Fedora system (with the proper version of 
> python and without any extra libraries specified).
> 

what error ?

The Tutorial needs small adjustments for what I see:


$ swig -python -py3 example.i

$ gcc -c example.c example_wrap.c -I/usr/include/python3.8

$ gcc -shared example.o example_wrap.o -o _example.dll -lpython3.8

$ python
Python 3.8.8 (default, Mar  4 2021, 21:24:42)
[GCC 10.2.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import example
 >>> example.fact(5)
120


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-28 15:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-27 12:58 Building the python swig tutorial Brad Bell
2021-03-27 15:09 ` Hans-Bernhard Bröker
2021-03-28 12:22   ` Brad Bell
2021-03-28 15:07     ` Marco Atzeri
2021-03-27 15:36 ` Marco Atzeri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).