mamba icon indicating copy to clipboard operation
mamba copied to clipboard

could not find macOS version by calling sw_vers

Open danpf opened this issue 2 years ago • 5 comments

running micromamba update gives:

warning  libmamba Could not find macOS version by calling 'sw_vers -productVersion'
    Please file a bug report.
    Error: Invalid argument
warning  libmamba osx version not found (virtual package skipped)

I'm inclined to say that it's something wrong with how reproc is called -- maybe the dylib is bad, or it has a bug somehow? as I'm not able to capture any output with this code either:

        {
          std::string out, err;
          reproc::sink::string outt(out);
          reproc::sink::string errt(err);
          std::vector<std::string> args = { "/bin/echo", "hixx" };
          LOG_WARNING << "echohiy";
          auto [status, ec] = reproc::run(
              args, reproc::options{}, outt, errt);
            std::cout
                << "out: "
                << out.size() << "\n"
                << "err: "
                << err.size() << "\n"
                << int(bool(ec)) << std::endl;
        }

gives:

warning  libmamba echohiy                                                                                           
out: 0                                                                                                              
err: 0
1
$ uname -a
Darwin laptop 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64 x86_64

danpf avatar Jun 22 '22 23:06 danpf

Just to make sure, when you execute sw_vers -productVersion on the terminal, it works fine?

And since you are compiling things yourself, do you mind telling me where you got reproc from? Are you using the conda-forge package?

wolfv avatar Jun 23 '22 05:06 wolfv

Just to make sure, when you execute sw_vers -productVersion on the terminal, it works fine?

yes I get 12.4 when I run it from the terminal

do you mind telling me where you got reproc from?

I followed the development install instructions, had a bunch of problems similar to #1753 but got it figured out in the end.

  reproc               14.2.3        h0d85af4_0          conda-forge
  reproc-cpp           14.2.3        he49afe7_0          conda-forge
  reproc-cpp-static    14.2.3        he49afe7_0          conda-forge
  reproc-static        14.2.3        h0d85af4_0          conda-forge

I just tried cloning reproc's git repo and changing an example:

diff --git a/reproc++/examples/run.cpp b/reproc++/examples/run.cpp
index b88c595..21dcf9b 100644
--- a/reproc++/examples/run.cpp
+++ b/reproc++/examples/run.cpp
@@ -1,10 +1,26 @@
 #include <iostream>
+#include <vector>
+#include <string>
 
 #include <reproc++/run.hpp>
 
 // Equivalent to reproc's run example but implemented using reproc++.
 int main(int argc, const char **argv)
 {
+    {
+          std::string out, err;
+          reproc::sink::string outt(out);
+          reproc::sink::string errt(err);
+          std::vector<std::string> args = { "/bin/echo", "hixx" };
+          auto [status, ec] = reproc::run(
+              args, reproc::options{}, outt, errt);
+            std::cout
+                << "out: "
+                << out.size() << "\n"
+                << "err: "
+                << err.size() << "\n"
+                << int(bool(ec)) << std::endl;
+        }
   (void) argc;
 
   int status = -1;
@@ -14,6 +30,7 @@ int main(int argc, const char **argv)
   options.redirect.parent = true;
   options.deadline = reproc::milliseconds(5000);
 
+
   std::tie(status, ec) = reproc::run(argv + 1, options);
 
   if (ec) {

then building gives:

$ ./build/reproc++/examples/run /bin/echo xx
out: 0
err: 0
1
Invalid argument

so maybe it's a problem with that repo?

$ otool -L ./build/reproc/examples/run
./build/reproc/examples/run:
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)

Also tried directly including reproc into the libmamba build

diff --git a/libmamba/CMakeLists.txt b/libmamba/CMakeLists.txt
index b85d26a..e05c9b4 100644
--- a/libmamba/CMakeLists.txt
+++ b/libmamba/CMakeLists.txt
@@ -391,7 +391,18 @@ macro(libmamba_create_target target_name linkage deps_linkage output_name)
         find_package(LibArchive REQUIRED)
         find_package(OpenSSL REQUIRED)
         find_package(yaml-cpp CONFIG REQUIRED)
-        find_package(reproc++ CONFIG REQUIRED)
+        include(FetchContent)
+        FetchContent_Declare(
+          reproc
+          GIT_REPOSITORY https://github.com/DaanDeMeyer/reproc.git
+          GIT_TAG        v14.2.4
+        )
+        set(REPROC++ ON)
+        set(REPROC_INSTALL ON)
+        set(REPROC_OBJECT_LIBRARIES ON)
+        # find_package(reproc++ CONFIG REQUIRED)
+        FetchContent_MakeAvailable(reproc)
+
         find_package(tl-expected REQUIRED)
 
         set(LIBMAMBA_LIBRARIES_DEPS
@@ -529,8 +540,8 @@ install(DIRECTORY "${LIBMAMBA_INCLUDE_DIR}/"
         PATTERN "*.h")
 
 # Makes the project importable from the build directory
-export(EXPORT ${PROJECT_NAME}-targets
-        FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")
+# export(EXPORT ${PROJECT_NAME}-targets
+#         FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")
 
 # Configure 'mambaConfig.cmake' for a build tree
 set(MAMBA_CONFIG_CODE "####### Expanded from \@MAMBA_CONFIG_CODE\@ #######\n")
$ otool -L ./build/micromamba/micromamba
./build/micromamba/micromamba:
        @rpath/libmamba.2.dylib (compatibility version 2.0.0, current version 2.0.0)
        @rpath/libyaml-cpp.0.7.dylib (compatibility version 0.7.0, current version 0.7.0)
        @rpath/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)

the problem still persists...

danpf avatar Jun 23 '22 15:06 danpf

I’ve had that problem in the past as well and never found a solution. I think it has something to do with codesigning or executable bits or something

jonashaag avatar Jun 23 '22 19:06 jonashaag

it appears to be due to my customization of my maximum number of file descriptors via ulimit -n unlimited

not sure if that's the same problem you had jonas, but at least it's tracked down....

danpf avatar Jun 24 '22 14:06 danpf

i experienced the same problem - ulimit -n 1000000 fixed.

samsamoa avatar Dec 13 '23 18:12 samsamoa