kripken/emscripten — Issue #282: Emscripten Generated Script Conflicts with MooTool Core Lib When Optimized with `-O2` or Above
Author: peterleecomcn
Created: 2012-02-29 21:18:43+00:00
State: open

@kripken

It seems the Emscripten generated script is conflicting with MooTool Core library when optimized with `-O2` or above.

Here are steps to reproduce:

## `main.cpp` Contents:

```cpp
extern "C"
{

#include

}

int main(int argc, char* argv[])
{
printf("Hello, world!\n");

return 0;
}
```

## The command used to generate the `main.js`:

```
emcc -O2 main.cpp -o main.js
```

## The HTML test page `test.html`

```html

SpeexWrapper Test Harness

```

## System Info
```
plee@sos:~/Dev/emscripten/tests/test$ uname -a
Linux sos 2.6.38-13-generic-pae #55-Ubuntu SMP Tue Jan 24 15:54:51 UTC 2012 i686 i686 i386 GNU/Linux
plee@sos:~/Dev/emscripten/tests/test$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.04
Release: 11.04
Codename: natty
plee@sos:~/Dev/emscripten/tests/test$ chromium-browser --version
Chromium 17.0.963.56 Ubuntu 11.04
plee@sos:~/Dev/emscripten/tests/test$
```

When I open the `test.html` page in Google Chrome, the console show this:

```
Uncaught TypeError: Cannot read property 'object' of undefined main.js:1
pa.push.i main.js:1
na main.js:1
Ja main.js:1
(anonymous function)
```