azat / chdig

Dig into ClickHouse with TUI interface.
MIT License
133 stars 13 forks source link

Binary packages for OSX (x86_64) #4

Closed azat closed 11 months ago

azat commented 1 year ago

Checklist

azat commented 11 months ago

Now chdig uses PyOxidizer (before there was pyinstaller, and it was even harder I guess), and it does not support cross-compiling yet - https://github.com/indygreg/PyOxidizer/issues/95

But, we can just add macos build, though there are some troubles - https://github.com/azat-archive/chdig/actions/runs/7213970687/job/19655035594

error: failed to run custom build command for `flameshow v0.1.0 (/Users/runner/work/chdig/chdig/contrib/flameshow)`

Caused by:
  process didn't exit successfully: `/Users/runner/work/chdig/chdig/target/release/build/flameshow-74918b552bac4fe8/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at contrib/flameshow/build.rs:40:9:
  Output { status: ExitStatus(unix_wait_status(256)), stdout: "downloading https://github.com/indygreg/python-build-standalone/releases/download/20221106/cpython-3.10.8%2B20221106-aarch64-apple-darwin-pgo-full.tar.zst\ndownloading https://github.com/indygreg/python-build-standalone/releases/download/20221106/cpython-3.10.8%2B20221106-x86_64-apple-darwin-pgo-full.tar.zst\nerror: calling pip install\n\nCaused by:\n    Bad CPU type in executable (os error 86)\n", stderr: "looking for config file in ancestry of /Users/runner/work/chdig/chdig/target/aarch64-apple-darwin/release/build/flameshow-9ef612682e2c7789/out\nresolving 1 targets\nresolving target resources\nresolving target exe\ntarget Python distribution for aarch64-apple-darwin resolves to: https://github.com/indygreg/python-build-standalone/releases/download/20221106/cpython-3.10.8%2B20221106-aarch64-apple-darwin-pgo-full.tar.zst (sha256=b905bdb0103b3a58f567719f544fb3a566f1587e724960c053da33[367](https://github.com/azat-archive/chdig/actions/runs/7213970687/job/19655035594#step:5:368)b3bbe21)\ninstalling modified distutils to /Library/Frameworks/Python.framework/Versions/Current/bin/tempdir/pyoxidizer-pip-install8rCR4E/packages\nmodifying distutils/_msvccompiler.py for oxidation\nmodifying distutils/command/build_ext.py for oxidation\nmodifying distutils/unixccompiler.py for oxidation\npip installing to /Library/Frameworks/Python.framework/Versions/Current/bin/tempdir/pyoxidizer-pip-install8rCR4E/install\nerror[PYOXIDIZER_PYTHON_EXECUTABLE]: calling pip install\n    \n    Caused by:\n        Bad CPU type in executable (os error 86)\n      --> /Users/runner/work/chdig/chdig/contrib/flameshow/pyoxidizer.bzl:51:30\n       |\n    51 |       exe.add_python_resources(exe.pip_install([\n       |  ______________________________^\n    52 | |         \"protobuf\",\n    53 | |         \"flameshow==1.1.1\",\n    54 | |     ]))\n       | |______^ PythonExecutable.pip_install()\n    \n    \n" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
make: *** [contrib/flameshow/build/pyo3-build-config-file-aarch64-apple-darwin.txt] Error 101
azat commented 11 months ago

That was wrong target, by using proper one it shows different error on macos-13 - https://github.com/azat-archive/chdig/actions/runs/7239490765/job/19721403130

2023-12-17T15:44:39.8053010Z error: failed to run custom build command for `flameshow v0.1.0 (/Users/runner/work/chdig/chdig/contrib/flameshow)`
2023-12-17T15:44:39.9246990Z 
2023-12-17T15:44:39.9910070Z Caused by:
2023-12-17T15:44:40.0855760Z   process didn't exit successfully: `/Users/runner/work/chdig/chdig/target/release/build/flameshow-74918b552bac4fe8/build-script-build` (exit status: 101)
2023-12-17T15:44:40.0956070Z   --- stderr
2023-12-17T15:44:40.1010030Z   thread 'main' panicked at contrib/flameshow/build.rs:40:9:
2023-12-17T15:44:40.1333140Z   Output { status: ExitStatus(unix_wait_status(256)), stdout: "downloading https://github.com/indygreg/python-build-standalone/releases/download/20221106/cpython-3.10.8%2B20221106-x86_64-apple-darwin-pgo-full.tar.zst\nerror: error calling build(): Runtime(RuntimeError { code: \"PYOXIDIZER_PYTHON_EMBEDDED_RESOURCES\", message: \"resolving Apple SDK to use\\n\\nCaused by:\\n    unable to find suitable Apple SDK supporting macosx11.1 or newer\", label: \"PythonEmbeddedResources.build()\" })\n", stderr: "looking for config file in ancestry of /Users/runner/work/chdig/chdig/target/x86_64-apple-darwin/release/build/flameshow-86560fa115cdd65c/out\nresolving 1 targets\nresolving target resources\nresolving target exe\ntarget Python distribution for x86_64-apple-darwin resolves to: https://github.com/indygreg/python-build-standalone/releases/download/20221106/cpython-3.10.8%2B20221106-x86_64-apple-darwin-pgo-full.tar.zst (sha256=c56a4728bdf498e3a4351906474811eafe0da29d811d0f5097d1f01e1fa7017c)\nreusing target Python distribution for host execution\ninstalling modified distutils to /Library/Frameworks/Python.framework/Versions/Current/bin/tempdir/pyoxidizer-pip-install1hPtIA/packages\nmodifying distutils/_msvccompiler.py for oxidation\nmodifying distutils/command/build_ext.py for oxidation\nmodifying distutils/unixccompiler.py for oxidation\npip installing to /Library/Frameworks/Python.framework/Versions/Current/bin/tempdir/pyoxidizer-pip-install1hPtIA/install\nUsing pip 22.3.1 from /Users/runner/Library/Caches/pyoxidizer/python_distributions/python.c56a4728bdf4/python/install/lib/python3.10/site-packages/pip (python 3.10)\nCollecting protobuf\n  Downloading protobuf-4.25.1-cp37-abi3-macosx_10_9_universal2.whl (394 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 394.2/394.2 kB 17.6 MB/s eta 0:00:00\nCollecting flameshow==1.1.1\n  Downloading flameshow-1.1.1-py3-none-any.whl (24 kB)\nCollecting iteround<2.0.0,>=1.0.4\n  Downloading iteround-1.0.4-py3-none-any.whl (7.3 kB)\nCollecting textual<0.38.0,>=0.37.1\n  Downloading textual-0.37.1-py3-none-any.whl (433 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 433.7/433.7 kB 33.2 MB/s eta 0:00:00\nCollecting click<9.0.0,>=8.1.7\n  Downloading click-8.1.7-py3-none-any.whl (97 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.9/97.9 kB 15.0 MB/s eta 0:00:00\nCollecting typing-extensions<5.0.0,>=4.7.1\n  Downloading typing_extensions-4.9.0-py3-none-any.whl (32 kB)\nCollecting rich>=13.3.3\n  Downloading rich-13.7.0-py3-none-any.whl (240 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 240.6/240.6 kB 31.2 MB/s eta 0:00:00\nCollecting markdown-it-py[linkify,plugins]>=2.1.0\n  Downloading markdown_it_py-3.0.0-py3-none-any.whl (87 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.5/87.5 kB 14.5 MB/s eta 0:00:00\nCollecting importlib-metadata>=4.11.3\n  Downloading importlib_metadata-7.0.0-py3-none-any.whl (23 kB)\nCollecting zipp>=0.5\n  Downloading zipp-3.17.0-py3-none-any.whl (7.4 kB)\nCollecting mdurl~=0.1\n  Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)\nCollecting linkify-it-py<3,>=1\n  Downloading linkify_it_py-2.0.2-py3-none-any.whl (19 kB)\nCollecting mdit-py-plugins\n  Downloading mdit_py_plugins-0.4.0-py3-none-any.whl (54 kB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.1/54.1 kB 6.6 MB/s eta 0:00:00\nCollecting pygments<3.0.0,>=2.13.0\n  Downloading pygments-2.17.2-py3-none-any.whl (1.2 MB)\n     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 39.9 MB/s eta 0:00:00\nCollecting uc-micro-py\n  Downloading uc_micro_py-1.0.2-py3-none-any.whl (6.2 kB)\nInstalling collected packages: iteround, zipp, uc-micro-py, typing-extensions, pygments, protobuf, mdurl, click, markdown-it-py, linkify-it-py, importlib-metadata, rich, mdit-py-plugins, textual, flameshow\n  Creating /private/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/pip-target-zuatvek3/bin\n  changing mode of /private/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/pip-target-zuatvek3/bin/pygmentize to 755\n  changing mode of /private/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/pip-target-zuatvek3/bin/markdown-it to 755\n  changing mode of /private/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/pip-target-zuatvek3/bin/flameshow to 755\nSuccessfully installed click-8.1.7 flameshow-1.1.1 importlib-metadata-7.0.0 iteround-1.0.4 linkify-it-py-2.0.2 markdown-it-py-3.0.0 mdit-py-plugins-0.4.0 mdurl-0.1.2 protobuf-4.25.1 pygments-2.17.2 rich-13.7.0 textual-0.37.1 typing-extensions-4.9.0 uc-micro-py-1.0.2 zipp-3.17.0\nwriting Python embedded artifacts to /Users/runner/work/chdig/chdig/contrib/flameshow/build/x86_64-apple-darwin/release/resources\nwarning: _distutils_hack contains __file__\nwarning: asyncio.__main__ contains __file__\nwarning: cProfile contains __file__\nwarning: distutils.command.sdist contains __file__\nwarning: distutils.core contains __file__\nwarning: distutils.dist contains __file__\nwarning: doctest contains __file__\nwarning: encodings contains __file__\nwarning: idlelib.browser contains __file__\nwarning: idlelib.config contains __file__\nwarning: idlelib.help contains __file__\nwarning: idlelib.help_about contains __file__\nwarning: idlelib.idle contains __file__\nwarning: idlelib.pyshell contains __file__\nwarning: idlelib.runscript contains __file__\nwarning: idlelib.tree contains __file__\nwarning: importlib contains __file__\nwarning: importlib._bootstrap contains __file__\nwarning: importlib._bootstrap_external contains __file__\nwarning: importlib.abc contains __file__\nwarning: inspect contains __file__\nwarning: lib2to3.pygram contains __file__\nwarning: logging contains __file__\nwarning: logging.handlers contains __file__\nwarning: modulefinder contains __file__\nwarning: multiprocessing.spawn contains __file__\nwarning: pdb contains __file__\nwarning: pip.__main__ contains __file__\nwarning: pip.__pip-runner__ contains __file__\nwarning: pip._internal.build_env contains __file__\nwarning: pip._internal.commands.debug contains __file__\nwarning: pip._internal.utils.misc contains __file__\nwarning: pip._internal.utils.setuptools_build contains __file__\nwarning: pip._internal.utils.virtualenv contains __file__\nwarning: pip._vendor contains __file__\nwarning: pip._vendor.certifi.core contains __file__\nwarning: pip._vendor.distlib.resources contains __file__\nwarning: pip._vendor.pep517.in_process contains __file__\nwarning: pip._vendor.pep517.in_process._in_process contains __file__\nwarning: pip._vendor.pkg_resources contains __file__\nwarning: pip._vendor.pygments.lexers.python contains __file__\nwarning: pip._vendor.pygments.sphinxext contains __file__\nwarning: pip._vendor.pygments.unistring contains __file__\nwarning: pip._vendor.rich.pretty contains __file__\nwarning: pip._vendor.rich.traceback contains __file__\nwarning: pkg_resources contains __file__\nwarning: pkgutil contains __file__\nwarning: profile contains __file__\nwarning: pyclbr contains __file__\nwarning: pydoc contains __file__\nwarning: pydoc_data.topics contains __file__\nwarning: pygments.lexers._lua_builtins contains __file__\nwarning: pygments.lexers._mysql_builtins contains __file__\nwarning: pygments.lexers._php_builtins contains __file__\nwarning: pygments.lexers._postgres_builtins contains __file__\nwarning: pygments.lexers._scilab_builtins contains __file__\nwarning: pygments.lexers._sourcemod_builtins contains __file__\nwarning: pygments.lexers.python contains __file__\nwarning: pygments.sphinxext contains __file__\nwarning: pygments.unistring contains __file__\nwarning: rich.pretty contains __file__\nwarning: rich.traceback contains __file__\nwarning: runpy contains __file__\nwarning: setuptools._distutils.command.sdist contains __file__\nwarning: setuptools._distutils.core contains __file__\nwarning: setuptools._distutils.dist contains __file__\nwarning: setuptools.build_meta contains __file__\nwarning: setuptools.command.bdist_egg contains __file__\nwarning: setuptools.command.build_ext contains __file__\nwarning: setuptools.command.py36compat contains __file__\nwarning: setuptools.command.setopt contains __file__\nwarning: setuptools.launch contains __file__\nwarning: setuptools.sandbox contains __file__\nwarning: site contains __file__\nwarning: trace contains __file__\nwarning: turtle contains __file__\nwarning: turtledemo.__main__ contains __file__\nwarning: unittest contains __file__\nwarning: unittest.loader contains __file__\nwarning: venv contains __file__\nwarning: zipimport contains __file__\n__file__ was encountered in some embedded modules\nPyOxidizer does not set __file__ and this may create problems at run-time\nSee https://github.com/indygreg/PyOxidizer/issues/69 for more\ngenerating custom link library containing Python...\nderiving custom config.c from 98 extension modules\ncompiling custom config.c to object file\nlocating Apple SDK macosx11.1+ supporting macosx10.9\n" }
2023-12-17T15:44:40.1876630Z   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2023-12-17T15:44:40.1962160Z warning: build failed, waiting for other jobs to finish...
2023-12-17T15:44:42.5599290Z make: *** [contrib/flameshow/build/pyo3-build-config-file-x86_64-apple-darwin.txt] Error 101
azat commented 11 months ago

I've tried to compile it on macos 14.1 m1 - everything is OK, but on macos 14.1 x86_64 it shows the error above

azat commented 11 months ago

but on macos 14.1 x86_64 it shows the error above

This is because:

use apple_sdk::{SdkSearch, ParsedSdk, SdkSorting, AppleSdk, SdkSearchLocation};

fn main()
{
        let sdks = SdkSearch::default()
            .location(SdkSearchLocation::SystemXcodes)
            .platform("macosx".try_into().unwrap())
            .minimum_version("11.9")
            // None of available SDKs supports 10.9
            // .deployment_target("macosx", "10.9")
            .sorting(SdkSorting::VersionDescending)
            .search::<ParsedSdk>()
            .expect("failed to search for SDKs");

        for sdk in sdks {
            println!("{}: {:?}", sdk.sdk_path(), sdk.supported_targets);
        }
}
MacOSX (version: 14.0) SDK at /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk: {"iosmac": SupportedTarget { archs: ["x86_64", "x86_64h", "arm64", "arm64e"], default_deployment_target: "17.0", default_variant: None, deployment_target_setting_name: Some("IPHONEOS_DEPLOYMENT_TARGET"), minimum_deployment_target: "13.1", platform_family_name: None, valid_deployment_targets: ["13.1", "13.2", "13.3", "13.3.1", "13.4", "13.5", "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "15.0", "15.2", "15.3", "15.4", "15.5", "15.6", "16.0", "16.1", "16.2", "16.3", "16.4", "16.5", "16.6", "17.0"] }, "macosx": SupportedTarget { archs: ["x86_64", "x86_64h", "arm64", "arm64e"], default_deployment_target: "14.0", default_variant: None, deployment_target_setting_name: Some("MACOSX_DEPLOYMENT_TARGET"), minimum_deployment_target: "10.13", platform_family_name: Some("macOS"), valid_deployment_targets: ["10.13", "10.14", "10.15", "11.0", "11.1", "11.2", "11.3", "11.4", "11.5", "12.0", "12.2", "12.3", "12.4", "13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "14.0"] }}
MacOSX (version: 14.0) SDK at /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk: {"macosx": SupportedTarget { archs: ["x86_64", "x86_64h", "arm64", "arm64e"], default_deployment_target: "14.0", default_variant: None, deployment_target_setting_name: Some("MACOSX_DEPLOYMENT_TARGET"), minimum_deployment_target: "10.13", platform_family_name: Some("macOS"), valid_deployment_targets: ["10.13", "10.14", "10.15", "11.0", "11.1", "11.2", "11.3", "11.4", "11.5", "12.0", "12.2", "12.3", "12.4", "13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "14.0"] }, "iosmac": SupportedTarget { archs: ["x86_64", "x86_64h", "arm64", "arm64e"], default_deployment_target: "17.0", default_variant: None, deployment_target_setting_name: Some("IPHONEOS_DEPLOYMENT_TARGET"), minimum_deployment_target: "13.1", platform_family_name: None, valid_deployment_targets: ["13.1", "13.2", "13.3", "13.3.1", "13.4", "13.5", "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "15.0", "15.2", "15.3", "15.4", "15.5", "15.6", "16.0", "16.1", "16.2", "16.3", "16.4", "16.5", "16.6", "17.0"] }}
MacOSX (version: 14.0) SDK at /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk: {"iosmac": SupportedTarget { archs: ["x86_64", "x86_64h", "arm64", "arm64e"], default_deployment_target: "17.0", default_variant: None, deployment_target_setting_name: Some("IPHONEOS_DEPLOYMENT_TARGET"), minimum_deployment_target: "13.1", platform_family_name: None, valid_deployment_targets: ["13.1", "13.2", "13.3", "13.3.1", "13.4", "13.5", "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "15.0", "15.2", "15.3", "15.4", "15.5", "15.6", "16.0", "16.1", "16.2", "16.3", "16.4", "16.5", "16.6", "17.0"] }, "macosx": SupportedTarget { archs: ["x86_64", "x86_64h", "arm64", "arm64e"], default_deployment_target: "14.0", default_variant: None, deployment_target_setting_name: Some("MACOSX_DEPLOYMENT_TARGET"), minimum_deployment_target: "10.13", platform_family_name: Some("macOS"), valid_deployment_targets: ["10.13", "10.14", "10.15", "11.0", "11.1", "11.2", "11.3", "11.4", "11.5", "12.0", "12.2", "12.3", "12.4", "13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "14.0"] }}
MacOSX (version: 13.3) SDK at /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk: {"iosmac": SupportedTarget { archs: ["x86_64", "x86_64h", "arm64", "arm64e"], default_deployment_target: "16.4", default_variant: None, deployment_target_setting_name: Some("IPHONEOS_DEPLOYMENT_TARGET"), minimum_deployment_target: "13.1", platform_family_name: None, valid_deployment_targets: ["13.1", "13.2", "13.3", "13.3.1", "13.4", "13.5", "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "15.0", "15.2", "15.3", "15.4", "15.5", "15.6", "16.0", "16.1", "16.2", "16.3", "16.4"] }, "macosx": SupportedTarget { archs: ["x86_64", "x86_64h", "arm64", "arm64e"], default_deployment_target: "13.3", default_variant: None, deployment_target_setting_name: Some("MACOSX_DEPLOYMENT_TARGET"), minimum_deployment_target: "10.13", platform_family_name: Some("macOS"), valid_deployment_targets: ["10.13", "10.14", "10.15", "11.0", "11.1", "11.2", "11.3", "11.4", "11.5", "12.0", "12.2", "12.3", "12.4", "13.0", "13.1", "13.2", "13.3"] }}
MacOSX (version: 13.3) SDK at /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk: {"macosx": SupportedTarget { archs: ["x86_64", "x86_64h", "arm64", "arm64e"], default_deployment_target: "13.3", default_variant: None, deployment_target_setting_name: Some("MACOSX_DEPLOYMENT_TARGET"), minimum_deployment_target: "10.13", platform_family_name: Some("macOS"), valid_deployment_targets: ["10.13", "10.14", "10.15", "11.0", "11.1", "11.2", "11.3", "11.4", "11.5", "12.0", "12.2", "12.3", "12.4", "13.0", "13.1", "13.2", "13.3"] }, "iosmac": SupportedTarget { archs: ["x86_64", "x86_64h", "arm64", "arm64e"], default_deployment_target: "16.4", default_variant: None, deployment_target_setting_name: Some("IPHONEOS_DEPLOYMENT_TARGET"), minimum_deployment_target: "13.1", platform_family_name: None, valid_deployment_targets: ["13.1", "13.2", "13.3", "13.3.1", "13.4", "13.5", "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "15.0", "15.2", "15.3", "15.4", "15.5", "15.6", "16.0", "16.1", "16.2", "16.3", "16.4"] }}