Linuxbrew / brew

:beer::penguin: The Homebrew package manager for Linux
https://linuxbrew.sh
BSD 2-Clause "Simplified" License
2.66k stars 237 forks source link

How to distingish between distro packages and bottles #687

Closed ShalokShalom closed 6 years ago

ShalokShalom commented 6 years ago

To help us debug your issue please explain:

Features

Hi there :)

Simple question: How is it recommended, to distinguish between the Linuxbrew command to call a specific binary and that one of my distribtutions package manager?

When I build, I do that with cmake. Whyever, it calls the cmake version of Linuxbrew, which is installed as a dependency. How to solve that?

My specific issue, for the completeness:

➜ neovim-qt git:(master) cmake CMake Error: Could not find CMAKE_ROOT !!! CMake has most likely not been installed correctly. Modules directory not found in /home/linuxbrew/.linuxbrew/Cellar/cmake/3.11.0/share/cmake-3.11

ShalokShalom commented 6 years ago

I solved it by uninstalling cmake from Linuxbrew for now. So I ask this in general, for other cases. Thanks a lot :)

iMichka commented 6 years ago

It will depend on what is first in your path. During the installation there was some explanation:

Add Linuxbrew to your #{Tty.underline}#{shell_profile}#{Tty.reset} by running
    echo 'export PATH="#{HOMEBREW_PREFIX}/bin:$PATH"' >>#{shell_profile}
    echo 'export MANPATH="#{HOMEBREW_PREFIX}/share/man:$MANPATH"' >>#{shell_profile}
    echo 'export INFOPATH="#{HOMEBREW_PREFIX}/share/info:$INFOPATH"' >>#{shell_profile}

So have a look at your ~/.bash_profile or ~/.zprofile or ~/.profile file (or whatever profile file you used). You can comment out the path hijacking there.

Of course if you want to have one part of the tools from your distro, and another part from linuxbrew, then it gets more tricky and you will need to tweak this manually for each package.

ShalokShalom commented 6 years ago

Well, Linuxbrew installs all packages into another folder to avoid conflicts, you can do something similar for the names, optionally?

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

ShalokShalom commented 6 years ago

This makes Linuxbrew broken to me, since I build with Linuxbrew packages, anyway if I want or not. Linuxbrew should/could stay out of the way, instead, does it force its packages into my builds, without asking and by default. Totally unacceptable in my opinion.

iMichka commented 6 years ago

It is totally unclear to me what the exact problem is. Can you explain in simple words what is broken for you? For example, what did you mean by: you can do something similar for the names, optionally?? What names are you talking about?

Linuxbrew does not install anything outside of it's local folder, and does not put anything in your path without asking you before doing so. If something ended up in your path or messed up your setup (without asking you before doing so), this should be considered as a bug and we should try to fix it. But I need more details for this.

ShalokShalom commented 6 years ago

When I build something, assumes my build system (pacman/makepkg) that I want to use the Linuxbrew packages as dependencies.

This leads often to confusing results. Linuxbrew installs its own cmake, as an example and this messes up my whole configuration.

When I try to build something with pacman on this device, assumes it that the Linuxbrew packages are the default choice to do so.

Is this something to poke the pacman guys and girls about?

Cheers

sjackman commented 6 years ago

@ShalokShalom Your accusatory tone is rather impolite.

sjackman commented 6 years ago

I'm not familiar with Pacman. Everything that Linuxbrew installs is installed within its prefix directory, by default ~/.linuxbrew. If Linuxbrew executables are being run in preference to your system executables, it's because you've added Linuxbrew's bin directory to your PATH. Remove Linuxbrew's bin directory from your PATH if you'd prefer to use your host's executables.

sjackman commented 6 years ago

If Linuxbrew's pkg-config is found in your PATH ahead of your system's /usr/bin/pkg-config, that could cause other build system's to find and use Linuxbrew's packages in preference to your host system's packages.

ShalokShalom commented 6 years ago

I use the default settings without any change to the path

sjackman commented 6 years ago

Linuxbrew itself makes no changes to your PATH. It's installation instructions give you suggestions on modifying your shell profile (e.g. ~/.bashrc) to add Linuxbrew to your PATH, which you would need to do yourself.

ShalokShalom commented 6 years ago

Yes, I copied that into my zshrc and consider it as the default configuration

sjackman commented 6 years ago

If you'd prefer not to have Linuxbrew's executables in your PATH, simply remove it from your PATH.

ShalokShalom commented 6 years ago

This issue hits basically everyone who builds own packages with pacman and probably on other package management systems too, so I think this is important enough to consider changing this default template in order to increase compability.

sjackman commented 6 years ago

This default configuration works for most people. How you configure your system and PATH specifically is up to you. Perhaps you can configure pacman to use a different PATH.

iMichka commented 6 years ago

Let me try to explain this differently, using the cmake example. You can, as a user, download cmake, build it, install it, and put it in your path.

Linuxbrew just does the same as the manual steps above. And putting stuff in the path is optional, we do not force you to do it.

If this breaks pacman and you are annoyed by that, you should report this to the pacman developers. I do not think we want to change anything regarding that topic.

ShalokShalom commented 6 years ago

As said, the default configuration breaks with pacman and this is not the case with any other alternative package management system, is it Habitat or Flatpak or Nix or..

Just Linuxbrew breaks on all these instances and that you are completely fine with it, tells us something about the overall quality standards here.

Thanks a lot

sjackman commented 6 years ago

Removing Linuxbrew from your PATH will return your system to the as it was before you installed Linuxbrew. You can then run individual executables installed using Linuxbrew by specifying their full path, or symlinking them into a directory that is in your PATH, such as ~/bin.