# Issue compiling third party libraries for HTML5

**URL:** <https://forums.unrealengine.com/t/issue-compiling-third-party-libraries-for-html5/427143>\
**Category:** Platform & Builds\
**Tags:** clang, html, unreal-engine, question, CPP\
**Created:** [June 11, 2018, 2:59pm UTC](https://forums.unrealengine.com/t/issue-compiling-third-party-libraries-for-html5/427143 "2018-06-11T14:59:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rael55](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rael55](https://forums.unrealengine.com/u/Rael55)\
**Post date:** [June 11, 2018, 2:59pm UTC](https://forums.unrealengine.com/t/issue-compiling-third-party-libraries-for-html5/427143/1 "2018-06-11T14:59:00Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Rael55](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rael55](https://forums.unrealengine.com/u/Rael55)\
**Post date:** [June 11, 2018, 3:41pm UTC](https://forums.unrealengine.com/t/issue-compiling-third-party-libraries-for-html5/427143/2 "2018-06-11T15:41:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![AbsinthScripting](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AbsinthScripting](https://forums.unrealengine.com/u/AbsinthScripting)\
**Post date:** [September 12, 2018, 7:56pm UTC](https://forums.unrealengine.com/t/issue-compiling-third-party-libraries-for-html5/427143/3 "2018-09-12T19:56:29Z")

</div>

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
```
