emscripten-core / emscripten-core/emscripten

Emscripten undefined symbol error and more

Open
#18,144 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Please forgive my basic question but believe me I tried going through a documentation which was not helpful for me(only me).

**Issue**
OS:Windows
MSVC 2019 project

I created a openGL project in c++ which worked fine as a desktop application. I needed to transpile it to a wasm+js code. I set up emcc correctly thereby added libraries as such
`emcc Main.cpp -I"myincludefolderpath" -L"mylibrarypath" -lglfw3_mt`

I have not added all the libraries because it seems like I have a mistake in the cmd line options. Anyway `-lglfw_mt` was not able to be found. so I went with `-lglfw3` which somehow works even if I don't provide the librarypath. I somehow stumbled upon openGL32.lib should be linked by the option `-lGL`. and `-lGLEW` for glew library. I hadn't needed to include the librarypath at all. But the error I came across was
`wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: glewExperimental
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewGenVertexArrays
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewBindVertexArray
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewGenBuffers
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewBindBuffer
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewBufferData
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewCreateProgram
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewAttachShader
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewAttachShader
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewBindFragDataLocation
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewLinkProgram
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewValidateProgram
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewUseProgram
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewGetProgramiv
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewGetProgramiv
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewGetProgramInfoLog
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewDeleteProgram
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewGetUniformLocation
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewUniform1f
wasm-ld: error: C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o: undefined symbol: __glewGetUniformLocation
wasm-ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
emcc: error: 'C:/Users/USER/Documents/Emscripten/emsdk/upstream/bin\wasm-ld.exe -o a.out.wasm C:\Users\USER\AppData\Local\Temp\emscripten_temp_rz39s5r9\Main_0.o "-LC:\Users\USER\Desktop\emscript try\BookTest\Dependencies\GLFW\lib-vc2019" "-LC:\Users\USER\Desktop\emscript try\BookTest\Dependencies\GLEW\lib\Release\x64" "-LC:\Users\USER\Desktop\emscript try\BookTest\Dependencies\SOIL\lib" "-LC:\Users\USER\Desktop\emscript try\BookTest\Dependencies\nifticlib\lib" C:\Users\USER\Documents\Emscripten\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\libgl.a -LC:\Users\USER\Documents\Emscripten\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten -lGL -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-undefined --strip-debug --export-if-defined=main --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=__main_argc_argv --export-if-defined=fflush --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_init --export=stackSave --export=stackRestore --export=stackAlloc --export=__wasm_call_ctors --export=__errno_location --export=__get_temp_ret --export=__set_temp_ret --export=malloc --export=free --export-table -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024' failed (returned 1)`

How does a person know the library name openGL32.lib should be linked using `-lGL`?
I use other libraries such as glm, SOIL, etc what are the `-l___` option for those libraries.

I came across an option `-USE_SDL=2`. But is there something such as `-USE_GLFW3=1`?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.