Search Unity

Emscripten with Webgl Help needed

Discussion in 'Web' started by bhupiister, Aug 26, 2021.

  1. bhupiister

    bhupiister

    Joined:
    Dec 13, 2019
    Posts:
    42
    I am compiling OpenCascade library for webgl Unity.
    So far I am successful to use this library on Android and Windows, for Webgl its bit tricky.
    1) Unity uses old version of emscripten like 1.38.11 and this version is unable to build this library properly
    2) New version of emscripten build .a files instead of .bc files and i am unable to find how to implement .a files in unity and if I put them in plugin folder and call DllImport with __Internal , it is unable to find.

    I somewhere read that unity, with its new release, is going to use latest version of emscripten. So even if I use new version of emscripten, it will generate .a files. I think its because new versions of emscripten uses upstream.

    Can anyone help me on how to successfully compile this library with emscripten ?
     
    DrViJ likes this.
  2. bhupiister

    bhupiister

    Joined:
    Dec 13, 2019
    Posts:
    42
    DrViJ likes this.
  3. DrViJ

    DrViJ

    Joined:
    Feb 9, 2013
    Posts:
    158
    Hi! Have you solved this problem? Is it real to use .a library?
     
  4. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    589
    As far as I know, there's no difference between the 2 file extensions (but I'm not sure).

    But because of memory limit for each wasm, I think that compiling the lib separately, and return Unity only the final output, would work better.
     
  5. bhupiister

    bhupiister

    Joined:
    Dec 13, 2019
    Posts:
    42
    All i know is that if i build a simple plugin of printing "Hello World!" and put .bc file inside plugin folder, it works. But the same does not work with .a file extension. We need someone from unity to help on this like @jukka_j
     
  6. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    589
    and if you rename the file extension from .a to .bc?
     
  7. bhupiister

    bhupiister

    Joined:
    Dec 13, 2019
    Posts:
    42
    @De-Panther Haven't tried this. Will certainly try and respond.