Closed dannypsnl closed 11 months ago
Thanks for reporting this issue.
I guess this is a silicon Mac. I don't have a silicon Mac, so please do me a favor.
Are there two directories named include
and lib
under the /opt/homebrew directory? And in these two directories, are there symbolic links linking to the cellared library bundle which is under the /opt/homebrew/Cellar directory?
If that's the case, we can write a conditional clause in the opam file to fix this issue.
(if you can list the contents of include
and library
directories of fswatch under the /opt/homebrew/include/
and /opt/homebrew/lib
directories in a tree-like format, that will be really helpful. brew install tree
this tool will do the job)
Yes, there has /opt/homebrew/include/libfswatch/
and /opt/homebrew/lib/libfswatch.dylib
.
The two directories you want to too huge to print out, I think the fact that there has soft links is enough than.
Then this is the silicon branch which adds silicon homebrew support.
But it is NOT a proven version, so it will on its own branch for a while. You may check it out and use opam pin
to manually install and test it.
I guess you didn't push your code, the HEAD of silicon still master's HEAD.
Ah, silly me.
Your patch can work with LIBRARY_PATH=/opt/homebrew/lib opam pin add .
, do you know any way to setup library? Users still need to configure some to install it.
You mean, homebrew hasn't setup environment for opam even if you install opam with brew install opam
?
No, it won't.
Well, there are three options
shellenv.sh
to setup basic environment variable for shells. They may add an additional script, called shellenv_dev.sh
to setup development environment. This script is not globally or permanently pre-loaded so it won't conflict with system libraries.IMHO, 1 or 2 is preferred. Suggestions are welcome.
$ brew shellenv
export HOMEBREW_PREFIX="/opt/homebrew";
export HOMEBREW_CELLAR="/opt/homebrew/Cellar";
export HOMEBREW_REPOSITORY="/opt/homebrew";
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}";
export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:";
export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}";
A new commit in the silicon branch now uses conditional compilation to generate cflags and lib-flags in pre-compile time. The opam file now uses a separate set of build commands specifically for "arch=arm64 & distribution=homebrew" so Silicon mac is distinguished from Intel mac. Hope it works.
I tried, but I made a little change, pkg-config didn't work as expected
From 23621eea941837e318896bbeaa8790e3c625f2e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?L=C3=AEm=20Ts=C3=BA-thu=C3=A0n?= <dannypsnl@gmail.com>
Date: Tue, 26 Sep 2023 19:33:37 +0800
Subject: [PATCH 1/1] fix in m1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@gmail.com>
---
fswatch.opam | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/fswatch.opam b/fswatch.opam
index 7f3b1e1..831371b 100644
--- a/fswatch.opam
+++ b/fswatch.opam
@@ -9,13 +9,8 @@ build: [
["sh" "-exec" "echo \\(-I/usr/local/include/libfswatch/c -I/usr/include/libfswatch/c\\) > fswatch/src/inc_cflags"] { !(os-distribution = "homebrew" & arch = "arm64") }
["sh" "-exec" "echo -lfswatch > fswatch/src/inc_libs"] { !(os-distribution = "homebrew" & arch = "arm64") }
- ["sh" "-exec" "echo \\( > fswatch/src/inc_cflags"] { os-distribution = "homebrew" & arch = "arm64" }
- ["sh" "-exec" "echo \\( > fswatch/src/inc_libs"] { os-distribution = "homebrew" & arch = "arm64" }
-
- ["pkg-config" "--cflags" ">>" "fswatch/src/inc_cflags"] { os-distribution = "homebrew" & arch = "arm64" }
- ["pkg-config" "--libs" ">>" "fswatch/src/inc_libs"] { os-distribution = "homebrew" & arch = "arm64" }
- ["sh" "-exec" "echo \\) >> fswatch/src/inc_cflags"] { os-distribution = "homebrew" & arch = "arm64" }
- ["sh" "-exec" "echo \\) >> fswatch/src/inc_libs"] { os-distribution = "homebrew" & arch = "arm64" }
+ ["sh" "-exec" "echo \\(-I/opt/homebrew/include/libfswatch/c\\) > fswatch/src/inc_cflags"] { os-distribution = "homebrew" & arch = "arm64" }
+ ["sh" "-exec" "echo \\(-L/opt/homebrew/lib -lfswatch\\) > fswatch/src/inc_libs"] { os-distribution = "homebrew" & arch = "arm64" }
["dune" "build" "-p" name "-j" jobs]
]
--
2.42.0
The patch here will work on Silicon environment.
Ah, Thanks. Issue resolved :)
Update in the main branch. This issue is closed since it's resolved.
Homebrew installed fswatch located at
/opt/homebrew/Cellar/fswatch/1.17.1/include/libfswatch/c