Open brillard1 opened 1 year 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
.
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
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.
The post on Stack Overflow explains how to make MacOS look for libraries relative to the executable location at run-time. Essentially, It used the
install_name_tool -change command
to replace the absolute path to the library with a relative one. There's an automated script implemented that replaces all@executable_path/../Frameworks/
with@executable_path/
, so that all frameworks can be in the same folder as the executable stackoverflowMetacall Homebrew
is a package manager for the Metacall project on macOS. It allows users to easily install and manage the Metacall runtime by automating the build and installation process. By using Metacall Homebrew, we can quickly and easily set up a development environment for the Metacall runtime on macOS.By utilizing
brew-pkg
, we can create a distributable package for our command-line application that includes all the dependencies and libraries required to run it on a different machine. This will help to simplify the deployment process and make it easier for users to install and run the application.From the above explanation,
Metacall Homebrew
andbrew-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:
Metacall Homebrew
formula using Homebrew package manager andbuild.sh
from Metcall Homebrew repository@executable_path/../Frameworks/
with@executable_path/
.Metacall library
and any other dependencies to the same folder as the executable.brew-pkg
command.Resources
For utilzing above scripts,