metacall / distributable-macos

MacOs redistributable for shipping MetaCall Core.
Apache License 2.0
1 stars 6 forks source link

MacOS Distributable using Homebrew has workarounds due to metacall nature #13

Open brillard1 opened 1 year ago

brillard1 commented 1 year ago

While testing the MacOS distributable, @viferga found a way to make a portable version from Homebrew. However, there are still some workarounds due to the nature of Metacall.

From the above explanation, Metacall Homebrew and brew-pkg can be used together to create a distributable package for a macOS command-line application that uses Metacall.

Building the MacOS Distributable


The following steps describes the general workflow:

  1. Install the Metacall Homebrew formula using Homebrew package manager and build.sh from Metcall Homebrew repository
  2. Install any other dependencies required for the distributable.
  3. Build the application and its dependencies.
  4. Use the automated script provided in the previous answer to replace all @executable_path/../Frameworks/ with @executable_path/.
  5. Copy the Metacall library and any other dependencies to the same folder as the executable.
  6. Build the distributable package using the brew-pkg command.

Resources


For utilzing above scripts,

FirePing32 commented 10 months ago

Build the application and its dependencies.

@brillard1 I tried building the application using build.sh, but cmake could not find a header file named backward.hpp. Pasting last few lines of the trace below -

[ 97%] Linking CXX shared module ../../../libplugin_extension.so
[ 97%] Built target plugin_extension
[ 97%] Built target backtrace_plugin_config
[ 97%] Building CXX object source/plugins/backtrace_plugin/CMakeFiles/backtrace_plugin.dir/source/backtrace_plugin.cpp.o
/Users/prakhargurunani/dev/metacall-distributable-macos/metacall/core/source/plugins/backtrace_plugin/source/backtrace_plugin.cpp:23:10: fatal error: 'backward.hpp' file not found
#include <backward.hpp>
         ^~~~~~~~~~~~~~
1 error generated.
make[2]: *** [source/plugins/backtrace_plugin/CMakeFiles/backtrace_plugin.dir/source/backtrace_plugin.cpp.o] Error 1
make[1]: *** [source/plugins/backtrace_plugin/CMakeFiles/backtrace_plugin.dir/all] Error 2
make: *** [all] Error 2
+ error 'Cmake build target install failed.'
+ echo 'Error: Cmake build target install failed., build stopping, probably dependencies could not be downloaded.'
Error: Cmake build target install failed., build stopping, probably dependencies could not be downloaded.
+ exit 1

Although I have the file in /usr/local/include.

viferga commented 2 days ago

This has been partially solved towards a more general solution, I am leaving this here for reference: https://github.com/metacall/brew-pkg/issues/4