delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/08/02/16:27:24

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: r <r DOT trev_ AT inwind DOT it>
Subject: Re: Compile
Date: Sat, 2 Aug 2008 20:26:26 +0000 (UTC)
Lines: 72
Message-ID: <g72fti$au8$1@ger.gmane.org>
References: <g70f8q$jiu$1 AT ger DOT gmane DOT org> <48948F50 DOT 6A917ED0 AT dessent DOT net>
Mime-Version: 1.0
User-Agent: slrn/pre0.9.9-112/mm/ao (Win32)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 2008-08-02, Brian Dessent <brian AT dessent DOT net> wrote:
> r wrote:
>
>> I'm trying to compile a wonderful program ( command line ) to grab
>> videoes from youtube. It needs newt, a little utility. But when I try to
>> compile this utility I have the follewing errors :
>> ...
>> snackmodule.c:126: error: initializer element is not constant
>> snackmodule.c:126: error: (near initialization for `snackGridType.ob_type')
>> snackmodule.c:168: error: initializer element is not constant
>> snackmodule.c:168: error: (near initialization for `snackFormType.ob_type')
>> snackmodule.c:255: error: initializer element is not constant
>> snackmodule.c:255: error: (near initialization for `snackWidgetType.ob_type')
>> make: *** [_snackmodule_la-snackmodule.lo] Error 1
>> 
>> Do you know if it is an unrecoverable error ( a limitation of cygwin )
>> that will not permit to install this utility ?
>
> In the future, you could save a lot of time on the part of people that
> might wish to help you by either pasting the contents of the above
> mentioned lines or providing a link to the source tarball.  Or at the
> very least specify the version you're trying to build.  Also, a proper
> subject usually helps.

ok, sorry 



>
> The offending construct is this:
>
> static PyTypeObject snackFormType = {
>         PyObject_HEAD_INIT(&PyType_Type)
>
> PyType_Type is an object declared dllimport in Python.h as it's provided
> by the main python DLL.  This is one of those differences between ELF
> and PE, the address of a symbol from a shared library cannot be used as
> a constant initializer in PE.  The testcase boils down to this:
>
> $ cat >tc.c <<EOF
> extern __attribute__((dllimport)) int fromdll;
>
> typedef struct { int *foo; } foo_t;
>
> static foo_t foo = { &fromdll };
> EOF
>
> $ gcc -c tc.c
> tc.c:5: error: initializer element is not constant
> tc.c:5: error: (near initialization for `foo.foo')
>
> A little googling shows that apparently you can supply 0 to this
> HEAD_INIT macro and the field will be initialized with the proper value
> at runtime.  Google code search shows some instances where they define a
> macro for this for documentation purposes:
>
> #define DEFERRED_ADDRESS(ADDR) 0
> ...
> static PyTypeObject foo = {
> 	PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type))
>
> So, that would probably be the first workaround I'd try for porting this
> library to PE.
>
> Brian

ok Brian, in fact the firs error it is solved so, I'm looking for solve
other problems






--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019