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

is it supposed to work in Windows too? (failing currently) #5

Closed
aicarambazigalo opened this issue Aug 18, 2021 · 16 comments
Closed

is it supposed to work in Windows too? (failing currently) #5

aicarambazigalo opened this issue Aug 18, 2021 · 16 comments
Labels
bug Something isn't working

Comments

@aicarambazigalo
Copy link

I'm on Windows 7 64bit, using the latest zig that doesn't complain about something missing in kernel32.dll(or so) and these are the errors so far:

c:\zat\ZigAndroidTemplate-master>rm -r zig-cache

c:\zat\ZigAndroidTemplate-master>zig build
C:\zat\ZigAndroidTemplate-master\build.zig:119:29: error: expected type 'std.bui
ld.FileSource', found '*const [17:0]u8'
    aarch64_exe.libc_file = "./libc/arm64.conf";
                            ^
C:\zig\lib\std\build.zig:1333:24: note: std.build.FileSource declared here
pub const FileSource = union(enum) {
                       ^
C:\zig\lib\std\special\build_runner.zig:194:24: note: referenced here
        .ErrorUnion => try root.build(builder),
                       ^
C:\zat\ZigAndroidTemplate-master\build.zig:63:21: error: expected 3 argument(s),
 found 2
    exe.defineCMacro("ANDROID");
                    ^
C:\zig\lib\std\build.zig:1791:9: note: declared here
    pub fn defineCMacro(self: *LibExeObjStep, name: []const u8, value: ?[]const
u8) void {
        ^

c:\zat\ZigAndroidTemplate-master>zig version
0.9.0-dev.749+259f3458a

I'm new to zig and haven't done any program in it, yet. But I want to start with ... this :)
Any hints on how to fix the above ?
I assume, somehow, that this would all work if I were trying it on Linux?

I'm happy to provide more info, also I'm very interested in making this all work in Windows for I want to make at least 2 apk apps by using zig and this ZigAndroidTemplate would be the way I would learn how.

Thanks in advance.

@ikskuh
Copy link
Owner

ikskuh commented Aug 31, 2021

Oh poop, i didn't even see your issue 😮

I need to update both the Demo and the build.zig so this repo can be used standalone again.

I assume, somehow, that this would all work if I were trying it on Linux?

Nah, as the build.zig is currently broken beyond repair. I use this repo from zero-graphics where i only use the Sdk.zig which is up-to-date (just tested, builds with zig master)

@ikskuh ikskuh added the bug Something isn't working label Aug 31, 2021
@aicarambazigalo
Copy link
Author

Oh poop, i didn't even see your issue open_mouth

I need to update both the Demo and the build.zig so this repo can be used standalone again.

I assume, somehow, that this would all work if I were trying it on Linux?

Nah, as the build.zig is currently broken beyond repair. I use this repo from zero-graphics where i only use the Sdk.zig which is up-to-date (just tested, builds with zig master)

I'm still here but I'm learning android programming with Android Studio and Kotlin, those newbie courses from google developers site. I figured I have to know the basics anyway, then eventually try zig's way from here.

@ikskuh
Copy link
Owner

ikskuh commented Aug 31, 2021

I updated the repo, can you be my first guinea pig that does the zig build keystore install push run thing for me on windows? In theory everything should be autodetected now, but i haven't ever tested it.

Your build problems from above come from the fact that everything was outdated, i updated it now

@aicarambazigalo
Copy link
Author

I updated the repo, can you be my first guinea pig that does the zig build keystore install push run thing for me on windows? In theory everything should be autodetected now, but i haven't ever tested it.

totally

a@a-PC MINGW64 /e/zat/ZigAndroidTemplate (master)
$ zig build
Code Generation [623/3084] std.io.writer.Writer(std.fs.file.File,std.os.WriteErrCode Generation [1218/3084] std.io.writer.Writer(std.fs.file.File,std.os.WriteErCode Generation [2421/3084] std.array_list.ArrayListAligned(std.build.PkgConfigPCannot use default Android Studio SDK
    at C:\Users\a\AppData\Local\Android:
    Cannot access build-tools/, FileNotFound
Using java from Android Studio: C:\Program Files\Android\Android Studio\jre

Could not find all needed tools. Please edit .build_config\android.json to specify their paths.

Android SDK root is missing. Edit the config file, or set ANDROID_SDK_ROOT to your android install.
You will need build tools version 28.0.3 and android sdk platform 28

Android NDK root is missing. Edit the config file, or set ANDROID_NDK_ROOT to your android NDK install.
You will need NDK version 21.1.6352462

error: the following build command failed with exit code 1:
E:\zat\ZigAndroidTemplate\zig-cache\o\51eff65f619f195d3133532edfbc5a8a\build.exe C:\zig\zig.exe E:\zat\ZigAndroidTemplate E:\zat\ZigAndroidTemplate\zig-cache C:\Users\a\AppData\Local\zig

I have this path: C:\Users\a\AppData\Local\Android\Sdk\build-tools\30.0.3 and this C:\Users\a\AppData\Local\Android\Sdk\ndk\21.4.7075529 currently.

Can the ndk version it tries be changed or it really wants only 21.1.6352462 as it says?

@ikskuh
Copy link
Owner

ikskuh commented Aug 31, 2021

I think you can change that in the build.zig and it should still work. I never tried, though. Or you can just plug in the wrong path and try 🙈

@aicarambazigalo
Copy link
Author

It's not obvious from what I've said but it seems it's trying:
C:\Users\a\AppData\Local\Android/build-tools/
instead of
C:\Users\a\AppData\Local\Android/Sdk/build-tools/
by default

@ikskuh
Copy link
Owner

ikskuh commented Aug 31, 2021

Replace https://github.com/MasterQ32/ZigAndroidTemplate/blob/66daf5ae5c9828680e060a5a1f46b35c41537022/build.zig#L10

with

    const sdk = Sdk.init(b, null, .{
        .android_sdk_version = 30, // or 28
        .build_tools_version = "30.0.3",
        .ndk_version = "21.4.7075529",
    }); 

@aicarambazigalo
Copy link
Author

I've now gotten the proper sdk 28, 28.0.3 built tools(not seen in screenshot) and that specific ndk via Android Studio. But I haven't changed anything in ZAT yet.
gotten

ok I had to change something to append /Sdk in this:
https://github.com/MasterQ32/ZigAndroidTemplate/blob/66daf5ae5c9828680e060a5a1f46b35c41537022/build/auto-detect.zig#L195

otherwise I'd see this:

a@a-PC MINGW64 /e/zat/ZigAndroidTemplate (master)
$ zig build
Cannot use default Android Studio SDK
    at C:\Users\a\AppData\Local\Android:
    Cannot access build-tools/, FileNotFound
Using java from Android Studio: C:\Program Files\Android\Android Studio\jre

Could not find all needed tools. Please edit .build_config\android.json to specify their paths.

Android SDK root is missing. Edit the config file, or set ANDROID_SDK_ROOT to your android install.
You will need build tools version 28.0.3 and android sdk platform 28

Android NDK root is missing. Edit the config file, or set ANDROID_NDK_ROOT to your android NDK install.
You will need NDK version 21.1.6352462

error: the following build command failed with exit code 1:
E:\zat\ZigAndroidTemplate\zig-cache\o\51eff65f619f195d3133532edfbc5a8a\build.exe C:\zig\zig.exe E:\zat\ZigAndroidTemplate E:\zat\ZigAndroidTemplate\zig-cache C:\Users\a\AppData\Local\zig

but now I see this:

a@a-PC MINGW64 /e/zat/ZigAndroidTemplate (master)
$ zig build
Using android sdk from Android Studio: C:\Users\a\AppData\Local\Android/Sdk
Using side by side NDK install: C:\Users\a\AppData\Local\Android/Sdk\ndk\21.1.6352462
New configuration:
SDK: C:\Users\a\AppData\Local\Android/Sdk
NDK: C:\Users\a\AppData\Local\Android/Sdk\ndk\21.1.6352462
JDK: C:\Program Files\Android\Android Studio\jre
Code Generation [334/817] std.hash_map.HashMapUnmanaged(usize,*std.debug.ModuleDlld-link: error: undefined symbol: __declspec(dllimport) _fseeki64
>>> referenced by E:\zat\ZigAndroidTemplate\vendor\kuba-zip\miniz.h:5042
>>>               E:\zat\ZigAndroidTemplate\zig-cache\o\8335e1549df3514a037a3be67338bd2b\zip.obj:(mz_zip_reader_init_file)
>>> referenced by E:\zat\ZigAndroidTemplate\vendor\kuba-zip\miniz.h:5029
>>>               E:\zat\ZigAndroidTemplate\zig-cache\o\8335e1549df3514a037a3be67338bd2b\zip.obj:(mz_zip_file_read_func)
>>> referenced by E:\zat\ZigAndroidTemplate\vendor\kuba-zip\miniz.h:5867
>>>               E:\zat\ZigAndroidTemplate\zig-cache\o\8335e1549df3514a037a3be67338bd2b\zip.obj:(mz_zip_file_write_func)
>>> referenced 5 more times

lld-link: error: undefined symbol: __declspec(dllimport) _ftelli64
>>> referenced by E:\zat\ZigAndroidTemplate\vendor\kuba-zip\miniz.h:5046
>>>               E:\zat\ZigAndroidTemplate\zig-cache\o\8335e1549df3514a037a3be67338bd2b\zip.obj:(mz_zip_reader_init_file)
>>> referenced by E:\zat\ZigAndroidTemplate\vendor\kuba-zip\miniz.h:5028
>>>               E:\zat\ZigAndroidTemplate\zig-cache\o\8335e1549df3514a037a3be67338bd2b\zip.obj:(mz_zip_file_read_func)
>>> referenced by E:\zat\ZigAndroidTemplate\vendor\kuba-zip\miniz.h:5866
>>>               E:\zat\ZigAndroidTemplate\zig-cache\o\8335e1549df3514a037a3be67338bd2b\zip.obj:(mz_zip_file_write_func)
>>> referenced 1 more times
error: LLDReportedFailure
zip_add...The following command exited with error code 1:
C:\zig\zig.exe build-exe E:\zat\ZigAndroidTemplate\tools\zip_add.zig -cflags -std=c99 -fno-sanitize=undefined -- E:\zat\ZigAndroidTemplate\vendor\kuba-zip\zip.c -lc --cache-dir E:\zat\ZigAndroidTemplate\zig-cache --global-cache-dir C:\Users\a\AppData\Local\zig --name zip_add -I E:\zat\ZigAndroidTemplate\vendor\kuba-zip --enable-cache
error: the following build command failed with exit code 1:
E:\zat\ZigAndroidTemplate\zig-cache\o\51eff65f619f195d3133532edfbc5a8a\build.exe C:\zig\zig.exe E:\zat\ZigAndroidTemplate E:\zat\ZigAndroidTemplate\zig-cache C:\Users\a\AppData\Local\zig

a@a-PC MINGW64 /e/zat/ZigAndroidTemplate (master)
$

I'm using this zig, sha256:
8199d9e200f31d4e2f9552383819985c2a84b09059bfc9999f114e9bbe3981e1 *zig-windows-x86_64-0.9.0-dev.866+6a6e2cd64.zip

@aicarambazigalo
Copy link
Author

aicarambazigalo commented Aug 31, 2021

Replace

https://github.com/MasterQ32/ZigAndroidTemplate/blob/66daf5ae5c9828680e060a5a1f46b35c41537022/build.zig#L10

with

    const sdk = Sdk.init(b, null, .{
        .android_sdk_version = 30, // or 28
        .build_tools_version = "30.0.3",
        .ndk_version = "21.4.7075529",
    }); 

If I do that, I see the following (still used that /Sdk append in code):

a@a-PC MINGW64 /e/zat/ZigAndroidTemplate (master)
$ rm zig-cache -rf

a@a-PC MINGW64 /e/zat/ZigAndroidTemplate (master)
$ time zig build
Code Generation [1117/3084] std.io.writer.Writer(std.fs.file.File,std.os.WriteErCode Generation [1545/3084] std.array_list.ArrayListAligned(std.build.AvailableOCode Generation [2563/3084] std.comptime_string_map.ComptimeStringMap(std.zig.tolld-link: error: undefined symbol: __declspec(dllimport) _fseeki64
>>> referenced by E:\zat\ZigAndroidTemplate\vendor\kuba-zip\miniz.h:5042
>>>               E:\zat\ZigAndroidTemplate\zig-cache\o\8335e1549df3514a037a3be67338bd2b\zip.obj:(mz_zip_reader_init_file)
>>> referenced by E:\zat\ZigAndroidTemplate\vendor\kuba-zip\miniz.h:5029
>>>               E:\zat\ZigAndroidTemplate\zig-cache\o\8335e1549df3514a037a3be67338bd2b\zip.obj:(mz_zip_file_read_func)
>>> referenced by E:\zat\ZigAndroidTemplate\vendor\kuba-zip\miniz.h:5867
>>>               E:\zat\ZigAndroidTemplate\zig-cache\o\8335e1549df3514a037a3be67338bd2b\zip.obj:(mz_zip_file_write_func)
>>> referenced 5 more times

lld-link: error: undefined symbol: __declspec(dllimport) _ftelli64
>>> referenced by E:\zat\ZigAndroidTemplate\vendor\kuba-zip\miniz.h:5046
>>>               E:\zat\ZigAndroidTemplate\zig-cache\o\8335e1549df3514a037a3be67338bd2b\zip.obj:(mz_zip_reader_init_file)
>>> referenced by E:\zat\ZigAndroidTemplate\vendor\kuba-zip\miniz.h:5028
>>>               E:\zat\ZigAndroidTemplate\zig-cache\o\8335e1549df3514a037a3be67338bd2b\zip.obj:(mz_zip_file_read_func)
>>> referenced by E:\zat\ZigAndroidTemplate\vendor\kuba-zip\miniz.h:5866
>>>               E:\zat\ZigAndroidTemplate\zig-cache\o\8335e1549df3514a037a3be67338bd2b\zip.obj:(mz_zip_file_write_func)
>>> referenced 1 more times
error: LLDReportedFailure
zip_add...The following command exited with error code 1:
C:\zig\zig.exe build-exe E:\zat\ZigAndroidTemplate\tools\zip_add.zig -cflags -std=c99 -fno-sanitize=undefined -- E:\zat\ZigAndroidTemplate\vendor\kuba-zip\zip.c -lc --cache-dir E:\zat\ZigAndroidTemplate\zig-cache --global-cache-dir C:\Users\a\AppData\Local\zig --name zip_add -I E:\zat\ZigAndroidTemplate\vendor\kuba-zip --enable-cache
error: the following build command failed with exit code 1:
E:\zat\ZigAndroidTemplate\zig-cache\o\51eff65f619f195d3133532edfbc5a8a\build.exe C:\zig\zig.exe E:\zat\ZigAndroidTemplate E:\zat\ZigAndroidTemplate\zig-cache C:\Users\a\AppData\Local\zig

real    0m16.184s
user    0m0.000s
sys     0m0.031s

a@a-PC MINGW64 /e/zat/ZigAndroidTemplate (master)
$

ie.
noobie.patch

diff --git a/build.zig b/build.zig
index f5c2d6d..2cd9888 100644
--- a/build.zig
+++ b/build.zig
@@ -7,7 +7,12 @@ const Sdk = @import("Sdk.zig");
 
 pub fn build(b: *std.build.Builder) !void {
     // Default-initialize SDK
-    const sdk = Sdk.init(b, null, .{});
+//    const sdk = Sdk.init(b, null, .{});
+    const sdk = Sdk.init(b, null, .{
+        .android_sdk_version = 30, // or 28
+        .build_tools_version = "30.0.3",
+        .ndk_version = "21.4.7075529",
+    });
     const mode = b.standardReleaseOptions();
 
     // Provide some KeyStore structure so we can sign our app.
diff --git a/build/auto-detect.zig b/build/auto-detect.zig
index af23662..dd74119 100644
--- a/build/auto-detect.zig
+++ b/build/auto-detect.zig
@@ -189,10 +189,10 @@ pub fn findUserConfig(b: *Builder, versions: Sdk.ToolchainVersions) !UserConfig
         }
 
         // If we didn't find an sdk in the registry, check the default install location.
-        // On windows, this is AppData/Local/Android.
+        // On windows, this is AppData/Local/Android/Sdk.
         if (config.android_sdk_root.len == 0) {
             if (std.process.getEnvVarOwned(b.allocator, "LOCALAPPDATA")) |appdata_local| {
-                const sdk_path = pathConcat(b, appdata_local, "Android");
+                const sdk_path = pathConcat(b, appdata_local, "Android/Sdk");
                 if (findProblemWithAndroidSdk(b, versions, sdk_path)) |problem| {
                     print("Cannot use default Android Studio SDK\n    at {s}:\n    {s}\n", .{ sdk_path, problem });
                 } else {

@aicarambazigalo
Copy link
Author

aicarambazigalo commented Aug 31, 2021

Looks like it's possibly zig's fault? ziglang/zig#9402
it seems it may be a zip thing? https://github.com/kuba--/zip/issues/193

I am on windows 7 x64 pro sp1 though, not win9x hmm... investigating further

@aicarambazigalo
Copy link
Author

aicarambazigalo commented Aug 31, 2021

Well, that almost worked (maybe it did and this is the next, unrelated, compilation error in ZAT?):

a@a-PC MINGW64 /e/zat/ZigAndroidTemplate (master)
$ time zig build
Code Generation [1548/3084] std.array_list.ArrayListAligned(std.build.AvailableO
Code Generation [256/817] std.io.reader.Reader(std.fs.file.File,std.os.ReadErrorerror(libc_installation): msvc_lib_dir may not be empty for windows-msvc

error: unable to parse libc paths file at path E:\zat\ZigAndroidTemplate\zig-cache\android-libc\android-30-arm64-v8a.conf: ParseError
zig-app-template...The following command exited with error code 1:
C:\zig\zig.exe build-lib E:\zat\ZigAndroidTemplate\example\main.zig -lc -lGLESv2 -lEGL -landroid -llog -ffunction-sections --libc E:\zat\ZigAndroidTemplate\zig-cache\android-libc\android-30-arm64-v8a.conf --cache-dir E:\zat\ZigAndroidTemplate\zig-cache --global-cache-dir C:\Users\a\AppData\Local\zig --name zig-app-template -dynamic -fcompiler-rt -target aarch64-linux-android -mcpu=generic+v8a --pkg-begin android E:\zat\ZigAndroidTemplate\src\android-support.zig --pkg-begin build_options E:\zat\ZigAndroidTemplate\zig-cache\android-sdk\o\1bc404ad8ad4a58fb6197b77cb82c279cb9282b7\build_options.zig --pkg-end --pkg-end -I C:\Users\a\AppData\Local\Android\Sdk\ndk\21.1.6352462\sysroot\usr\include -I C:\Users\a\AppData\Local\Android\Sdk\ndk\21.1.6352462\sysroot\usr\include\aarch64-linux-android -L C:\Users\a\AppData\Local\Android\Sdk\ndk\21.1.6352462\platforms\android-30\arch-arm64\usr\lib -D ANDROID -fPIC --enable-cache
error: the following build command failed with exit code 1:
E:\zat\ZigAndroidTemplate\zig-cache\o\51eff65f619f195d3133532edfbc5a8a\build.exe C:\zig\zig.exe E:\zat\ZigAndroidTemplate E:\zat\ZigAndroidTemplate\zig-cache C:\Users\a\AppData\Local\zig

real    0m16.032s
user    0m0.000s
sys     0m0.000s

a@a-PC MINGW64 /e/zat/ZigAndroidTemplate (master)
$

android-30-arm64-v8a.conf is:

include_dir=C:\Users\a\AppData\Local\Android\Sdk\ndk\21.1.6352462\sysroot\usr\include
sys_include_dir=C:\Users\a\AppData\Local\Android\Sdk\ndk\21.1.6352462\sysroot\usr\include
crt_dir=C:\Users\a\AppData\Local\Android\Sdk\ndk\21.1.6352462\platforms\android-30\arch-arm64\usr\lib
msvc_lib_dir=
kernel32_lib_dir=
gcc_dir=

Hmm so this msvc_lib_dir may not be empty for windows-msvc is made by this maybe:
https://github.com/MasterQ32/ZigAndroidTemplate/blob/66daf5ae5c9828680e060a5a1f46b35c41537022/Sdk.zig#L643

and it doesn't want it to be empty.
ok this path seems to work msvc_lib_dir=C:\Users\a\AppData\Local\Android\Sdk\ndk\21.1.6352462\toolchains\aarch64-linux-android-4.9\prebuilt\windows-x86_64\lib\gcc\aarch64-linux-android\4.9.x as I've gotten a diff. error:

a@a-PC MINGW64 /e/zat/ZigAndroidTemplate (master)
$ time zig build
Code Generation [1304/3084] std.array_list.ArrayListAligned(*std.build.LibExeObj
Code Generation [2448/3084] std.hash_map.HashMapUnmanaged([]const u8,void,std.haerror(libc_installation): missing field: kernel32_lib_dir

error: unable to parse libc paths file at path E:\zat\ZigAndroidTemplate\zig-cache\android-libc\android-30-arm64-v8a.conf: ParseError
zig-app-template...The following command exited with error code 1:
C:\zig\zig.exe build-lib E:\zat\ZigAndroidTemplate\example\main.zig -lc -lGLESv2 -lEGL -landroid -llog -ffunction-sections --libc E:\zat\ZigAndroidTemplate\zig-cache\android-libc\android-30-arm64-v8a.conf --cache-dir E:\zat\ZigAndroidTemplate\zig-cache --global-cache-dir C:\Users\a\AppData\Local\zig --name zig-app-template -dynamic -fcompiler-rt -target aarch64-linux-android -mcpu=generic+v8a --pkg-begin android E:\zat\ZigAndroidTemplate\src\android-support.zig --pkg-begin build_options E:\zat\ZigAndroidTemplate\zig-cache\android-sdk\o\1bc404ad8ad4a58fb6197b77cb82c279cb9282b7\build_options.zig --pkg-end --pkg-end -I C:\Users\a\AppData\Local\Android\Sdk\ndk\21.1.6352462\sysroot\usr\include -I C:\Users\a\AppData\Local\Android\Sdk\ndk\21.1.6352462\sysroot\usr\include\aarch64-linux-android -L C:\Users\a\AppData\Local\Android\Sdk\ndk\21.1.6352462\platforms\android-30\arch-arm64\usr\lib -D ANDROID -fPIC --enable-cache
error: the following build command failed with exit code 1:
E:\zat\ZigAndroidTemplate\zig-cache\o\51eff65f619f195d3133532edfbc5a8a\build.exe C:\zig\zig.exe E:\zat\ZigAndroidTemplate E:\zat\ZigAndroidTemplate\zig-cache C:\Users\a\AppData\Local\zig

real    0m15.670s
user    0m0.000s
sys     0m0.031s

Anyway, here's git diff thus far:

diff --git a/Sdk.zig b/Sdk.zig
index f40a420..0e064e4 100644
--- a/Sdk.zig
+++ b/Sdk.zig
@@ -59,6 +59,7 @@ pub fn init(b: *Builder, user_config: ?UserConfig, versions: ToolchainVersions)
         zip_add.addCSourceFile(sdkRoot() ++ "/vendor/kuba-zip/zip.c", &[_][]const u8{
             "-std=c99",
             "-fno-sanitize=undefined",
+            //"-lws2_32",
         });
         zip_add.addIncludeDir(sdkRoot() ++ "/vendor/kuba-zip");
         zip_add.linkLibC();
@@ -640,7 +641,10 @@ fn createLibCFile(path: []const u8, include_dir: []const u8, sys_include_dir: []
     try writer.print("include_dir={s}\n", .{include_dir});
     try writer.print("sys_include_dir={s}\n", .{sys_include_dir});
     try writer.print("crt_dir={s}\n", .{crt_dir});
-    try writer.writeAll("msvc_lib_dir=\n");
+    const something=
+     \\msvc_lib_dir=C:\Users\a\AppData\Local\Android\Sdk\ndk\21.1.6352462\toolchains\aarch64-linux-android-4.9\prebuilt\windows-x86_64\lib\gcc\aarch64-linux-android\4.9.x\n
+     ;
+    try writer.writeAll(something);
     try writer.writeAll("kernel32_lib_dir=\n");
     try writer.writeAll("gcc_dir=\n");
 }
diff --git a/build.zig b/build.zig
index f5c2d6d..2cd9888 100644
--- a/build.zig
+++ b/build.zig
@@ -7,7 +7,12 @@ const Sdk = @import("Sdk.zig");
 
 pub fn build(b: *std.build.Builder) !void {
     // Default-initialize SDK
-    const sdk = Sdk.init(b, null, .{});
+//    const sdk = Sdk.init(b, null, .{});
+    const sdk = Sdk.init(b, null, .{
+        .android_sdk_version = 30, // or 28
+        .build_tools_version = "30.0.3",
+        .ndk_version = "21.4.7075529",
+    });
     const mode = b.standardReleaseOptions();
 
     // Provide some KeyStore structure so we can sign our app.
diff --git a/build/auto-detect.zig b/build/auto-detect.zig
index af23662..dd74119 100644
--- a/build/auto-detect.zig
+++ b/build/auto-detect.zig
@@ -189,10 +189,10 @@ pub fn findUserConfig(b: *Builder, versions: Sdk.ToolchainVersions) !UserConfig
         }
 
         // If we didn't find an sdk in the registry, check the default install location.
-        // On windows, this is AppData/Local/Android.
+        // On windows, this is AppData/Local/Android/Sdk.
         if (config.android_sdk_root.len == 0) {
             if (std.process.getEnvVarOwned(b.allocator, "LOCALAPPDATA")) |appdata_local| {
-                const sdk_path = pathConcat(b, appdata_local, "Android");
+                const sdk_path = pathConcat(b, appdata_local, "Android/Sdk");
                 if (findProblemWithAndroidSdk(b, versions, sdk_path)) |problem| {
                     print("Cannot use default Android Studio SDK\n    at {s}:\n    {s}\n", .{ sdk_path, problem });
                 } else {
diff --git a/vendor/kuba-zip/miniz.h b/vendor/kuba-zip/miniz.h
index f9821c9..e867e4c 100644
--- a/vendor/kuba-zip/miniz.h
+++ b/vendor/kuba-zip/miniz.h
@@ -4154,8 +4154,10 @@ static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream) {
 #define MZ_FCLOSE fclose
 #define MZ_FREAD fread
 #define MZ_FWRITE fwrite
-#define MZ_FTELL64 _ftelli64
-#define MZ_FSEEK64 _fseeki64
+//#define MZ_FTELL64 _ftelli64
+//#define MZ_FSEEK64 _fseeki64
+#define MZ_FTELL64 ftell
+#define MZ_FSEEK64 fseek
 #define MZ_FILE_STAT_STRUCT _stat
 #define MZ_FILE_STAT _stat
 #define MZ_FFLUSH fflush

@aicarambazigalo
Copy link
Author

I was able to use miniz.h v2.2.0 from kuba 's zip repo and with that _ftelli64 fix it compiled ok, at least.
https://github.com/kuba--/zip/issues/193#issuecomment-909756330

@ikskuh
Copy link
Owner

ikskuh commented Sep 1, 2021

I am on windows 7 x64 pro sp1 though, not win9x hmm... investigating further

As Zig doesn't support Win7, i won't fix bugs related to Windows 7, sorry

Hmm so this msvc_lib_dir may not be empty for windows-msvc is made by this maybe:

This shouldn't be relevant at all, as the ZAT doesn't use the libc files with windows-msvc ever 🤔

I'll try compiling the example app on a windows later, stay tuned. And thanks for all this investigation!

@aicarambazigalo
Copy link
Author

I am on windows 7 x64 pro sp1 though, not win9x hmm... investigating further

As Zig doesn't support Win7, i won't fix bugs related to Windows 7, sorry

Ah I didn't know that about Zig for some reason, but I am only able to run things on win7, and I've never touched win10, then maybe some things I've encountered don't apply anymore like those 'zip' errors from above, maybe windows legacy means any non win10 these days heh.

Hmm so this msvc_lib_dir may not be empty for windows-msvc is made by this maybe:

This shouldn't be relevant at all, as the ZAT doesn't use the libc files with windows-msvc ever thinking

you're right any value works, it just has to pass the non-empty check

I'll try compiling the example app on a windows later, stay tuned. And thanks for all this investigation!

Yeah, I guess then if I get win10 I'm welcome to try again then? and only mention something if it fails...

@ikskuh
Copy link
Owner

ikskuh commented Sep 1, 2021

This is blocking on ziglang/zig#9670 right now. If this is merged, it should work to build ZAT with windows

@ikskuh
Copy link
Owner

ikskuh commented Sep 21, 2021

Now that 9670 is merged, i can close this issue. I installed CI that will check windows, macos and linux

@ikskuh ikskuh closed this as completed Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants