[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnulib and emscripten
From: |
Bruno Haible |
Subject: |
gnulib and emscripten |
Date: |
Sat, 11 Feb 2017 00:12:07 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-62-generic; KDE/5.18.0; x86_64; ; ) |
Hi,
emscripten [1][2] is a C runtime environment, where execution takes place in
JavaScript (NodeJS by default, but some things can also run inside a web
browser).
Just to see how it works out, I built it using the GNU Taler instructions
[3], created a gnulib testdir
$ ./gnulib-tool --create-testdir --dir=testdir-posix --with-tests
--single-configure `./posix-modules`
and ran it
$ emconfigure ./configure --host=asmjs-local-emscripten
$ emmake make
Observations
============
I. During the configure run:
I.1. getuid() apparently returns 0, which causes a test to bark:
checking whether mknod can create fifo without root privileges... configure:
error: in `/media/private+free/devel/GNULIB/testdir-posix-20170210':
configure: error: you should not run configure as root (set
FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
See `config.log' for more details
ERROR:root:Configure step failed with non-zero return code 1! Command line:
['./configure', '--host=asmjs-local-emscripten'] at
/media/private+free/devel/GNULIB/testdir-posix-20170210
I have to set FORCE_UNSAFE_CONFIGURE=1.
I.2. checking for working nanosleep... hangs (eating 100% CPU time)
I.3. checking for working sleep... hangs (eating 100% CPU time)
This looks like a bug in the sleep() and nanosleep() functions.
II. "make" failures:
II.1. In module 'fseeko':
fseeko.c:110:4: error: "Please port gnulib fseeko.c to your platform! Look at
the code in fseeko.c, then report this to bug-gnulib."
#error "Please port gnulib fseeko.c to your platform! Look at the code in
fseeko.c, then report this to bug-gnulib."
^
1 error generated.
II.2. In module 'glob':
glob.c:772:27: error: use of undeclared identifier 'malloc_pwtmpbuf'
if (malloc_pwtmpbuf == NULL)
^
glob.c:785:41: error: use of undeclared identifier 'pwtmpbuf'
free (pwtmpbuf);
^
glob.c:793:33: error: use of undeclared identifier 'pwtmpbuf'
free (pwtmpbuf);
^
glob.c:1003:31: error: use of undeclared identifier 'malloc_pwtmpbuf'
free (malloc_pwtmpbuf);
^
glob.c:1015:23: error: use of undeclared identifier 'malloc_pwtmpbuf'
free (malloc_pwtmpbuf);
^
glob.c:1019:23: error: use of undeclared identifier 'malloc_pwtmpbuf'
free (malloc_pwtmpbuf);
^
6 errors generated.
This looks like it is caused by the 2016-05-04 merge from glibc.
These two variables are declared only
if defined HAVE_GETPWNAM_R || defined _LIBC
but then are used unconditionally.
II.3. In module 'tsearch':
In file included from tsearch.c:98:
./search.h:416:3: error: redefinition of enumerator 'preorder'
preorder,
^
/media/private+free/devel/emsdk_portable/emscripten/master/system/include/libc/search.h:14:16:
note: previous definition is here
typedef enum { preorder, postorder, endorder, leaf } VISIT;
^
In file included from tsearch.c:98:
./search.h:417:3: error: redefinition of enumerator 'postorder'
postorder,
^
/media/private+free/devel/emsdk_portable/emscripten/master/system/include/libc/search.h:14:26:
note: previous definition is here
typedef enum { preorder, postorder, endorder, leaf } VISIT;
^
In file included from tsearch.c:98:
./search.h:418:3: error: redefinition of enumerator 'endorder'
endorder,
^
/media/private+free/devel/emsdk_portable/emscripten/master/system/include/libc/search.h:14:37:
note: previous definition is here
typedef enum { preorder, postorder, endorder, leaf } VISIT;
^
In file included from tsearch.c:98:
./search.h:419:3: error: redefinition of enumerator 'leaf'
leaf
^
/media/private+free/devel/emsdk_portable/emscripten/master/system/include/libc/search.h:14:47:
note: previous definition is here
typedef enum { preorder, postorder, endorder, leaf } VISIT;
^
In file included from tsearch.c:98:
./search.h:421:1: error: typedef redefinition with different types ('enum
VISIT' vs 'enum VISIT')
VISIT;
^
/media/private+free/devel/emsdk_portable/emscripten/master/system/include/libc/search.h:14:54:
note: previous definition is here
typedef enum { preorder, postorder, endorder, leaf } VISIT;
^
5 errors generated.
The reason is that this system has <search.h>, and it defines the 'VISIT' enum,
but it does not have the tsearch() function.
III. "make check" trouble
"emmake make check" does not generate executable files. To get something
executable,
I had to
- change EXEEXT = .js in Makefile,
- run the tests through a shell loop:
$ for f in test-*.js ; do echo $f ; node $f ; echo $?; done
I'm fixing only the 'tsearch' bug.
[1] https://en.wikipedia.org/wiki/Emscripten
[2] https://github.com/kripken/emscripten
[3] https://git.taler.net/libtalerutil-emscripten.git/tree/README
0001-search-Don-t-assume-that-tsearch-exists-if-VISIT-is-.patch
Description: Text Data
- gnulib and emscripten,
Bruno Haible <=