lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] pylwIP - problems compiling on ubuntu 10.04


From: Amir Shalem
Subject: [lwip-users] pylwIP - problems compiling on ubuntu 10.04
Date: Tue, 18 Oct 2011 12:31:07 +0200

Hey

I'm working on pylwIP - Python bindings for lwIP, I still have some features left to add (setting hwaddr, more examples, tests, documention...) before making a first release

you can find the current sources at
https://github.com/amirshalem/pylwip

you can clone the repository, and build the module using: python setup.py build

it successfully compiles for python 2.6/7 on windows & visual studio
but,
on linux / Ubuntu 10.04 I still have some problems, which I'm not sure what is the solution:

1. struct timeval

In file included from socketmodule.h:8,
                 from socketmodule.c:153:
lwip/src/include/lwip/sockets.h:335: error: redefinition of ‘struct timeval’
error: command 'gcc' failed with exit status 1
address@hidden:/root/lwip/pylwip# 

I thought to add into my lwipopts.h

#ifndef WIN32
#define LWIP_TIMEVAL_PRIVATE 0
#endif

But maybe this should go in unix/arch/sys_arch.h instead?

------

2. h_errno in api/netdb.c

If I don't change anything, and have LWIP_DNS_API_DECLARE_H_ERRNO defined
the gcc compiler crashes!

collect2: ld terminated with signal 11 [Segmentation fault]
/usr/bin/ld: error: command 'gcc' failed with exit status 1

I believe this happens because h_errno internally in gcc/glibc is declare as:

 /* Error status for non-reentrant lookup functions.
   We use a macro to access always the thread-specific `h_errno' variable.  */
#define h_errno (*__h_errno_location ())

/* Function to get address of global `h_errno' variable.  */
extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));

I'm not sure what is the solution here...
I'm guessing I will have the problem if I will enable sockets.h set_errno() as-well.

------

3. missing ENSRNOTFOUND
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I. -Ilwip/src/include -Ilwip/src/include/ipv4 -Ilwip/src/include/ipv6 -Ilwip-contrib/ports/unix/include -I/usr/include/python2.6 -c lwip/src/api/netdb.c -o build/temp.linux-i686-2.6/lwip/src/api/netdb.o
lwip/src/api/netdb.c: In function ‘lwip_gethostbyname_r’:
lwip/src/api/netdb.c:203: error: ‘ENSRNOTFOUND’ undeclared (first use in this function)
lwip/src/api/netdb.c:203: error: (Each undeclared identifier is reported only once
lwip/src/api/netdb.c:203: error: for each function it appears in.)
error: command 'gcc' failed with exit status 1
address@hidden:/root/lwip/pylwip# 

I'm not sure what is the correct solution here...
Do note that this define is declared on Visual Studio2008 (and missing on ubuntu 10.04)

------

4. (This is windows problem), I got re-definitions of errno macros
1>lwip.c
1>c:\amirsh\pylwip\lwip\src\include\lwip\arch.h(113) : warning C4005: 'EDEADLK' : macro redefinition
1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\errno.h(72) : see previous definition of 'EDEADLK'
1>c:\amirsh\pylwip\lwip\src\include\lwip\arch.h(114) : warning C4005: 'ENAMETOOLONG' : macro redefinition
1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\errno.h(73) : see previous definition of 'ENAMETOOLONG'
1>c:\amirsh\pylwip\lwip\src\include\lwip\arch.h(115) : warning C4005: 'ENOLCK' : macro redefinition
1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\errno.h(74) : see previous definition of 'ENOLCK'
1>c:\amirsh\pylwip\lwip\src\include\lwip\arch.h(116) : warning C4005: 'ENOSYS' : macro redefinition
1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\errno.h(75) : see previous definition of 'ENOSYS'
1>c:\amirsh\pylwip\lwip\src\include\lwip\arch.h(117) : warning C4005: 'ENOTEMPTY' : macro redefinition
1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\errno.h(76) : see previous definition of 'ENOTEMPTY'
1>c:\amirsh\pylwip\lwip\src\include\lwip\arch.h(164) : warning C4005: 'EILSEQ' : macro redefinition
1>        c:\program files (x86)\microsoft visual studio 9.0\vc\include\errno.h(85) : see previous definition of 'EILSEQ'

Because lwip.c code includes both <Python.h> & <lwip/sockets.h> they both attempt to define errno values.
Please note that I can't #undef LWIP_PROVIDE_ERRNO, because Windows doesn't provide all macro values.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]