32-bit SDK of Emscripten 1.38.x

102 views
Skip to first unread message

Manuel Häusler

unread,
Jul 3, 2019, 9:17:48 AM7/3/19
to emscripten-discuss
Hello everyone,
Is there a 32-bit SDK of emscripten 1.38.x for linux available?
I need a 32-bit version to be able to compile c-code generated by JModelica which requires 32-bit header files.
Till now, I was not able install a SDK of emscripten on my 32-bit linux machine. I hope there is a way without building my own emscripten version from source...

Thanks for help
Manuel

Sam Clegg

unread,
Jul 3, 2019, 1:01:18 PM7/3/19
to emscripte...@googlegroups.com
I don't think we have any plans to support pre-packaged SDK for 32-bit
linux. So if you really need a 32-bit SDK you will need to build from
source.

Having said that there is normally no reason to require the toolchain
to be 32-bit. Which 32-bit headers files are you referring to?
Since emscripten doesn't use any system headers, the system headers
should be irrelevant.

If JModelica itself requires 32-bit header then perhaps you can still
use on 64-bit system with 32-bit cross headers installed. For example
on ubuntu you can simply run `apt-get install
libc6-dev:i386` to get 32-bit headers for libc.

cheers,
sam

> Thanks for help
> Manuel
>
> --
> You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/324ec428-a8a9-4735-8be1-1d61ca38e947%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Manuel Häusler

unread,
Jul 5, 2019, 2:09:23 AM7/5/19
to emscripten-discuss
Hello

That is what I initially tried. Compiling the code with the 32-bit headers for libc on a 64-bit machine. But I got an error that comes when you want to compile 32-bit code on a 64-bit machine (badly I dont remember the actual error message). I will post the message later...
The header file for which emscripten is searching for during compiling is found at /usr/include/i386-linux-gnu/gnu/stubs-32.h

Tanks for your help

Manuel Häusler

unread,
Jul 5, 2019, 2:48:57 AM7/5/19
to emscripten-discuss
That is the command to compile BouncingBall.c with emscripten:

emcc -I /usr/include/ -I /usr/include/i386-linux-gnu/ -I /usr/include/i386-linux-gnu/bits/ -I /home/osboxes/Programme/JModelica/include/RuntimeLibrary/ -I /home/osboxes/Programme/JModelica/ThirdParty/FMI/2.0/ BouncingBall.c

And that is the error I get using the 32-bit headers for libc:

In file included from BouncingBall.c:1:
In file included from ./BouncingBall_base.h:1:
/usr/include/stdio.h:52:9: error: unknown type name '__gnuc_va_list'
typedef __gnuc_va_list va_list;
        ^
/usr/include/stdio.h:342:8: error: unknown type name '__gnuc_va_list'
                     __gnuc_va_list __arg);
                     ^
/usr/include/stdio.h:347:54: error: unknown type name '__gnuc_va_list'
extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
                                                     ^
/usr/include/stdio.h:350:8: error: unknown type name '__gnuc_va_list'
                     __gnuc_va_list __arg) __THROWNL;
                     ^
/usr/include/stdio.h:359:42: error: unknown type name '__gnuc_va_list'
                      const char *__restrict __format, __gnuc_va_list __arg)
                                                       ^
/usr/include/stdio.h:380:8: error: unknown type name '__gnuc_va_list'
                     __gnuc_va_list __arg)
                     ^
/usr/include/stdio.h:435:7: error: unknown type name '__gnuc_va_list'
                    __gnuc_va_list __arg)
                    ^
/usr/include/stdio.h:442:53: error: unknown type name '__gnuc_va_list'
extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
                                                    ^
/usr/include/stdio.h:447:40: error: unknown type name '__gnuc_va_list'
                    const char *__restrict __format, __gnuc_va_list __arg)
                                                     ^
/usr/include/stdio.h:459:37: error: unknown type name '__gnuc_va_list'
                        const char *__restrict __format, __gnuc_va_list __arg),
                                                         ^
/usr/include/stdio.h:463:5: error: unknown type name '__gnuc_va_list'
                                __gnuc_va_list __arg), __isoc99_vscanf)
                                ^
/usr/include/stdio.h:468:8: error: unknown type name '__gnuc_va_list'
                            __gnuc_va_list __arg), __isoc99_vsscanf)
                            ^
In file included from BouncingBall.c:1:
In file included from ./BouncingBall_base.h:4:
In file included from /home/osboxes/Programme/JModelica/include/RuntimeLibrary/jmi.h:28:
In file included from /home/osboxes/Programme/JModelica/include/RuntimeLibrary/jmi_util.h:63:
/usr/include/setjmp.h:54:12: warning: declaration of built-in function
      '__sigsetjmp' requires inclusion of the header <setjmp.h>
      [-Wbuiltin-requires-header]
extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) _...
           ^
1 warning and 12 errors generated.
shared:ERROR: compiler frontend failed to generate LLVM bitcode, halting

Alon Zakai

unread,
Jul 8, 2019, 12:52:57 PM7/8/19
to emscripte...@googlegroups.com
The use of local system includes can cause errors,

-I /usr/include/ -I /usr/include/i386-linux-gnu/ -I /usr/include/i386-linux-gnu/bits/

Without those emcc will properly use the emcc system headers. With those, it will use whatever is on the local system, which may be wrong (since you aren't compiling for that system natively, but cross-compiling for another target).



--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.

Manuel Häusler

unread,
Jul 9, 2019, 1:47:00 AM7/9/19
to emscripten-discuss

Without those, emcc will not find needed header files and stop with errors...
What do you suggest then? Do I have to build a 32-Bit Emscripten on a 32-Bit system to overcome that problem?

Beuc

unread,
Jul 9, 2019, 4:08:38 AM7/9/19
to emscripte...@googlegroups.com

You can't use your system (i386) headers for an Emscripten (asmjs/wasm) application :)

If JModelica can't be compiled without i386 headers (AFAIU), it probably can't compiled for the asmjs/wasm target.
You'll need to improve JModelica so it supports more targets/architectures.

Cheers!
Beuc

Manuel Häusler

unread,
Jul 9, 2019, 4:52:42 AM7/9/19
to emscripten-discuss

If I see it right the logic in gnu/stubs.h is responsible for the selection of the header file:

#if !defined __x86_64__
# include <gnu/stubs-32.h>
#endif
#if defined __x86_64__ && defined __LP64__
# include <gnu/stubs-64.h>
#endif
#if defined __x86_64__ && defined __ILP32__
# include <gnu/stubs-x32.h>
#endif

Therefore I conclude from this that __LP64__ is not defined from JModelica but should be defined to be able to use the 64-bit header files. Does anyone know what __LP64__ is??

Sam Clegg

unread,
Jul 10, 2019, 1:32:45 PM7/10/19
to emscripte...@googlegroups.com
On Tue, Jul 9, 2019 at 1:52 AM Manuel Häusler
<manuel.h...@gmail.com> wrote:
>
>
> If I see it right the logic in gnu/stubs.h is responsible for the selection of the header file:
>
> #if !defined __x86_64__
> # include <gnu/stubs-32.h>
> #endif
> #if defined __x86_64__ && defined __LP64__
> # include <gnu/stubs-64.h>
> #endif
> #if defined __x86_64__ && defined __ILP32__
> # include <gnu/stubs-x32.h>
> #endif
>
> Therefore I conclude from this that __LP64__ is not defined from JModelica but should be defined to be able to use the 64-bit header files. Does anyone know what __LP64__ is??
>

__LP64__ means "Longs and Pointer are 64-bit" . It basically means you
are building for a 64-bit machine.

I think there is some confusion here. emscripten and webassembly are
*always* 32-bit and should *never* use the system headers. Emscripten
is a cross compiler and all its headers are in the emscripten/system
directory.
However the emscripten SDK includes prebuilt compiler binaries that
only run on 64-bit linux.

Are you trying to compile JModelica as an emscripten module? Or is
it something you build for the host machine?

> Am Dienstag, 9. Juli 2019 10:08:38 UTC+2 schrieb Beuc:
>>
>> You can't use your system (i386) headers for an Emscripten (asmjs/wasm) application :)
>>
>> If JModelica can't be compiled without i386 headers (AFAIU), it probably can't compiled for the asmjs/wasm target.
>> You'll need to improve JModelica so it supports more targets/architectures.
>>
>> Cheers!
>> Beuc
>
> --
> You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/58493340-5755-4c3a-9747-8dd6176d3a13%40googlegroups.com.

Manuel Häusler

unread,
Jul 22, 2019, 3:19:15 AM7/22/19
to emscripten-discuss
Hello and thank you for the useful answer.

I am trying to compile C-Code to JavaScript using Emscripten. The C-Code was generated by JModelica and does not contain any header files. Therefore I am searching for the correct header-files to successfully compile the code to javascript. Initially I tried with the system headers, but unfortunaly thats wrong...

Which header files do I have to use for the compilation?

Thx Manuel

Sam Clegg

unread,
Aug 12, 2019, 6:29:15 PM8/12/19
to emscripte...@googlegroups.com
Which header files are you referring to exactly?

The system header files for emscripten all live in "system/include"
within emscripten itself. This path is on the default include path
so you shouldn't need to add it explicitly.
> --
> You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/381d0b40-0c7a-47e6-9c4b-55ff9c7cabdc%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages