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

Add support for cross compiling on Windows for Android #24700

Open
Ashish2000L opened this issue Jun 21, 2024 · 10 comments
Open

Add support for cross compiling on Windows for Android #24700

Ashish2000L opened this issue Jun 21, 2024 · 10 comments
Labels
help wanted triaged: feature The issue/pr requests/adds a feature

Comments

@Ashish2000L
Copy link

Ashish2000L commented Jun 21, 2024

I am trying to build the static library for the android-arm platform from my windows 11 pc.

I have set the respective environment variables in windows from the NOTE-Android.md:-

ANDROID_NDK_ROOT=C:\Users\51010384\AppData\Local\Android\Sdk\ndk\27.0.11902837
PATH=%ANDROID_NDK_ROOT%\toolchains\llvm\prebuilt\windows-x86_64\bin

Using OpenSSL -> 3.3.1

I have ran the below command and came into issue:

`

perl Configure android-arm -static --predix=D:\OpenSSL_Android --openssldir=D:\OpenSSL_Android
Configuring OpenSSL version 3.3.1 for target android-arm
Using os-specific seed configuration
Failure! build file wasn't produced.
Please read INSTALL.md and associated NOTES-* files. You may also have to
look over your available compiler tool chain or change your configuration.
no NDK arm-linux-androideabi-gcc on $PATH at (eval 12) line 143.`

I have done research on this issue before and found few of this as active issue, some are suggesting to use the linux but my project is built on windows and I require this library to work in android. I am using Microsoft visual studio 2022, using developer powershell by microsoft visual studio and running code in win32, but I need my current project in android application so I have to have a static file.

I have tried using wsl, but it is giving error

`

armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-app_libctx.o apps/lib/app_libctx.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-app_params.o apps/lib/app_params.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-app_provider.o apps/lib/app_provider.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-app_rand.o apps/lib/app_rand.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-app_x509.o apps/lib/app_x509.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-apps.o apps/lib/apps.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-apps_opt_printf.o apps/lib/apps_opt_printf.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-apps_ui.o apps/lib/apps_ui.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-columns.o apps/lib/columns.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-engine.o apps/lib/engine.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-engine_loader.o apps/lib/engine_loader.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-fmt.o apps/lib/fmt.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-http_server.o apps/lib/http_server.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-log.o apps/lib/log.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-names.o apps/lib/names.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-opt.o apps/lib/opt.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-s_cb.o apps/lib/s_cb.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-s_socket.o apps/lib/s_socket.c
armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-tlssrp_depr.o apps/lib/tlssrp_depr.c
rm -f apps/libapps.a
llvm-ar rs apps/libapps.a apps/lib/libapps-lib-app_libctx.o apps/lib/libapps-lib-app_params.o apps/lib/libapps-lib-app_provider.o apps/lib/libapps-lib-app_rand.o apps/lib/libapps-lib-app_x509.o apps/lib/libapps-lib-apps.o apps/lib/libapps-lib-apps_opt_printf.o apps/lib/libapps-lib-apps_ui.o apps/lib/libapps-lib-columns.o apps/lib/libapps-lib-engine.o apps/lib/libapps-lib-engine_loader.o apps/lib/libapps-lib-fmt.o apps/lib/libapps-lib-http_server.o apps/lib/libapps-lib-log.o apps/lib/libapps-lib-names.o apps/lib/libapps-lib-opt.o apps/lib/libapps-lib-s_cb.o apps/lib/libapps-lib-s_socket.o apps/lib/libapps-lib-tlssrp_depr.o
make[1]: llvm-ar: No such file or directory
make[1]: *** [Makefile:3285: apps/libapps.a] Error 127
make[1]: Leaving directory '/mnt/c/Users/user/Downloads/openssl-openssl-3.3.1/openssl-openssl-3.3.1'
make: *** [Makefile:1668: build_sw] Error 2`

below is the configdata.pm --dump when using wsl:

Command line (with current working directory = .):

/usr/bin/perl ./Configure CC=clang android-arm no-dso no-engine -static --prefix=/mnt/d/OpenSSL_Android --openssldir=/mnt/d/OpenSSL_Android

Perl information:

/usr/bin/perl
5.34.0 for x86_64-linux-gnu-thread-multi

Enabled features:

