View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000198||file||General||public||2020-09-20 10:00||2020-12-15 23:58|
|Summary||0000198: Compiling with emscripten to WebAssembly fails|
|Description||I'm trying to compile libmagic to WebAssembly by using the emscripten toolchain to be able to use it in a WebExtension. It would be sufficient to get a static library. Unfortunately, the build of the library requires the execution of another target (e. g. file, to compile the magic list). This is a show stopper for emscripten, because executable targets will be WASM/JS (instead of a binary) and for sure not be executable on any build system.|
According to the comment in 'magic/Makefile.am' line 333 (https://github.com/file/file/blob/master/magic/Makefile.am#L333), you might already be aware of this problem. It would be nice to have a fix for this soon. If you know any workaround for this, I would appreciate it to let me know.
Thanks for looking into it!
|Steps To Reproduce||# setup emscripten first: https://emscripten.org/docs/getting_started/downloads.html#installation-instructions|
git clone https://github.com/file/file
emconfigure ./configure --prefix=/tmp/file --enable-static=yes --disable-shared
|Additional Information||Error log:|
Making all in magic
make: Entering directory '/tmp/file/magic'
../src/file -C -m magic
/bin/bash: ../src/file: Permission denied
Makefile:831: recipe for target 'magic.mgc' failed
make: *** [magic.mgc] Error 126
make: Leaving directory '/tmp/file/magic'
Makefile:460: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
make: Leaving directory '/tmp/file'
Makefile:369: recipe for target 'all' failed
make: *** [all] Error 2
||The file binary is built before it is being used to compile the magic database. So you are fine, you have a file binary and libmagic. Building magic.mgc can be done using a native build (and the same file will be produced). I don't really have the time to figure out the autoconf magic to make it build a native version of file in a cross-compile environment.|
||Do you have a target that allows to only build libmagic (without the file binary and especially without magic.mgc)? And do you have a target or two to only build the file binary and magic.mgc?|
cd src && make libmagic.la
cd magic && make magic.mgc
cd src && make file
||Sounds promising, thank you! I cannot test it right now, but I'll give you feedback on that in several weeks and I will also post a solution for emscripten, if found.|
||Waiting on feedback.|
|2020-09-20 10:00||Thomas||New Issue|
|2020-09-20 10:00||Thomas||Tag Attached: build|
|2020-10-11 20:05||christos||Note Added: 0003487|
|2020-10-12 04:53||Thomas||Note Added: 0003493|
|2020-10-14 21:13||christos||Note Added: 0003496|
|2020-10-17 17:35||Thomas||Note Added: 0003497|
|2020-12-15 23:58||christos||Assigned To||=> christos|
|2020-12-15 23:58||christos||Status||new => assigned|
|2020-12-15 23:58||christos||Status||assigned => feedback|
|2020-12-15 23:58||christos||Note Added: 0003502|