xlnt-wasm icon indicating copy to clipboard operation
xlnt-wasm copied to clipboard

compiling the project

Open wstucco opened this issue 5 years ago • 10 comments

I'm trying to compile this project

I then run emcmake cmake -G "Unix Makefiles" . followed by emmake make

But all I get is a lot of errors (the complete output is attached below).

Can you point me to the right direction to build it from the sources?

make: ['make']
[  1%] Building CXX object xlnt-build/source/third-party/libstudxml/CMakeFiles/libstudxml.dir/xml/parser.cxx.o
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:5:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/new:85:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/exception:81:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/cstddef:38:
$HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/version:1:1: error: expected unqualified-id
1.1.0-a5
^
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:5:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/new:85:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/exception:81:
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/cstddef:51:9: error: no member named 'size_t' in the global namespace
using ::size_t;
      ~~^
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:5:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/new:85:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/exception:82:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/cstdlib:86:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/stdlib.h:94:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/compat/stdlib.h:14:
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:38:15: error: use of undeclared identifier 'size_t'; did you mean 'sizeof'?
void *malloc (size_t);
              ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:38:21: error: expected expression
void *malloc (size_t);
                    ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:39:15: error: use of undeclared identifier 'size_t'; did you mean 'sizeof'?
void *calloc (size_t, size_t);
              ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:39:21: error: expected expression
void *calloc (size_t, size_t);
                    ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:39:23: error: use of undeclared identifier 'size_t'; did you mean 'sizeof'?
void *calloc (size_t, size_t);
                      ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:40:24: error: unknown type name 'size_t'
void *realloc (void *, size_t);
                       ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:42:21: error: unknown type name 'size_t'
void *aligned_alloc(size_t alignment, size_t size);
                    ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:42:39: error: unknown type name 'size_t'
void *aligned_alloc(size_t alignment, size_t size);
                                      ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:55:44: error: C++ requires a type specifier for all declarations
void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
                                           ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:55:52: error: C++ requires a type specifier for all declarations
void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
                                                   ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:55:52: error: redefinition of parameter 'size_t'
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:55:44: note: previous declaration is here
void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
                                           ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:56:21: error: C++ requires a type specifier for all declarations
void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
                    ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:56:29: error: C++ requires a type specifier for all declarations
void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
                            ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:56:29: error: redefinition of parameter 'size_t'
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:56:21: note: previous declaration is here
void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
                    ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:70:26: error: unknown type name 'size_t'
int mblen (const char *, size_t);
                         ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:71:58: error: unknown type name 'size_t'
int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
                                                         ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc/stdlib.h:73:1: error: unknown type name 'size_t'
size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
shared:ERROR: '$HOME/src/sdk/emsdk/fastcomp/fastcomp/bin/clang++ -target asmjs-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=38 -D__EMSCRIPTEN_tiny__=43 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -Xclang -nostdsysteminc -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/lib/libcxxabi/include -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/compat -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/lib/libc/musl/arch/emscripten -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/local/include -DEMSCRIPTEN -DLIBSTUDXML_STATIC_LIB=1 -DXML_STATIC=1 -I$HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml -std=gnu++11 -c $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx -Xclang -disable-O0-optnone -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/SDL -c -o CMakeFiles/libstudxml.dir/xml/parser.cxx.o -emit-llvm' failed (1)
make[2]: *** [xlnt-build/source/third-party/libstudxml/CMakeFiles/libstudxml.dir/build.make:64: xlnt-build/source/third-party/libstudxml/CMakeFiles/libstudxml.dir/xml/parser.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:303: xlnt-build/source/third-party/libstudxml/CMakeFiles/libstudxml.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

wstucco avatar Nov 07 '19 12:11 wstucco

Could you please try using the docker image for emscripten? This way we can get deterministic errors and check what is wrong (im quite sure something changed in emscripten since i wrote the article and generates some build errors)

isc30 avatar Nov 07 '19 13:11 isc30

@isc30 Thanks! I will try the Docker image, meanwhile I'm running emscripten version 1.38.43 (emsdk activate 1.38.43)

wstucco avatar Nov 07 '19 13:11 wstucco

also, as a good thing to check, what happens if you fix the build error you are getting or change C++ version? if I remember correctly, I was using C++14 target for this

isc30 avatar Nov 07 '19 13:11 isc30

I've tried with the Docker image, same results.

Changing C++ std doesn't change anything, apparently no matter which standard I set in CMakeLists.txt clang++ is called with the param -std=gnu++11 as you can see in the log below.

I've noticed that by swapping line 45 and 46 of $EMSDK/fastcomp/emscripten/system/include/libcxx/cstddef from

// Don't include our own <stddef.h>; we don't want to declare ::nullptr_t.
#include_next <stddef.h>
#include <__nullptr>

to

// Don't include our own <stddef.h>; we don't want to declare ::nullptr_t.
#include <__nullptr>
#include_next <stddef.h>

the errors about size_t disappear, but now it fails in other places.

[  1%] Building CXX object xlnt-build/source/third-party/libstudxml/CMakeFiles/libstudxml.dir/xml/parser.cxx.o
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:5:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/new:85:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/exception:81:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/cstddef:38:
$HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/version:1:1: error: expected unqualified-id
1.1.0-a5
^
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:5:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/new:85:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/exception:83:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/type_traits:407:
$HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/version:1:1: error: expected unqualified-id
1.1.0-a5
^
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:5:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/new:85:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/exception:84:
$HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/version:1:1: error: expected unqualified-id
1.1.0-a5
^
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:5:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/new:88:
$HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/version:1:1: error: expected unqualified-id
1.1.0-a5
^
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:8:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/istream:163:
$HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/version:1:1: error: expected unqualified-id
1.1.0-a5
^
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:8:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/istream:164:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/ostream:138:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/ios:215:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/iosfwd:96:
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/wchar.h:137:77: error: use of undeclared identifier 'wcschr'
wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcschr(__s, __c);}
                                                                            ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/wchar.h:144:87: error: use of undeclared identifier 'wcspbrk'
wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcspbrk(__s1, __s2);}
                                                                                      ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/wchar.h:151:78: error: use of undeclared identifier 'wcsrchr'; did you mean
      'wcschr'?
wchar_t* __libcpp_wcsrchr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcsrchr(__s, __c);}
                                                                             ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/wchar.h:139:16: note: 'wcschr' declared here
const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
               ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/wchar.h:158:86: error: use of undeclared identifier 'wcsstr'; did you mean 'wcschr'?
wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
                                                                                     ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/wchar.h:141:16: note: 'wcschr' declared here
      wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
               ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/wchar.h:158:86: error: no matching function for call to 'wcschr'
wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
                                                                                     ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/wchar.h:141:16: note: candidate disabled: <no message provided>
      wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
               ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/wchar.h:158:93: error: cannot initialize a parameter of type 'wchar_t *' with an
      lvalue of type 'const wchar_t *'
wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
                                                                                            ^~~~
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/wchar.h:141:38: note: passing argument to parameter '__s' here
      wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
                                     ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/wchar.h:165:90: error: use of undeclared identifier 'wmemchr'; did you mean
      'memchr'?
wchar_t* __libcpp_wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return (wchar_t*)wmemchr(__s, __c, __n);}
                                                                                         ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/string.h:97:13: note: 'memchr' declared here
const void* memchr(const void* __s, int __c, size_t __n) {return __libcpp_memchr(__s, __c, __n);}
            ^
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:8:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/istream:164:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/ostream:138:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/ios:215:
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/iosfwd:190:14: error: use of undeclared identifier 'mbstate_t'
typedef fpos<mbstate_t>    streampos;
             ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/iosfwd:191:14: error: use of undeclared identifier 'mbstate_t'
typedef fpos<mbstate_t>    wstreampos;
             ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/iosfwd:196:14: error: use of undeclared identifier 'mbstate_t'
typedef fpos<mbstate_t>    u16streampos;
             ^