apps
argon2
aria
asm
async
atexit
autoalginit
autoerrinit
autoload-config
bf
blake2
bulk
cached-fetch
camellia
cast
chacha
cmac
cmp
cms
comp
ct
deprecated
des
dgram
dh
docs
dsa
dtls
ec
ec2m
ecdh
ecdsa
ecx
err
filenames
gost
http
idea
legacy
md4
mdc2
multiblock
nextprotoneg
ocb
ocsp
pinshared
poly1305
posix-io
psk
quic
unstable-qlog
rc2
rc4
rdrand
rfc3779
rmd160
scrypt
secure-memory
seed
siphash
siv
sm2
sm2-precomp
sm3
sm4
sock
srp
srtp
sse2
ssl
ssl-trace
static-engine
stdio
tests
tls
ts
ui-console
whirlpool
tls1
tls1-method
tls1_1
tls1_1-method
tls1_2
tls1_2-method
tls1_3
dtls1
dtls1-method
dtls1_2
dtls1_2-method

Disabled features:

acvp-tests          [cascade]        OPENSSL_NO_ACVP_TESTS
afalgeng            [cascade]        OPENSSL_NO_AFALGENG
asan                [default]        OPENSSL_NO_ASAN
brotli              [default]        OPENSSL_NO_BROTLI
brotli-dynamic      [default]        OPENSSL_NO_BROTLI_DYNAMIC
buildtest-c++       [default]
capieng             [cascade]        OPENSSL_NO_CAPIENG
winstore            [not-windows]    OPENSSL_NO_WINSTORE
crypto-mdebug       [default]        OPENSSL_NO_CRYPTO_MDEBUG
default-thread-pool [cascade]        OPENSSL_NO_DEFAULT_THREAD_POOL
devcryptoeng        [default]        OPENSSL_NO_DEVCRYPTOENG
dso                 [option]         OPENSSL_NO_DSO
dynamic-engine      [cascade]
ec_nistp_64_gcc_128 [default]        OPENSSL_NO_EC_NISTP_64_GCC_128
egd                 [default]        OPENSSL_NO_EGD
engine              [option]         OPENSSL_NO_ENGINE (skip engines, crypto/engine)
external-tests      [default]        OPENSSL_NO_EXTERNAL_TESTS
fips                [default]
fips-securitychecks [cascade]        OPENSSL_NO_FIPS_SECURITYCHECKS
fuzz-afl            [default]        OPENSSL_NO_FUZZ_AFL
fuzz-libfuzzer      [default]        OPENSSL_NO_FUZZ_LIBFUZZER
ktls                [default]        OPENSSL_NO_KTLS
loadereng           [cascade]        OPENSSL_NO_LOADERENG
makedepend          [unavailable]
md2                 [default]        OPENSSL_NO_MD2 (skip crypto/md2)
module              [cascade]
msan                [default]        OPENSSL_NO_MSAN
padlockeng          [cascade]        OPENSSL_NO_PADLOCKENG
pic                 [static]
rc5                 [default]        OPENSSL_NO_RC5 (skip crypto/rc5)
sctp                [default]        OPENSSL_NO_SCTP
shared              [cascade]
tfo                 [default]        OPENSSL_NO_TFO
thread-pool         [cascade]        OPENSSL_NO_THREAD_POOL
threads             [static]
trace               [default]        OPENSSL_NO_TRACE
ubsan               [default]        OPENSSL_NO_UBSAN
unit-test           [default]        OPENSSL_NO_UNIT_TEST
uplink              [no uplink_arch] OPENSSL_NO_UPLINK
weak-ssl-ciphers    [default]        OPENSSL_NO_WEAK_SSL_CIPHERS
zlib                [default]        OPENSSL_NO_ZLIB
zlib-dynamic        [default]        OPENSSL_NO_ZLIB_DYNAMIC
zstd                [default]        OPENSSL_NO_ZSTD
zstd-dynamic        [default]        OPENSSL_NO_ZSTD_DYNAMIC
ssl3                [default]        OPENSSL_NO_SSL3
ssl3-method         [default]        OPENSSL_NO_SSL3_METHOD

Config target attributes:

AR => "ar",
ARFLAGS => "qc",
CC => "gcc",
CFLAGS => "-Wall -O3",
CXX => "g++",
CXXFLAGS => "-Wall -O3",
HASHBANGPERL => "/usr/bin/env perl",
RANLIB => "ranlib",
RC => "windres",
asm_arch => "armv4",
bin_cflags => "-fPIE",
bin_lflags => "-pie",
bn_ops => "BN_LLONG RC4_CHAR",
build_file => "Makefile",
build_scheme => [ "unified", "unix" ],
cflags => "-pthread",
cppflags => "",
cxxflags => "-std=c++11 -pthread",
defines => [ "OPENSSL_BUILDING_OPENSSL" ],
disable => [  ],
dso_ldflags => "-Wl,-z,defs",
dso_scheme => "dlfcn",
enable => [  ],
ex_libs => "-ldl -pthread",
includes => [  ],
lflags => "",
lib_cflags => "",
lib_cppflags => "-DOPENSSL_USE_NODELETE",
lib_defines => [  ],
module_cflags => "",
module_cppflags => "",
module_cxxflags => "",
module_defines => "",
module_includes => "",
module_ldflags => "-shared -Wl,-Bsymbolic",
module_lflags => "",
perl_platform => "Unix",
perlasm_scheme => "void",
shared_cflag => "",
shared_cppflag => "",
shared_cxxflag => "",
shared_defflag => "-Wl,--version-script=",
shared_defines => "",
shared_extension => ".so",
shared_includes => "",
shared_ldflag => "-shared -Wl,-Bsymbolic",
shared_rcflag => "",
shared_sonameflag => "-Wl,-soname=",
shared_target => "linux-shared",
thread_defines => [  ],
thread_scheme => "pthreads",
unistd => "<unistd.h>",

