FelixKratz / homebrew-formulae

1 stars 4 forks source link

Homebrew make fail #9

Open hainv01 opened 4 months ago

hainv01 commented 4 months ago

macOS 14.4 Able to build from source, fine with standard make command.

==> Fetching felixkratz/formulae/borders
==> Downloading https://github.com/FelixKratz/JankyBorders/archive/refs/tags/v1.6.0.tar.gz
Already downloaded: /Users/hainv/Library/Caches/Homebrew/downloads/04d6d9db94f80036217be42141a34c0ea689e22496b538e3b6b173cbcac9596e--JankyBorders-1.6.0.tar.gz
==> Installing borders from felixkratz/formulae
==> make
Last 15 lines from /Users/hainv/Library/Logs/Homebrew/borders/01.make:
In file included from src/animation.c:1:
In file included from src/animation.h:2:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:29:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:23:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVImageBuffer.h:29:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:39:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.h:26:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTFramesetter.h:82:5: error: unknown type name 'CFAttributedStringRef'; did you mean 'CFMutableStringRef'?
    CFAttributedStringRef attrString ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:500:70: note: 'CFMutableStringRef' declared here
typedef struct CF_BRIDGED_MUTABLE_TYPE(NSMutableString) __CFString * CFMutableStringRef;
                                                                     ^
4 errors generated.
make: *** [all] Error 1

If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core):
  https://github.com/felixkratz/homebrew-formulae/issues

I can build from source:

git clone git@github.com:FelixKratz/JankyBorders.git
cd JankyBorders
make
mkdir bin
clang -std=c99 -O3 -g src/main.c src/parse.c src/mach.c src/hashtable.c src/events.c src/windows.c src/border.c src/animation.c  -o bin/borders -framework AppKit -framework CoreVideo -F/System/Library/PrivateFrameworks/ -framework SkyLight
FelixKratz commented 4 months ago

In theory all brew should do is run exactly that makefile. It seems brew is not doing that and bricks the install along the way… I am not an expert on brew but maybe it is time to simply ship a signed compiled universal binary in the release to eliminate the compiling problems once and for all

anafvana commented 3 weeks ago

Thought I'd chip in and say I'm having the same issue.

HOWEVER, I successfully installed borders with brew a couple of days ago on another Mac with very similar specs (same OS version, same architecture, also running yabai/shkd, etc).

The two things differing between these two machines are:

  1. One is a MacBook Air (failing) and the other is a MacBook Pro (succeeded)
  2. The MacBook Air in question has a long history of compiling errors. It's not the first time some package fails exactly at the make step, and I suspect it has to do with the gcc compiler.

OP, have you ever had other similar situations with your device?

anafvana commented 3 weeks ago

Update: My problem was an outdated version of clang

Check your version with

$ clang -v

The latest available (as of 22.06.2024) is:

Homebrew clang version 18.1.7
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin


Steps to solve the issue:

  1. Get the latest llvm via brew

    $ brew install llvm
  2. Ensure the path to brew's llvm is first in $PATH

    $ echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc
  3. Set LDFLAGS and CPPFLAGS
    (I set them in my .zshrc)

    export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
    export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"
  4. [IF NECESSARY] Unset old LDFLAGS and CPPFLAGS.
    This was necessary for me, because turns out my clang was extremely outdated due to having set llvm@12 as the default a long time ago.
    I had replaced the old LDFLAGS and CPPFLAGS in my .zshrc with the new ones above

  5. Reload your bash/zsh config

    $ source .zshrc
  6. Try to install once again