You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/03/16 23:20:58 UTC

[GitHub] [tvm] csullivan commented on a change in pull request #7390: fix:getcwd not work on android platform

csullivan commented on a change in pull request #7390:
URL: https://github.com/apache/tvm/pull/7390#discussion_r595605745



##########
File path: apps/cpp_rpc/rpc_env.cc
##########
@@ -86,7 +86,13 @@ void CleanDir(const std::string& dirname);
 std::string BuildSharedLibrary(std::string file_in);
 
 RPCEnv::RPCEnv() {
-#ifndef _WIN32
+#if defined(ANDROID) || defined(__ANDROID__)
+  char cwd[PATH_MAX];
+  auto cmdline = fopen("/proc/self/cmdline", "r");
+  fread(cwd, 1, sizeof(cwd), cmdline);
+  fclose(cmdline);
+  base_ = "/data/data/" + std::string(cwd) + "/cache/rpc";
+#elif !defined(_WIN32)

Review comment:
       This change has the effect of now requiring a user to provide a target path to `RPCSession.upload(target=path)`, when running from `/data/local/tmp` for example. Without providing the target path, the `/data/data` prefix is always prepended resulting in errors like: 
   ```
      Check failed: !fs.fail() == false: Cannot open /data/data//data/local/tmp/tvm_rpc/cache/rpc/dev_lib_cl.so
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org