Recorded environment:

AR =
BUILDFILE =
CC =
CFLAGS =
CPPFLAGS =
CROSS_COMPILE =
CXX =
CXXFLAGS =
HASHBANGPERL =
LDFLAGS =
LDLIBS =
OPENSSL_LOCAL_CONFIG_DIR =
PERL =
RANLIB =
RC =
RCFLAGS =
WINDRES =
__CNF_CFLAGS =
__CNF_CPPDEFINES =
__CNF_CPPFLAGS =
__CNF_CPPINCLUDES =
__CNF_CXXFLAGS =
__CNF_LDFLAGS =
__CNF_LDLIBS =

Makevars:

AR              = llvm-ar
ARFLAGS         = rs
ASFLAGS         =
CC              = armv7a-linux-androideabi34-clang
CFLAGS          = -Wall -O3
CPPDEFINES      =
CPPFLAGS        =
CPPINCLUDES     =
CXX             = g++
CXXFLAGS        = -Wall -O3
HASHBANGPERL    = /usr/bin/env perl
LDFLAGS         = -static
LDLIBS          =
PERL            = /usr/bin/perl
RANLIB          = :
RC              = windres
RCFLAGS         =

NOTE: These variables only represent the configuration view. The build file
template may have processed these variables further, please have a look at the
build file for more exact data:
Makefile

build file:

Makefile

build file templates:

Configurations/common0.tmpl
Configurations/unix-Makefile.tmpl

Can you please share any resource or something else I could you to fix this error and can run the same using windows machine for get static archive of android-arm.

@Ashish2000L Ashish2000L added the issue: bug report The issue was opened to report a bug label Jun 21, 2024
@nhorman
Copy link
Contributor

nhorman commented Jun 21, 2024

the first question would be, did you set ANDROID_NDK_ROOT and your PATH environment variables properly, as per the NOTES-ANDROID.md instructions? From the above, I don't see a reference to doing so

@Ashish2000L
Copy link
Author

Ashish2000L commented Jun 21, 2024

the first question would be, did you set ANDROID_NDK_ROOT and your PATH environment variables properly, as per the NOTES-ANDROID.md instructions? From the above, I don't see a reference to doing so

Apologies,
I have updated environment variables in the above problem. Below are the variables I have set:-

ANDROID_NDK_ROOT=C:\Users\51010384\AppData\Local\Android\Sdk\ndk\27.0.11902837
PATH=%ANDROID_NDK_ROOT%\toolchains\llvm\prebuilt\windows-x86_64\bin

@nhorman
Copy link
Contributor

nhorman commented Jun 21, 2024

so you're msl installation seems to be off, in that you don't have llvm-ar installed (it is perhaps just named ar, unsure).

I am guessing your Configure command failed because prefix is misspelled:

perl Configure android-arm -static --predix=D:\OpenSSL_Android --openssldir=D:\OpenSSL_Android

should be

perl Configure android-arm -static --prefix=D:\OpenSSL_Android --openssldir=D:\OpenSSL_Android

@Ashish2000L
Copy link
Author

I have checked with the correct command as well, it is still showing the same error i.e

no NDK arm-linux-androideabi-gcc on $PATH at (eval 12) line 143.

if msl is what causing the issues, how to make on. what should I do in that case?
Also why it is not working in wsl environment, do I have to install openssl project different way when working with wsl?

@nhorman
Copy link
Contributor

nhorman commented Jun 23, 2024

|no NDK arm-linux-androideabi-gcc on $PATH |at (eval 12) line 143.

It looks like the config target you selected is looking for gcc as a compiler, but your PATH is pointing to the binaries for clang.

If you want to use gcc you need to adjust your Path variable to point to the gcc tool chain for android

If you want to use clang...I'm on my phone so I can't look it up, but I believe there is an android -arm-clang target you need to select so the compiler command gets selected properly

@Ashish2000L
Copy link
Author

