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

ndk: use unix path even on Windows #4903

Merged
merged 5 commits into from
Mar 31, 2024
Merged

ndk: use unix path even on Windows #4903

merged 5 commits into from
Mar 31, 2024

Conversation

SirLynix
Copy link
Member

@SirLynix SirLynix commented Mar 30, 2024

Fixes NDK compilation with some tools.

For example, building OpenSSL for Android on Windows fails with those buildenvs:

{
  SHFLAGS = "-llog -target aarch64-none-linux-android28 -static-libstdc++",
  LDFLAGS = "-llog -target aarch64-none-linux-android28 -fPIE -pie -static-libstdc++",
  ARFLAGS = "",
  CC = "E:\Android\Sdk\ndk\android-ndk-r26c-windows\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe",
  ACLOCAL_PATH = "",
  AS = "E:\Android\Sdk\ndk\android-ndk-r26c-windows\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe",
  CPP = "E:\Android\Sdk\ndk\android-ndk-r26c-windows\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe -E",
  PKG_CONFIG_PATH = "",
  CFLAGS = "-target aarch64-none-linux-android28 --sysroot=E:\Android\Sdk\ndk\android-ndk-r26c-windows\toolchains\llvm\prebuilt\windows-x86_64\sysroot -isystem E:\Android\Sdk\ndk\android-ndk-r26c-windows\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include\aarch64-linux-android",
  ASFLAGS = "-target aarch64-none-linux-android28 --sysroot=E:\Android\Sdk\ndk\android-ndk-r26c-windows\toolchains\llvm\prebuilt\windows-x86_64\sysroot -isystem E:\Android\Sdk\ndk\android-ndk-r26c-windows\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include\aarch64-linux-android",
  CPPFLAGS = "",
  CXXFLAGS = "-target aarch64-none-linux-android28 --sysroot=E:\Android\Sdk\ndk\android-ndk-r26c-windows\toolchains\llvm\prebuilt\windows-x86_64\sysroot -isystem E:\Android\Sdk\ndk\android-ndk-r26c-windows\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include\aarch64-linux-android",
  LD = "E:\Android\Sdk\ndk\android-ndk-r26c-windows\toolchains\llvm\prebuilt\windows-x86_64\bin\ld.exe",
  LDSHARED = "E:\Android\Sdk\ndk\android-ndk-r26c-windows\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe",
  AR = "E:\Android\Sdk\ndk\android-ndk-r26c-windows\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm-ar.exe"
}

using unix path fixes this

toolchain:add("cflags", "-isystem " .. path.join(ndk_sysroot, "usr", "include", triple))
toolchain:add("cxxflags","-isystem " .. path.join(ndk_sysroot, "usr", "include", triple))
toolchain:add("asflags", "-isystem " .. path.join(ndk_sysroot, "usr", "include", triple))
toolchain:add("cflags", "-isystem " .. format("%s/%s/%s/%s", ndk_sysroot, "usr", "include", triple))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use path.unix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so path.unix(path.join(...)) instead of just formatting using unix sep? 😕

@waruqi waruqi added this to the v2.9.1 milestone Mar 31, 2024
@waruqi waruqi merged commit dee0d86 into xmake-io:dev Mar 31, 2024
19 checks passed
SirLynix added a commit to xmake-io/xmake-repo that referenced this pull request Apr 1, 2024
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

Successfully merging this pull request may close these issues.

2 participants