-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Comments
Oh poop, i didn't even see your issue 😮 I need to update both the Demo and the
Nah, as the build.zig is currently broken beyond repair. I use this repo from zero-graphics where i only use the |
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. |
I updated the repo, can you be my first guinea pig that does the Your build problems from above come from the fact that everything was outdated, i updated it now |
totally
I have this path: Can the ndk version it tries be changed or it really wants only |
I think you can change that in the |
It's not obvious from what I've said but it seems it's trying: |
with const sdk = Sdk.init(b, null, .{
.android_sdk_version = 30, // or 28
.build_tools_version = "30.0.3",
.ndk_version = "21.4.7075529",
}); |
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. ok I had to change something to append otherwise I'd see this:
but now I see this:
I'm using this zig, sha256: |
If I do that, I see the following (still used that
ie. 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 { |
I am on windows 7 x64 pro sp1 though, not win9x hmm... investigating further |
Well, that almost worked (maybe it did and this is the next, unrelated, compilation error in ZAT?):
Hmm so this and it doesn't want it to be empty.
Anyway, here's 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 |
I was able to use miniz.h v2.2.0 from kuba 's zip repo and with that |
As Zig doesn't support Win7, i won't fix bugs related to Windows 7, sorry
This shouldn't be relevant at all, as the ZAT doesn't use the libc files with I'll try compiling the example app on a windows later, stay tuned. And thanks for all this investigation! |
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.
you're right any value works, it just has to pass the non-empty check
Yeah, I guess then if I get win10 I'm welcome to try again then? and only mention something if it fails... |
This is blocking on ziglang/zig#9670 right now. If this is merged, it should work to build ZAT with windows |
Now that 9670 is merged, i can close this issue. I installed CI that will check windows, macos and linux |
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:
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.
The text was updated successfully, but these errors were encountered: