Giter Site home page Giter Site logo

Not able to find libgmp on macOS about alire HOT 15 OPEN

jketema avatar jketema commented on August 16, 2024
Not able to find libgmp on macOS

from alire.

Comments (15)

mosteo avatar mosteo commented on August 16, 2024 1

We may need macOS expertise here, @simonjwright is this normal? Do Homebrew libraries require extra steps to locate headers?

from alire.

mosteo avatar mosteo commented on August 16, 2024

This is only available in the development version of alr. Which one have you tried?

from alire.

jketema avatar jketema commented on August 16, 2024
% alr --version
alr 1.2.2

which was the latest version I could download the day before yesterday.

from alire.

mosteo avatar mosteo commented on August 16, 2024

Yes, that's the latest stable. Afraid no external support for macOS in that yet.

from alire.

jketema avatar jketema commented on August 16, 2024

Even with the nightly from https://github.com/alire-project/alire/releases the problem persists though, so I'm still looking for some kind of workaround.

from alire.

jketema avatar jketema commented on August 16, 2024

With the nightly, when exporting the HOMEBREW_PREFIX environment variable, it is able to resolve the libgmp dependency, but still the build keeps failing with the missing header file.

from alire.

simonjwright avatar simonjwright commented on August 16, 2024

My setting (in ~/.bash_profile_common) is

export C_INCLUDE_PATH=$HOMEBREW_PREFIX/include
export LIBRARY_PATH=$HOMEBREW_PREFIX/lib

It feels like a rather non-specific solution, and there may be better, perhaps using brew’s pkg-config:

$ pkg-config --cflags gmp
-I/opt/homebrew/Cellar/gmp/6.2.1_1/include
$ pkg-config --libs gmp
-L/opt/homebrew/Cellar/gmp/6.2.1_1/lib -lgmp

though as you can see those pick up the currently-installed version and would have to be calculated on the fly in case of updates.

Would other distributions benefit from supporting pkg-config? (the paths are easy to handle, I think, but there’s perhaps more variation in distribution-specific switches?)

from alire.

jketema avatar jketema commented on August 16, 2024

My setting (in ~/.bash_profile_common) is

export C_INCLUDE_PATH=$HOMEBREW_PREFIX/include
export LIBRARY_PATH=$HOMEBREW_PREFIX/lib

This works for me thanks. It might be good to at least document this somewhere?

from alire.

mosteo avatar mosteo commented on August 16, 2024

Thanks, @simonjwright. I wasn't aware that Homebrew required additional environment. This is something that possibly Alire could add to its environment if HOMEBREW_PREFIX is set.

At some point we want to have support for pkg-config and the like, but if a single addition to a couple of env. vars. that can be computed at runtime is all it takes, it seems better than polluting all externals with a similar pkg-config invocation.

And for example we're doing something similar already with msys2 on Windows, IIRC.

from alire.

jketema avatar jketema commented on August 16, 2024

I do believe that HOMEBREW_PREFIX is no-standard. However, Homebrew generally occurs in one of two locations either /usr/local or /opt/homebrew

from alire.

simonjwright avatar simonjwright commented on August 16, 2024

Thanks, @simonjwright. I wasn't aware that Homebrew required additional environment. This is something that possibly Alire could add to its environment if HOMEBREW_PREFIX is set.

Homebrew doesn’t require this additional environment; the trouble is that non-Apple package managers install software in non-standard locations (they pretty-much have to with System Integrity Protection, which makes the standard locations non-writable, even by root, without rebooting to disable SIP; Not Recommended).

These two env vars work (on macOS? universally?) regardless of distribution.

I’m not sure we should necessarily rely on HOMEBREW_PREFIX; I use it to decide on the distribution (or the existence of /opt/local/bin/ports for MacPorts), but having decided on the distribution we could export distribution-specific additional env vars (none for most distros!)

from alire.

simonjwright avatar simonjwright commented on August 16, 2024

I do believe that HOMEBREW_PREFIX is no-standard. However, Homebrew generally occurs in one of two locations either /usr/local or /opt/homebrew

When I started using Homebrew, I found the command shellenv (I don’t remember where, it doesn’t seem to be front-and-centre at brew.sh):

$ brew help shellenv
Usage: brew shellenv [bash|csh|fish|pwsh|sh|tcsh|zsh]

Print export statements. When run in a shell, this installation of Homebrew will be added to your PATH, MANPATH, and INFOPATH.

The variables HOMEBREW_PREFIX, HOMEBREW_CELLAR and HOMEBREW_REPOSITORY are also exported to avoid querying them multiple times. To help guarantee idempotence, this command produces no output when Homebrew's bin and sbin directories are first and second respectively in your PATH.
Consider adding evaluation of this command's output to your dotfiles (e.g. ~/.profile, ~/.bash_profile, or ~/.zprofile) with: eval "$(brew shellenv)"

The shell can be specified explicitly with a supported shell name parameter. Unknown shells will output POSIX exports.

My ~/.bash_profile_common contains

eval $(/opt/homebrew/bin/brew shellenv)

(I had to be specific about that path, of course).


Do you think it would be better, in case users haven’t found this trick, to locate brew on PATH (it must be there if they’re to use it!?)

from alire.

jketema avatar jketema commented on August 16, 2024

When I started using Homebrew, I found the command shellenv (I don’t remember where, it doesn’t seem to be front-and-centre at brew.sh):

I wasn't aware of this, thanks for pointing this out. It even appears in the brew man-page, so it should be safe to depend on this.

from alire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.