The NDK I have downloaded i.e r26 till r23, all are having clang in their toolchain. I was looking for gcc but I wasn't able to find it.
Is there a way by changing in the Configure file we can make it look for android-arm-clang file instead of gcc?

I have downloaded the windows zip for ndk from r26 to r23.

@nhorman
Copy link
Contributor

nhorman commented Jun 23, 2024

It supposed to detect that automatically, favoring clang over gcc as the latter is being phased out by android. Which makes me wonder why the proper clang prefix isn't getting found.

I suppose the next step would be to start adding some print statements in the Configurations/15-android.conf file aourd the comment:

            # see if there is NDK clang on $PATH, "universal" or "standalone"

To determine why the proper clang compiler prefix isn't getting chosen

@Ashish2000L
Copy link
Author

Ashish2000L commented Jun 24, 2024

the above config dump you are seeing are coming when I am using wsl. When using wsl it was able to find the clang abi file but I am getting another file not found error when trying to make the file.

armv7a-linux-androideabi34-clang -I. -Iinclude -Iapps/include -pthread -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSLDIR=""/mnt/d/OpenSSL_Android"" -DENGINESDIR=""/mnt/d/OpenSSL_Android/lib/engines-3"" -DMODULESDIR=""/mnt/d/OpenSSL_Android/lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -c -o apps/lib/libapps-lib-tlssrp_depr.o apps/lib/tlssrp_depr.c
rm -f apps/libapps.a
llvm-ar rs apps/libapps.a apps/lib/libapps-lib-app_libctx.o apps/lib/libapps-lib-app_params.o apps/lib/libapps-lib-app_provider.o apps/lib/libapps-lib-app_rand.o apps/lib/libapps-lib-app_x509.o apps/lib/libapps-lib-apps.o apps/lib/libapps-lib-apps_opt_printf.o apps/lib/libapps-lib-apps_ui.o apps/lib/libapps-lib-columns.o apps/lib/libapps-lib-engine.o apps/lib/libapps-lib-engine_loader.o apps/lib/libapps-lib-fmt.o apps/lib/libapps-lib-http_server.o apps/lib/libapps-lib-log.o apps/lib/libapps-lib-names.o apps/lib/libapps-lib-opt.o apps/lib/libapps-lib-s_cb.o apps/lib/libapps-lib-s_socket.o apps/lib/libapps-lib-tlssrp_depr.o
make[1]: llvm-ar: No such file or directory
make[1]: *** [Makefile:3285: apps/libapps.a] Error 127
make[1]: Leaving directory '/mnt/c/Users/user/Downloads/openssl-openssl-3.3.1/openssl-openssl-3.3.1'
make: *** [Makefile:1668: build_sw] Error 2`

I am not sure how to get these files or may be I am unable to set the files in their correct location. I am using the windows directory path

/mnt/c

but it is looking for /app to search for the files.

do I have to make some changes in saving the files in different location? Any workaround I can do to fix this issue?

@Ashish2000L
Copy link
Author

see if there is NDK clang on $PATH, "universal" or "standalone"

I have tried applying your suggestion by adding below print statements

        my $triarch = $triplet{$arch};
        my $cflags;
        my $cppflags;

        # see if there is NDK clang on $PATH, "universal" or "standalone"
		my $clang_path = which("clang");
		my $is_valid_clang_path = ($clang_path =~ m|^$ndk/.*/prebuilt/([^/]+)/|)? "path valid" : "path invalid";

		print "clang path found at -> $clang_path\n";
		print "is valid clang path-> $is_valid_clang_path\n";
		print "triarch path is -> $triarch\n";

I have found that the path it is checking for clang it is finding it as invalid in windows, I am getting logs as :

clang path found at -> C:\Users\user\AppData\Local\Android\Sdk\ndk\2701.119\TOOLCH1\llvm\prebuilt\WINDOW~1\bin\clang.EXE
is valid clang path-> path invalid
triarch path is -> arm-linux-androideabi

what sort of changes I make in regx to make it work for windows so that it find my clang directly as valid?

@t8m
Copy link
Member

t8m commented Jun 24, 2024

Cross-compiling for Android on Windows is not supported currently.

We would welcome pull requests that would add the support.

@t8m t8m added triaged: feature The issue/pr requests/adds a feature help wanted and removed issue: bug report The issue was opened to report a bug labels Jun 24, 2024
@t8m t8m changed the title no NDK arm-linux-androideabi-gcc on $PATH at (eval 12) line 143 error in windows and make[1]: *** [Makefile:3285: apps/libapps.a] Error 127 error when using wsl in windows Add support for cross compiling on Windows for Android Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted triaged: feature The issue/pr requests/adds a feature
Projects
None yet
Development

No branches or pull requests

3 participants