Issue compiling third party libraries for HTML5

I’m trying to compile Assimp as a LLVM bitcode library for my HTML5 project. However, when compiling, I get these errors:

2>EXEC : warning : Linking two modules of different data layouts: 'K:/Unreal Projects/ArtGallery/ThirdParty/Assimp/bin/assimp.bc' is 'e-m:w-i64:64-f80:128-n8:16:32:64-S128' whereas 'K:/Unreal Projects/ArtGallery/Intermediate/Build/HTML5/ArtGallery/Development/Launch/Module.Launch.cpp.bc' is 'e-p:32:32-i64:64-v128:32:128-n32-S128'
2>
2>     1>
2>EXEC : warning : Linking two modules of different target triples: K:/Unreal Projects/ArtGallery/ThirdParty/Assimp/bin/assimp.bc' is 'x86_64-pc-windows-msvc19.0.24215' whereas 'K:/Unreal Projects/ArtGallery/Intermediate/Build/HTML5/ArtGallery/Development/Launch/Module.Launch.cpp.bc' is 'asmjs-unknown-emscripten'
2>
2>         Not handled: i64 sub nuw nsw (i64 ptrtoint (%rtti.TypeDescriptor30* @"\01??_R0?AUFIStringValueImpl@Assimp@@@8" to i64), i64 ptrtoint (i8* @__ImageBase to i64))
2>     1>
2>EXEC : LLVM error : FlattenGlobals: ConstantExpr opcode not handled: sub

I used clang++ and llvm-link that were included in the emscripten folder under the engine directory, so I thought I was doing things correctly. I used clang++ to compile my cpp’s (with options -c -O and -emit-llvm, would that be an issue?) and then simply used llvm-link with all the .bc’s generated to combine into one .bc (didn’t use options here other than -o to specify filename). Should I be using emcc or something to do this, or what should I be doing to correct this issue?

I was able to remove those warning by disassembling the file and changing the target and layout and reassembling, but the ‘Not handled’ error still occurs. I’m guessing it’s a compatibility issue with the library maybe?

Better use cmake for that.
Create a new CMakeLists.txt in the dir above assimp source and turn off every importer/exporter you don’t need (less errors):

eg:

set( ASSIMP_BUILD_3DS_IMPORTER OFF CACHE BOOL "Build importer" )
add_definitions(-DASSIMP_BUILD_NO_3DS_EXPORTER)

at the beginning of the file i use:

set(CMAKE_STATIC_LIBRARY_SUFFIX ".bc")
set(CMAKE_C_FLAGS "-emit-llvm")

and at the end:

add_subdirectory( assimp )

but I can’t compile it with the engine, yet. There are still 3 linking errors:

ProcessResult.StdOut:     error: unresolved symbol: _ZN6Assimp8ImporterD1Ev
ProcessResult.StdOut:     error: unresolved symbol: _ZN6Assimp8Importer8ReadFileEPKcj
ProcessResult.StdOut:     error: unresolved symbol: _ZN6Assimp8ImporterC1Ev