Skip to content

[bug] emscripten minimal example for embind fails when compiled with conan #11051

@psarka

Description

@psarka

Environment Details (include every applicable attribute)

  • Operating System+version: Ubuntu 20.04.4 LTS
  • Compiler+version: clang version 10.0.0-4ubuntu1
  • Conan version: Conan version 1.47.0
  • Python version: Python 3.8.10

Steps to reproduce (Include if Applicable)

I created a repro repository (make sure the branch is embind). It consits of the emscripten oscilator example with the conan definitions added to the best of my ability.

Unfortunately the best of my ability is not very good at all, so it is quite likely that I simply messed up.

Especially pay attention to the --bind flag in CMakeLists line 12, I may be passing it wrong. The official comand to compile the oscilator example (without conan) is using -lembind flag like this:

emcc -O2 -Wall -Werror -lembind -o oscillator.html oscillator.cpp

And it took me hours to find that maybe it has to be passed as --bind, as at least this way I can get it to compile (but not to run).

Logs (Executed commands with output) (Include/Attach if Applicable)

conan builds fine, using the commands in the README of the repo (or using build.sh). But the application does not function when
opened on the browser. The console log is as follows:

exception thrown: ReferenceError: ___getTypeName is not defined,getTypeName@http://0.0.0.0:8000/build/repro.js:1934:17
requireRegisteredType@http://0.0.0.0:8000/build/repro.js:1942:64
__emval_as@http://0.0.0.0:8000/build/repro.js:1948:20
@http://0.0.0.0:8000/build/repro.wasm:wasm-function[20]:0x8a1
@http://0.0.0.0:8000/build/repro.wasm:wasm-function[18]:0x4de
@http://0.0.0.0:8000/build/repro.wasm:wasm-function[91]:0x1e6c
createExportWrapper/<@http://0.0.0.0:8000/build/repro.js:1554:22
callMain@http://0.0.0.0:8000/build/repro.js:2708:28
doRun@http://0.0.0.0:8000/build/repro.js:2765:31
run@http://0.0.0.0:8000/build/repro.js:2780:5
runCaller@http://0.0.0.0:8000/build/repro.js:2686:19
removeRunDependency@http://0.0.0.0:8000/build/repro.js:1462:7
receiveInstance@http://0.0.0.0:8000/build/repro.js:1643:24
receiveInstantiationResult@http://0.0.0.0:8000/build/repro.js:1660:20

And then another one right after:

Uncaught (in promise) ReferenceError: ___getTypeName is not defined
    getTypeName http://0.0.0.0:8000/build/repro.js:1934
    requireRegisteredType http://0.0.0.0:8000/build/repro.js:1942
    __emval_as http://0.0.0.0:8000/build/repro.js:1948
    createExportWrapper http://0.0.0.0:8000/build/repro.js:1554
    callMain http://0.0.0.0:8000/build/repro.js:2708
    doRun http://0.0.0.0:8000/build/repro.js:2765
    run http://0.0.0.0:8000/build/repro.js:2780
    runCaller http://0.0.0.0:8000/build/repro.js:2686
    removeRunDependency http://0.0.0.0:8000/build/repro.js:1462
    receiveInstance http://0.0.0.0:8000/build/repro.js:1643
    receiveInstantiationResult http://0.0.0.0:8000/build/repro.js:1660

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions