Hi,

I am trying to compile a multi threaded application to WebAssembly. The 
application uses OpenMP for multithreading.

I have already downloaded the source files for OpenMP and compiled it for 
my host machine using make. With the following command I can get it to link 
with a simple demo application on my machine:


g++ -Wall -Werror -pedantic main.o -o main.x 
/$PATH_TO_OPENMP/build/runtime/src/libgomp.a -pthread -lstdc++ 
-Wl,--no-as-needed -ldl

 I then tried to compile OpenMP to the llvm bytecode format used by 
Emscripten. To do so I tried to run 'emmake make', so that the emscripten 
framework executes the OpenMP makefiles with a suitable compiler. As 
emscripten does not like shared object files I compiled it to static 
library .a files. This works and actually gives me object files to which I 
can link.

I then wanted to link my demo application with the following command

em++ -Wall -Werror -pedantic main.o -o main.html 
/home/main/data/Programming/openMP/openmp_web/build/runtime/src/libgomp.a 
-pthread -lstdc++ -Wl,--no-as-needed -ldl

 But I get these warnings, that it couldn't link to OpenMP files:

shared:WARNING: object 
/tmp/emscripten_temp_ONa0eU_archive_contents/kmp_atomic.cpp.o is not a valid 
object file for emscripten, cannot link
                              .
                              .
shared:WARNING: object 
/tmp/emscripten_temp_ONa0eU_archive_contents/kmp_str.cpp.o is not a valid 
object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_ONa0eU_archive_contents

 So I figured I must have compiled OpenMP with the wrong compiler. I then 
tried to change the compiler when building the library by using the 
following commands:

cmake -DCMAKE_C_COMPILER=emcc -DCMAKE_CXX_COMPILER=em++ 
-DLIBOMP_LIB_TYPE=normal -DLIBOMP_ENABLE_SHARED=OFF -DCMAKE_BUILD_TYPE=Release 
-DLIBOMP_ARCH=x86_64 OPENMP_STANDALONE_BUILD=1 ..
emmake make

But this just gives strange errors on some missing system variables

/home/main/data/Programming/openMP/openmp_web/runtime/src/kmp_platform.h:82:2: 
error: Unknown OS 
/home/main/data/Programming/openMP/openmp_web/runtime/src/kmp_platform.h:203:2: 
error: Unknown or unsupported architecture 
In file included from 
/home/main/data/Programming/openMP/openmp_web/runtime/src/kmp_alloc.cpp:13: 
In file included from 
/home/main/data/Programming/openMP/openmp_web/runtime/src/kmp.h:77: 
/home/main/data/Programming/openMP/openmp_web/runtime/src/kmp_os.h:171:2: 
error: "Can't determine size_t printf format specifier."

 Does anyone have an idea on what I could do differently?

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/ae0ff691-88e0-4317-b437-881a980eb2e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to