emscripten-core / emsdk

Emscripten SDK
http://emscripten.org
Other
2.96k stars 676 forks source link

Building openssl-1.1.1w with emsdk #1293

Closed tony-is-working closed 10 months ago

tony-is-working commented 10 months ago

Problem I have some crypto functions written in c++ using openssl. I want to use those functions in javascript, so I use emsdk to build openssl. Then I encountered bugs. It seems configuration or makefile are not right. How to fix it ? Does anyone succeed building openssl with emsdk ?

Version of emscripten/emsdk: $emcc -v emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.47 (431685f05c67f0424c11473cc16798b9587bb536) clang version 18.0.0 (https://github.com/llvm/llvm-project 21030b9ab4487d845e29792063f5666d8c4b8e09) Target: wasm32-unknown-emscripten Thread model: posix InstalledDir: /home/yinggao.jt/emsdk/upstream/bin

Failing command line in full: If this is compile or link-time failure please include the full failing command along with its entire output.

$wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz --no-check-certificate $tar zxvf openssl-1.1.1w.tar.gz $cd openssl-1.1.1w.tar.gz $emconfigure ./config configure: ./config Operating system: x86_64-whatever-linux2 Configuring OpenSSL version 1.1.1w (0x1010117fL) for linux-x32 Using os-specific seed configuration Creating configdata.pm Creating Makefile



OpenSSL has been successfully configured


If you encounter a problem while building, please open an issue on GitHub https://github.com/openssl/openssl/issues and include the output from the following command:


perl configdata.pm --dump


(If you are new to OpenSSL, you might want to consult the 'Troubleshooting' section in the INSTALL file first)



$emmake make make: make /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \ "-oMakefile" include/crypto/bn_conf.h.in > include/crypto/bn_conf.h /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \ "-oMakefile" include/crypto/dso_conf.h.in > include/crypto/dso_conf.h /usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \ "-oMakefile" include/openssl/opensslconf.h.in > include/openssl/opensslconf.h make depend && make _all make[1]: Entering directory '/home/yinggao.jt/openssl-1.1.1w' make[1]: Leaving directory '/home/yinggao.jt/openssl-1.1.1w' make[1]: Entering directory '/home/yinggao.jt/openssl-1.1.1w' /home/yinggao.jt/emsdk/upstream/emscripten/em/home/yinggao.jt/emsdk/upstream/emscripten/emcc -I. -Iinclude -fPIC -pthread -mx32 -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib/engines-1.1\"" -DNDEBUG -c -o apps/app_rand.o apps/app_rand.c /bin/sh: /home/yinggao.jt/emsdk/upstream/emscripten/em/home/yinggao.jt/emsdk/upstream/emscripten/emcc: No such file or directory make[1]: [Makefile:699: apps/app_rand.o] Error 127 make[1]: Leaving directory '/home/yinggao.jt/openssl-1.1.1w' make: [Makefile:172: all] Error 2 emmake: error: 'make' failed (returned 2)

$vi Makefile CROSS_COMPILE=/home/yinggao.jt/emsdk/upstream/emscripten/em CC=$(CROSS_COMPILE)/home/yinggao.jt/emsdk/upstream/emscripten/emcc CXX=$(CROSS_COMPILE)/home/yinggao.jt/emsdk/upstream/emscripten/em++ CPPFLAGS= CFLAGS=-Wall -O3 CXXFLAGS=-Wall -O3 LDFLAGS= EX_LIBS=

MAKEDEPEND=

PERL=/usr/bin/perl

AR=$(CROSS_COMPILE)/home/yinggao.jt/emsdk/upstream/emscripten/emar ARFLAGS= r RANLIB=$(CROSS_COMPILE)/home/yinggao.jt/emsdk/upstream/emscripten/emranlib RC= $(CROSS_COMPILE)windres RCFLAGS=

System environment $gcc --version gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$cat /etc/issue Alibaba Group Enterprise Linux Server release 7.2 (Paladin) Kernel \r on an \m

It is a Centos-based system.

kripken commented 10 months ago

Please do not open duplicate issues across repos. Closing as a duplicate of https://github.com/emscripten-core/emscripten/issues/20539