Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gentoo Prefix on Debian
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
ZekeMorrin
n00b
n00b


Joined: 15 Oct 2023
Posts: 10

PostPosted: Fri Apr 12, 2024 11:53 am    Post subject: Gentoo Prefix on Debian Reply with quote

Hello dear Gentoo community I have a question regarding using Gentoo prefix on other Linux environments;

I'm currently using Gentoo prefix on Debian Testing, I just want to know that if adding $PREFIX/usr/bin to my PATH is a very bad idea and horribly break stuff?
Because I really prefer using the programs installed through portage in my Debian environment without entering my $PREFIX/usr/bin folder manually unless it's breaking stuff.
Also, is it possible to add not the entire #PREFIX/usr/bin but single programs like lets say $PREFIX/usr/bin/npm and $PREFIX/usr/bin/node and such?
Second option would be more convenient if it's possible, and if so how can I do it?
Thanks!
Back to top
View user's profile Send private message
LiamOS
n00b
n00b


Joined: 06 Jun 2012
Posts: 64
Location: Ireland

PostPosted: Mon Apr 15, 2024 9:41 am    Post subject: Reply with quote

Doing this will probably work some of the time in some cases, but in general I think it's likely to either not work properly or make the terminal unusable.
Your host system probably has a different glibc among other things, so running gentoo binaries against that will likely fail. If you edit the LD_LIBRARY_PATH to include the correct libraries then your host executables will be unhappy.
_________________
CFLAGS=" -O999999"
Back to top
View user's profile Send private message
ZekeMorrin
n00b
n00b


Joined: 15 Oct 2023
Posts: 10

PostPosted: Mon Apr 15, 2024 12:20 pm    Post subject: Reply with quote

Thanks for the heads up LiamOS, so using the portage-installed programs inside prefix is the safest way, good to know!
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21651

PostPosted: Mon Apr 15, 2024 2:51 pm    Post subject: Reply with quote

The programs ought to work the same whether you cd into $PREFIX/usr/bin and use ./program versus if you invoke them by full path. Either way, the important thing is that they use the Gentoo libraries, not the Debian ones. That should be independent of how you invoke them, and of your $PATH.

If you want to use only select programs, you have two options. First, you could set up a directory such as ~/gentoo/bin, put that on your $PATH, and populate it with symlinks to the programs in $PREFIX/usr/bin. Second, you could define shell functions named npm(), node(), etc. that are implemented as:
Code:
npm() {
   "$GENTOO_PREFIX/usr/bin/$FUNCNAME" "$@"
}
The latter approach has the effect that a program which runs a bare npm will not find this function (because functions cannot be found via $PATH lookup), and will instead delegate to Debian. That may or may not be desirable, depending on whether you want your scripts to find Gentoo programs when available (use choice 1) or not (use choice 2). You could even mix and match, defining some Gentoo programs via the special $PATH symlinks and others as shell functions. This might be useful if some of the Gentoo programs have notably different behaviors from their corresponding Debian versions, and so you need scripts that you share with other Debian users to continue using the Debian versions of such tools.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum