Open acejam opened 11 years ago
Hmm, yeah, I think I wasn't able to get all the modules to compile. I may have just commented out the socket module. Sorry I can't be more help.
On Fri, Aug 2, 2013 at 9:58 PM, acejam notifications@github.com wrote:
Hey,
I followed your "Compiling python with emscripten" wiki page exactly, step-by-step. I'm 95% of the way there trying to compile Python 2.7.5. I have tried Python 2.7.4 as well and I get the exact same errors, so I suspect I'm just missing a system package or library in general. Building the _socket module seems to be failing. Did you ever come across this issue?
Stack trace from a 2.7.5 modules build:
Building _socket... emcc -fPIC -fno-strict-aliasing -I.. -IInclude -I ../Include -I../Modules/expat -Wstrict-prototypes ../Modules/socketmodule.c -o socketmodule.c.o clang: warning: argument unused during compilation: '-nostdinc++' In file included from ../Modules/socketmodule.c:355: ../Modules/getaddrinfo.c:267:22: error: use of undeclared identifier 'PF_UNSPEC' pai->ai_family = PF_UNSPEC; ^ ../Modules/getaddrinfo.c:286:14: error: use of undeclared identifier 'PF_UNSPEC' case PF_UNSPEC: ^ ../Modules/getaddrinfo.c:362:23: warning: implicit declaration of function 'getservbyname' is invalid in C99 [-Wimplicit-function-declaration] if ((sp = getservbyname(servname, proto)) == NULL) ^ ../Modules/getaddrinfo.c:362:21: warning: incompatible integer to pointer conversion assigning to 'struct servent ' from 'int' [-Wint-conversion] if ((sp = getservbyname(servname, proto)) == NULL) ^
~~~~~~../Modules/getaddrinfo.c:364:22: error: incomplete definition of type 'struct servent' port = sp->s_port; ^ ../Modules/getaddrinfo.c:344:20: note: forward declaration of 'struct servent' struct servent sp; ^ ../Modules/getaddrinfo.c:366:30: error: incomplete definition of type 'struct servent' if (strcmp(sp->s_proto, "udp") == 0) { ~~^ ../Modules/getaddrinfo.c:344:20: note: forward declaration of 'struct servent' struct servent sp; ^ ../Modules/getaddrinfo.c:369:37: error: incomplete definition of type 'struct servent' } else if (strcmp(sp->s_proto, "tcp") == 0) { ~~^ ../Modules/getaddrinfo.c:344:20: note: forward declaration of 'struct servent' struct servent sp; ^ ../Modules/getaddrinfo.c:387:37: error: use of undeclared identifier 'PF_UNSPEC' if (!(pai->ai_family == PF_UNSPEC ^ ../Modules/getaddrinfo.c:427:25: error: use of undeclared identifier 'IN_CLASSA_NSHIFT' v4a >>= IN_CLASSA_NSHIFT; ^ ../Modules/getaddrinfo.c:441:35: error: use of undeclared identifier 'PF_UNSPEC' pai->ai_family == PF_UNSPEC) { ^ ../Modules/socketmodule.c:900:32: error: use of undeclared identifier 'INADDR_BROADCAST' sin->sin_addr.s_addr = INADDR_BROADCAST; ^ ../Modules/socketmodule.c:965:9: error: use of undeclared identifier 'NI_NUMERICHOST' NI_NUMERICHOST); ^ ../Modules/socketmodule.c:1222:36: error: invalid application of 'sizeof' to an incomplete type 'char []' sizeof(addr->sa_data)); ^~~~~ ../Modules/socketmodule.c:1055:10: error: duplicate case value '1' case AF_UNIX: ^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:18:17: note: expanded from macro 'AF_UNIX'define AF_UNIX PF_UNIX
^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:15:17: note: expanded from macro 'PF_UNIX'
define PF_UNIX PF_LOCAL
^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:14:18: note: expanded from macro 'PF_LOCAL'
define PF_LOCAL 1
^ ../Modules/socketmodule.c:1041:10: note: previous case defined here case AF_INET: ^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:41:17: note: expanded from macro 'AF_INET'
define AF_INET 1
^ ../Modules/socketmodule.c:1304:10: error: duplicate case value '1' case AF_INET: ^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:41:17: note: expanded from macro 'AF_INET'
define AF_INET 1
^ ../Modules/socketmodule.c:1240:10: note: previous case defined here case AF_UNIX: ^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:18:17: note: expanded from macro 'AF_UNIX'
define AF_UNIX PF_UNIX
^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:15:17: note: expanded from macro 'PF_UNIX'
define PF_UNIX PF_LOCAL
^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:14:18: note: expanded from macro 'PF_LOCAL'
define PF_LOCAL 1
^ ../Modules/socketmodule.c:1622:10: error: duplicate case value '1' case AF_INET: ^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:41:17: note: expanded from macro 'AF_INET'
define AF_INET 1
^ ../Modules/socketmodule.c:1608:10: note: previous case defined here case AF_UNIX: ^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:18:17: note: expanded from macro 'AF_UNIX'
define AF_UNIX PF_UNIX
^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:15:17: note: expanded from macro 'PF_UNIX'
define PF_UNIX PF_LOCAL
^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:14:18: note: expanded from macro 'PF_LOCAL'
define PF_LOCAL 1
^ ../Modules/socketmodule.c:3601:8: warning: incompatible integer to pointer conversion assigning to 'struct servent ' from 'int' [-Wint-conversion] sp = getservbyname(name, proto); ^
~~~~~~ ../Modules/socketmodule.c:3607:42: error: incomplete definition of type 'struct servent' return PyInt_FromLong((long) ntohs(sp->s_port)); ^ ../Modules/socketmodule.c:3597:12: note: forward declaration of 'struct servent' struct servent sp; ^ ../Modules/socketmodule.c:3638:10: warning: implicit declaration of function 'getservbyport' is invalid in C99 [-Wimplicit-function-declaration] sp = getservbyport(htons((short)port), proto); ^ ../Modules/socketmodule.c:3638:8: warning: incompatible integer to pointer conversion assigning to 'struct servent ' from 'int' [-Wint-conversion] sp = getservbyport(htons((short)port), proto); ^~~~~~~~~~~ ../Modules/socketmodule.c:3644:34: error: incomplete definition of type 'struct servent' return PyString_FromString(sp->s_name); ^ ../Modules/socketmodule.c:3628:12: note: forward declaration of 'struct servent' struct servent sp; ^ ../Modules/socketmodule.c:3672:10: warning: implicit declaration of function 'getprotobyname' is invalid in C99 [-Wimplicit-function-declaration] sp = getprotobyname(name); ^ ../Modules/socketmodule.c:3672:8: warning: incompatible integer to pointer conversion assigning to 'struct protoent ' from 'int' [-Wint-conversion] sp = getprotobyname(name); ^~~~~~~ ../Modules/socketmodule.c:3678:36: error: incomplete definition of type 'struct protoent' return PyInt_FromLong((long) sp->p_proto); ^ ../Modules/socketmodule.c:3663:12: note: forward declaration of 'struct protoent' struct protoent sp; ^ ../Modules/socketmodule.c:3948:28: warning: incompatible pointer types passing 'struct in_addr ' to parameter of type 'struct in_addr ' [-Wincompatible-pointer-types] if (inet_aton(ip_addr, &buf)) ^~ /vagrant/python-sandbox/emscripten/system/include/net/arpa/inet.h:18:47: note: passing argument to parameter 'addr' here int inet_aton(const char cp, struct in_addr addr); ^ ../Modules/socketmodule.c:4012:42: error: argument type 'struct in_addr' is incomplete return PyString_FromString(inet_ntoa(packed_addr)); ^~~/vagrant/python-sandbox/emscripten/system/include/net/arpa/inet.h:19:24: note: forward declaration of 'struct in_addr' char *inet_ntoa(struct in_addr in); ^ 8 warnings and 18 errors generated. ERROR emcc: compiler frontend failed to generate LLVM bitcode, halting Reply to this email directly or view it on GitHubhttps://github.com/jallwine/emscripten_test/issues/1 .
Hey,
I followed your "Compiling python with emscripten" wiki page exactly, step-by-step. I'm 95% of the way there trying to compile Python 2.7.5. I have tried Python 2.7.4 as well and I get the exact same errors, so I suspect I'm just missing a system package or library in general. Building the _socket module seems to be failing. Did you ever come across this issue?
Stack trace from a 2.7.5 modules build:
Building _socket... emcc -fPIC -fno-strict-aliasing -I.. -IInclude -I ../Include -I../Modules/expat -Wstrict-prototypes ../Modules/socketmodule.c -o socketmodule.c.o clang: warning: argument unused during compilation: '-nostdinc++' In file included from ../Modules/socketmodule.c:355: ../Modules/getaddrinfo.c:267:22: error: use of undeclared identifier 'PF_UNSPEC' pai->ai_family = PF_UNSPEC; ^ ../Modules/getaddrinfo.c:286:14: error: use of undeclared identifier 'PF_UNSPEC' case PF_UNSPEC: ^ ../Modules/getaddrinfo.c:362:23: warning: implicit declaration of function 'getservbyname' is invalid in C99 [-Wimplicit-function-declaration] if ((sp = getservbyname(servname, proto)) == NULL) ^ ../Modules/getaddrinfo.c:362:21: warning: incompatible integer to pointer conversion assigning to 'struct servent ' from 'int' [-Wint-conversion] if ((sp = getservbyname(servname, proto)) == NULL) ^
~~~~~~../Modules/getaddrinfo.c:364:22: error: incomplete definition of type 'struct servent' port = sp->s_port; ~~^ ../Modules/getaddrinfo.c:344:20: note: forward declaration of 'struct servent' struct servent sp; ^ ../Modules/getaddrinfo.c:366:30: error: incomplete definition of type 'struct servent' if (strcmp(sp->s_proto, "udp") == 0) { ~~^ ../Modules/getaddrinfo.c:344:20: note: forward declaration of 'struct servent' struct servent sp; ^ ../Modules/getaddrinfo.c:369:37: error: incomplete definition of type 'struct servent' } else if (strcmp(sp->s_proto, "tcp") == 0) { ~~^ ../Modules/getaddrinfo.c:344:20: note: forward declaration of 'struct servent' struct servent sp; ^ ../Modules/getaddrinfo.c:387:37: error: use of undeclared identifier 'PF_UNSPEC' if (!(pai->ai_family == PF_UNSPEC ^ ../Modules/getaddrinfo.c:427:25: error: use of undeclared identifier 'IN_CLASSA_NSHIFT' v4a >>= IN_CLASSA_NSHIFT; ^ ../Modules/getaddrinfo.c:441:35: error: use of undeclared identifier 'PF_UNSPEC' pai->ai_family == PF_UNSPEC) { ^ ../Modules/socketmodule.c:900:32: error: use of undeclared identifier 'INADDR_BROADCAST' sin->sin_addr.s_addr = INADDR_BROADCAST; ^ ../Modules/socketmodule.c:965:9: error: use of undeclared identifier 'NI_NUMERICHOST' NI_NUMERICHOST); ^ ../Modules/socketmodule.c:1222:36: error: invalid application of 'sizeof' to an incomplete type 'char []' sizeof(addr->sa_data)); ^~~~~~~ ../Modules/socketmodule.c:1055:10: error: duplicate case value '1' case AF_UNIX: ^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:18:17: note: expanded from macro 'AF_UNIX'define AF_UNIX PF_UNIX
/vagrant/python-sandbox/emscripten/system/include/sys/socket.h:15:17: note: expanded from macro 'PF_UNIX'
define PF_UNIX PF_LOCAL
/vagrant/python-sandbox/emscripten/system/include/sys/socket.h:14:18: note: expanded from macro 'PF_LOCAL'
define PF_LOCAL 1
../Modules/socketmodule.c:1041:10: note: previous case defined here case AF_INET: ^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:41:17: note: expanded from macro 'AF_INET'
define AF_INET 1
../Modules/socketmodule.c:1304:10: error: duplicate case value '1' case AF_INET: ^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:41:17: note: expanded from macro 'AF_INET'
define AF_INET 1
../Modules/socketmodule.c:1240:10: note: previous case defined here case AF_UNIX: ^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:18:17: note: expanded from macro 'AF_UNIX'
define AF_UNIX PF_UNIX
/vagrant/python-sandbox/emscripten/system/include/sys/socket.h:15:17: note: expanded from macro 'PF_UNIX'
define PF_UNIX PF_LOCAL
/vagrant/python-sandbox/emscripten/system/include/sys/socket.h:14:18: note: expanded from macro 'PF_LOCAL'
define PF_LOCAL 1
../Modules/socketmodule.c:1622:10: error: duplicate case value '1' case AF_INET: ^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:41:17: note: expanded from macro 'AF_INET'
define AF_INET 1
../Modules/socketmodule.c:1608:10: note: previous case defined here case AF_UNIX: ^ /vagrant/python-sandbox/emscripten/system/include/sys/socket.h:18:17: note: expanded from macro 'AF_UNIX'
define AF_UNIX PF_UNIX
/vagrant/python-sandbox/emscripten/system/include/sys/socket.h:15:17: note: expanded from macro 'PF_UNIX'
define PF_UNIX PF_LOCAL
/vagrant/python-sandbox/emscripten/system/include/sys/socket.h:14:18: note: expanded from macro 'PF_LOCAL'
define PF_LOCAL 1
../Modules/socketmodule.c:3601:8: warning: incompatible integer to pointer conversion assigning to 'struct servent ' from 'int' [-Wint-conversion] sp = getservbyname(name, proto); ^
~~~~~~ ../Modules/socketmodule.c:3607:42: error: incomplete definition of type 'struct servent' return PyInt_FromLong((long) ntohs(sp->s_port)); ~~^ ../Modules/socketmodule.c:3597:12: note: forward declaration of 'struct servent' struct servent sp; ^ ../Modules/socketmodule.c:3638:10: warning: implicit declaration of function 'getservbyport' is invalid in C99 [-Wimplicit-function-declaration] sp = getservbyport(htons((short)port), proto); ^ ../Modules/socketmodule.c:3638:8: warning: incompatible integer to pointer conversion assigning to 'struct servent ' from 'int' [-Wint-conversion] sp = getservbyport(htons((short)port), proto); ^~~~~~~~~../Modules/socketmodule.c:3644:34: error: incomplete definition of type 'struct servent' return PyString_FromString(sp->s_name); ~~^ ../Modules/socketmodule.c:3628:12: note: forward declaration of 'struct servent' struct servent sp; ^ ../Modules/socketmodule.c:3672:10: warning: implicit declaration of function 'getprotobyname' is invalid in C99 [-Wimplicit-function-declaration] sp = getprotobyname(name); ^ ../Modules/socketmodule.c:3672:8: warning: incompatible integer to pointer conversion assigning to 'struct protoent ' from 'int' [-Wint-conversion] sp = getprotobyname(name); ^~~~~../Modules/socketmodule.c:3678:36: error: incomplete definition of type 'struct protoent' return PyInt_FromLong((long) sp->p_proto); ~~^ ../Modules/socketmodule.c:3663:12: note: forward declaration of 'struct protoent' struct protoent sp; ^ ../Modules/socketmodule.c:3948:28: warning: incompatible pointer types passing 'struct in_addr ' to parameter of type 'struct in_addr ' [-Wincompatible-pointer-types] if (inet_aton(ip_addr, &buf)) ^~~~ /vagrant/python-sandbox/emscripten/system/include/net/arpa/inet.h:18:47: note: passing argument to parameter 'addr' here int inet_aton(const char cp, struct in_addr addr); ^ ../Modules/socketmodule.c:4012:42: error: argument type 'struct in_addr' is incomplete return PyString_FromString(inet_ntoa(packed_addr)); ^~~/vagrant/python-sandbox/emscripten/system/include/net/arpa/inet.h:19:24: note: forward declaration of 'struct in_addr' char *inet_ntoa(struct in_addr in); ^ 8 warnings and 18 errors generated. ERROR emcc: compiler frontend failed to generate LLVM bitcode, halting