$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/iosfwd:197:14: error: use of undeclared identifier 'mbstate_t'
typedef fpos<mbstate_t>    u32streampos;
             ^
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:8:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/istream:164:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/ostream:138:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/ios:216:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/__locale:15:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/string:505:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/string_view:176:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/__string:57:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/algorithm:643:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/utility:206:
$HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/version:1:1: error: expected unqualified-id
1.1.0-a5
^
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:8:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/istream:164:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/ostream:138:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/ios:216:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/__locale:15:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/string:505:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/string_view:176:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/__string:57:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/algorithm:644:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/memory:659:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/limits:122:
$HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/version:1:1: error: expected unqualified-id
1.1.0-a5
^
In file included from $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx:8:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/istream:164:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/ostream:138:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/ios:216:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/__locale:15:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/string:505:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/string_view:176:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/__string:57:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/algorithm:644:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/memory:660:
In file included from $HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx/iterator:421:
$HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/version:1:1: error: expected unqualified-id
1.1.0-a5
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
shared:ERROR: '$HOME/src/sdk/emsdk/fastcomp/fastcomp/bin/clang++ -target asmjs-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=38 -D__EMSCRIPTEN_tiny__=43 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -Xclang -nostdsysteminc -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/lib/libcxxabi/include -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/compat -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/lib/libc/musl/arch/emscripten -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/local/include -DEMSCRIPTEN -DLIBSTUDXML_STATIC_LIB=1 -DXML_STATIC=1 -I$HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml -std=gnu++11 -c $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx -Xclang -disable-O0-optnone -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/SDL -c -o CMakeFiles/libstudxml.dir/xml/parser.cxx.o -emit-llvm' failed (1)
make[2]: *** [xlnt-build/source/third-party/libstudxml/CMakeFiles/libstudxml.dir/build.make:64: xlnt-build/source/third-party/libstudxml/CMakeFiles/libstudxml.dir/xml/parser.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:303: xlnt-build/source/third-party/libstudxml/CMakeFiles/libstudxml.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

The command being run is

$HOME/src/sdk/emsdk/fastcomp/fastcomp/bin/clang++ -target asmjs-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=38 -D__EMSCRIPTEN_tiny__=43 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -Xclang -nostdsysteminc -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libcxx -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/lib/libcxxabi/include -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/compat -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/libc -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/lib/libc/musl/arch/emscripten -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/local/include -DEMSCRIPTEN -DLIBSTUDXML_STATIC_LIB=1 -DXML_STATIC=1 -I$HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml -std=gnu++11 -c $HOME/src/lab/xlnt-wasm/xlnt-src/third-party/libstudxml/xml/parser.cxx -Xclang -disable-O0-optnone -Xclang -isystem$HOME/src/sdk/emsdk/fastcomp/emscripten/system/include/SDL -c -o CMakeFiles/libstudxml.dir/xml/parser.cxx.o -emit-llvm' failed (1)

wstucco avatar Nov 07 '19 14:11 wstucco

Yeah, there is definitely something weird going on there. Will have a look this weekend.

isc30 avatar Nov 08 '19 08:11 isc30

@isc30 Thanks a lot!

wstucco avatar Nov 08 '19 09:11 wstucco

I'm extremely busy these days, can you try to force C++14 in emscripten somehow and see what happens pls?

isc30 avatar Nov 12 '19 11:11 isc30

I am having this problem also, are there some news here?

I used the following lines, to compile just parser.cxx trying to isolate the problem, I already made the change indicated by @wstucco to avoid the size_t errors.

em++ -std=c++14 -c parser.cxx -I.. -o parser.o em++ -std=c++17 -c parser.cxx -I.. -o parser.o

I got errors like: ` In file included from parser.cxx:5: In file included from /home/eduardo/webassembly/emsdk/upstream/emscripten/system/include/libcxx/new:90: In file included from /home/eduardo/webassembly/emsdk/upstream/emscripten/system/include/libcxx/exception:80: In file included from /home/eduardo/webassembly/emsdk/upstream/emscripten/system/include/libcxx/cstddef:37: ../version:1:1: error: expected unqualified-id 1.1.0-b.8 ^

/home/eduardo/webassembly/emsdk/upstream/emscripten/system/include/libcxx/wchar.h:136:77: error: use of undeclared identifier 'wcschr' wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcschr(__s, __c);} ^ /home/eduardo/webassembly/emsdk/upstream/emscripten/system/include/libcxx/wchar.h:143:87: error: use of undeclared identifier 'wcspbrk' wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcspbrk(__s1, __s2);} ^ /home/eduardo/webassembly/emsdk/upstream/emscripten/system/include/libcxx/wchar.h:150:78: error: use of undeclared identifier 'wcsrchr'; did you mean 'wcschr'? wchar_t* __libcpp_wcsrchr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcsrchr(__s, __c);} ^ ` And a lot more errors.

ejyanezp avatar Aug 29 '20 04:08 ejyanezp

Another important data is that we can compile the file parser.cxx with the linux clang++ compiler:

clang++ -I.. -std=c++14 -c parser.cxx -o parcer.o

I am using clang 10.0 in Ubuntu: clang version 10.0.0-4ubuntu1 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin

But cannot compile the same file with em++ command line, which uses it own clang version 12: clang version 12.0.0 (/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project 9f21947a331203ee2579db87f1d1ec22a949e20a) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /home/eduardo/webassembly/emsdk/upstream/bin/.

I used the following command line for compiling: eduardo@mars:libstudxml$ em++ -c -std=c++14 -I.. parser.cxx -o parser.o In file included from parser.cxx:5: In file included from /home/eduardo/webassembly/emsdk/upstream/emscripten/system/include/libcxx/new:90: In file included from /home/eduardo/webassembly/emsdk/upstream/emscripten/system/include/libcxx/exception:80: In file included from /home/eduardo/webassembly/emsdk/upstream/emscripten/system/include/libcxx/cstddef:37: ../version:1:1: error: expected unqualified-id 1.1.0-b.8 ^

But if I use the clang++ compiler that comes with emscripten directly (not using em++ frontend) /home/eduardo/webassembly/emsdk/upstream/bin/clang++ -c -I.. -std=c++14 parser.cxx -o parser.o

It compiles without problem to an object file parser.o

So, it is not the compiler, for me the root cause is in the port of the C/C++ libraries to emscripten, there is something weird hidden in those include files.

ejyanezp avatar Aug 31 '20 02:08 ejyanezp

I trace the error down: The xlnt-wasm/build/xlnt-src/third-party/libstudxml/ folder had a "version" file, colliding with the file: emsdk/upstream/emscripten/system/include/libcxx/version Conclusion: It is a very bad Idea to name a version file with the same name of a file in the C++ include files folder. Put apart your own file with an .txt extension, remember C++ include files does not have extensions so it is an easy way.

Give it a name like: xlnt-wasm/build/xlnt-src/third-party/libstudxml/version.txt Instead of xlnt-wasm/build/xlnt-src/third-party/libstudxml/version

After renaming this file I was able to compile xlnt-wasm without problems.

ejyanezp avatar Sep 01 '20 03:09 ejyanezp