[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emmake: error: 'make' failed (returned 2) #1309

Open
vault-thirteen opened this issue Dec 3, 2023 · 1 comment
Open

emmake: error: 'make' failed (returned 2) #1309

vault-thirteen opened this issue Dec 3, 2023 · 1 comment

Comments

@vault-thirteen
Copy link
vault-thirteen commented Dec 3, 2023

I am trying to compile WASM for a library using the instruction which I found on this page:
https://emscripten.org/docs/compiling/Building-Projects.html

It says "To build with Emscripten, you would instead use the following commands:"

# Run emconfigure with the normal configure command as an argument.
emconfigure ./configure

# Run emmake with the normal make to generate Wasm object files.
emmake make

I skip the first step while the library has no configure script.
I am trying to do the second step.

O.S. is Windows 10.
When I use make from the MSYS2 bundle, it works fine.
When I use emmake make it fails.
The details are following.

I am trying to compile this library:
https://github.com/P-H-C/phc-winner-argon2
git clone https://github.com/P-H-C/phc-winner-argon2.git
I rename the repository folder into argon2,
open the MSYS2 UCRT64 Terminal and do the following:
cd argon2
make
Result:

$ make
Building with optimizations for native
cc -std=c89 -O3 -Wall -g -Iinclude -Isrc -pthread -march=native  src/argon2.c src/core.c src/blake2/blake2b.c src/thread.c src/encoding.c src/opt.c src/run.c -o argon2
cc -std=c89 -O3 -Wall -g -Iinclude -Isrc -pthread -march=native -shared -Wl,--out-implib,libargon2.dll.a   src/argon2.c src/core.c src/blake2/blake2b.c src/thread.c src/encoding.c src/opt.c -o libargon2.dll
cc -std=c89 -O3 -Wall -g -Iinclude -Isrc -pthread -march=native   -c -o src/argon2.o src/argon2.c
cc -std=c89 -O3 -Wall -g -Iinclude -Isrc -pthread -march=native   -c -o src/core.o src/core.c
cc -std=c89 -O3 -Wall -g -Iinclude -Isrc -pthread -march=native   -c -o src/blake2/blake2b.o src/blake2/blake2b.c
cc -std=c89 -O3 -Wall -g -Iinclude -Isrc -pthread -march=native   -c -o src/thread.o src/thread.c
cc -std=c89 -O3 -Wall -g -Iinclude -Isrc -pthread -march=native   -c -o src/encoding.o src/encoding.c
cc -std=c89 -O3 -Wall -g -Iinclude -Isrc -pthread -march=native   -c -o src/opt.o src/opt.c
ar rcs libargon2.a src/argon2.o src/core.o src/blake2/blake2b.o src/thread.o src/encoding.o src/opt.o
sed '/^##.*$/d; s#@PREFIX@#/usr#g; s#@EXTRA_LIBS@##g; s#@UPSTREAM_VER@#ZERO#g; s#@HOST_MULTIARCH@#lib#g; s#@INCLUDE@#include#g;' < 'libargon2.pc.in' > 'libargon2.pc'

Then I reset the folder (delete it and clone git repository again).
When I open "Emscripten Command Prompt" and use emmake make I get an error:

make: make
Building without optimizations
D:\Temp\1\emsdk\upstream\emscripten\emcc.bat -std=c89 -O3 -Wall -g -Iinclude -Isrc -pthread  src/argon2.c src/core.c src/blake2/blake2b.c src/thread.c src/encoding.c src/ref.c src/run.c -o argon2
emcc: warning: running limited binaryen optimizations because DWARF info requested (or indirectly required) [-Wlimited-postlink-optimizations]
D:\Temp\1\emsdk\upstream\emscripten\emcc.bat -std=c89 -O3 -Wall -g -Iinclude -Isrc -pthread -shared -Wl,--out-implib,libargon2.dll.a   src/argon2.c src/core.c src/blake2/blake2b.c src/thread.c src/encoding.c src/ref.c -o libargon2.dll
emcc: warning: linking a library with `-shared` will emit a static object file.  This is a form of emulation to support existing build systems.  If you want to build a runtime shared library use the SIDE_MODULE setting. [-Wemcc]
wasm-ld: error: unknown argument: --out-implib
wasm-ld: error: cannot open libargon2.dll.a: no such file or directory
emcc: error: 'D:/Temp/1/emsdk/upstream/bin\wasm-ld.exe -o libargon2.dll --out-implib libargon2.dll.a C:\Users\xxx\AppData\Local\Temp\emscripten_temp_9v7it_tv\argon2_0.o C:\Users\xxx\AppData\Local\Temp\emscripten_temp_9v7it_tv\core_1.o C:\Users\xxx\AppData\Local\Temp\emscripten_temp_9v7it_tv\blake2b_2.o C:\Users\xxx\AppData\Local\Temp\emscripten_temp_9v7it_tv\thread_3.o C:\Users\xxx\AppData\Local\Temp\emscripten_temp_9v7it_tv\encoding_4.o C:\Users\xxx\AppData\Local\Temp\emscripten_temp_9v7it_tv\ref_5.o -LD:\Temp\1\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten --relocatable -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (returned 1)
make: *** [Makefile:184: libargon2.dll] Error 1
emmake: error: 'make' failed (returned 2)

Is it possible to fix all this ? Thank you.

@sbc100
Copy link
Collaborator
sbc100 commented Dec 4, 2023

The project in question is trying to use --out-implib as link flag and this flag is not supported by emscripten.

It looks like the Makefile is assuming you are targetting windows here: https://github.com/P-H-C/phc-winner-argon2/blob/f57e61e19229e23c4445b85494dbf7c07de721cb/Makefile#L90-L103

My advise would be to build the static version of the library. Try running make libargon2.a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants