# What port does rust install?



## bagas (Nov 4, 2022)

Hello.
How to know which port of rust is being installed?


> # pkg version -v | grep "rust"
> rust-1.63.0                        <   needs updating (index has 1.64.0)


----------



## SirDice (Nov 4, 2022)

Look at `pkg info -o rust`. The 'origin' is the port name.


----------



## bagas (Nov 4, 2022)

SirDice said:


> pkg info -o rust


# pkg info -o rust
rust-1.63.0                    lang/rust

no information.
I'm interested in which port rust installed by dependency.


----------



## SirDice (Nov 4, 2022)

So, now you know the package rust was built from the port lang/rust.


----------



## bagas (Nov 4, 2022)

SirDice said:


> So, now you know the package rust was built from the port lang/rust.


This is clear, I'm interested in which port rust installed by dependency.


----------



## SirDice (Nov 4, 2022)

pkg-info(8):

```
-r, --required-by
             Display the list of packages which require pkg-name.
```


```
-d, --dependencies
             Display the list of packages on which pkg-name depends.
```


----------



## bagas (Nov 4, 2022)

> pkg info -d lang/rust
> rust-1.63.0:
> curl-7.85.0


I did not find in the curl port how to disable rust support.
I need to get rid of rust in the system.


----------



## SirDice (Nov 4, 2022)

bagas said:


> I did not find in the curl port how to disable rust support.


Wrong way around. It's rust that depends on curl. You're looking for ports/packages that have a dependency on rust, so look at `pkg info -r rust`.


----------



## bagas (Nov 4, 2022)

SirDice said:


> Wrong way around. It's rust that depends on curl. You're looking for ports/packages that have a dependency on rust, so look at `pkg info -r rust`.





> # pkg info -r rust
> rust-1.63.0:



Looked, no information.


----------



## SirDice (Nov 4, 2022)

Then nothing is depending on it. Unless you actively installed it yourself (non-automatic) it will probably get removed with pkg-autoremove(8).


----------



## bagas (Nov 4, 2022)

SirDice said:


> Then nothing is depending on it. Unless you actively installed it yourself (non-automatic) it will probably get removed with pkg-autoremove(8).


No, it was installed by dependencies.
I'll try pkg-autoremove.


----------



## cy@ (Nov 4, 2022)

bagas said:


> Hello.
> How to know which port of rust is being installed?


List the rust packages installed:


```
slippy$ pkg info -I rust\*
rust-1.64.0                    Language with a focus on memory safety and concurrency
rust-cbindgen-0.24.3           Generate C bindings from Rust code
slippy$
```

Tell us their origins:


```
slippy$ pkg info -o rust\*
rust-1.64.0                    lang/rust
rust-cbindgen-0.24.3           devel/rust-cbindgen
slippy$
```

Tell us which package installed the rustc command:


```
slippy$ pkg which `which rustc`  
/usr/local/bin/rustc was installed by package rust-1.64.0
slippy$
```


----------



## SirDice (Nov 4, 2022)

bagas said:


> No, it was installed by dependencies.


It may have been a _build_ dependency. Packages don't record _build_ dependencies because those are only relevant when building a port.


----------



## bagas (Nov 4, 2022)

SirDice said:


> pkg-autoremove(8).


So it deletes almost all software installed on the server.
pkg-autoremove
Deinstallation has been requested for the following 113 packages


----------



## VladiBG (Nov 4, 2022)

Did you mix ports with pkg?
You can first check what programs (pkg / ports) you need to have by view the prime origins (`pkg prime-origins`) then if none of them is removed by `pkg autoremove` then you are safe to remove all old orphaned dependencies.

Note:
Those 113 packages (ports) are left overs from some program that was installed then removed. It's best practice to issue pkg autoremove after every pkg/port removal so it can remove (cleanup) the old depenancies of already removed program.

For example if you install mod_php80 it will install php80 as dependency but when you delete mod_php80 it will not remove the php80 so to clean it you use `pkg autoremove`.

Note2:
If you are using ports during the build process the ports install build dependencies and if those build dependencies are not changed during the next upgrade of the port you may want to keep them instead of cleanup with `pkg autoremove` as this will speed up the next build port. But this is true if only upgrade your ports on very short interval like once per week and no new version of the build dependencies is released.


----------



## bagas (Nov 4, 2022)

VladiBG said:


> Did you mix ports with pkg?
> You can first check what programs (pkg / ports) you need to have by view the prime origins (`pkg prime-origins`) then if none of them is removed by `pkg autoremove` then you are safe to remove all old orphaned dependencies.


I installed all ports from /usr/ports/.
Updated with portupgrade


----------



## VladiBG (Nov 4, 2022)

Just compare the prime-origins with the ports that `pkg autoremove` wants to cleanup. If none of prime origins is removed and you don't recognize any port that you need from the autoremove list then it's safe to clean it.

Note:
Instead of spending time and build those ports on the server itself i would suggest to take a look at synth(1) it's very easy to create your own repository on another server and use to binary update your server(s) and it's more safer as this will eliminate the risk of temporary fail to build ports due to some recent vulnerability or broken port.


----------



## bagas (Nov 4, 2022)

Removed the software with pkg autoremove -y.
deletes (cargo-c|rust|.....)
I run libgd port updates.


> --->  Building '/usr/ports/graphics/gd'
> ===>  Cleaning for libimagequant-4.0.4
> ===>  Cleaning for cargo-c-0.9.8_6
> ===>  Cleaning for rust-1.64.0


I see that software (cargo-c|rust|cmake-core|.....) is being built on a new basis.
Why it was then to remove this software I do not understand.


----------



## VladiBG (Nov 4, 2022)

those are build dependencies not directly for libgd but for some of the other ports that libgd requires. If you want to dig down it's easy to fetch the ports index and make all-depends-list
check ports(7) for more info


----------



## laurentis (Nov 4, 2022)

bagas said:


> Removed the software with pkg autoremove -y.
> deletes (cargo-c|rust|.....)
> I run libgd port updates.
> 
> ...


graphics/libimagequant has been rewritten in rust. If you check the Makefile of graphics/gd, you'll find that you can remove this dependency by turning off the option LIQ.


----------



## bagas (Nov 4, 2022)

Same version (PHP 7.4.32) on both servers.
Both servers have php module gd.


> php -m | grep gd
> gd



Installation on both servers came from /usr/ports/.


> pkg version -v | grep "libimagequant"
> libimagequant-4.0.4                =   up-to-date with index





> pkg prime-origins | egrep 'php|gd'
> graphics/gd
> lang/php74
> lang/php74-extensions





> # pkg version -v | grep "gd"
> libgd-2.3.3_2,1                    =   up-to-date with index
> php74-gd-7.4.32                    =   up-to-date with index



on another server


> # pkg version -v | grep "libimagequant"
> libimagequant-2.17.0               =   up-to-date with index





> pkg prime-origins | egrep 'php|gd'
> lang/php74
> lang/php74-extensions





> pkg version -v | grep "gd"
> libgd-2.3.3_2,1                    =   up-to-date with index
> php74-gd-7.4.32                    =   up-to-date with index



Why then in one case version 4.0.4 was installed in another ver.2.17.0?


----------



## Jose (Nov 4, 2022)

bagas said:


> Why then in one case version 4.0.4 was installed in another ver.2.17.0?


You updated the ports tree more recently on one server?


----------



## bagas (Nov 4, 2022)

Jose said:


> You updated the ports tree more recently on one server?


Before each software update, I update the ports on the servers and rebuild the indexes for the ports.


----------



## Jose (Nov 4, 2022)

bagas said:


> Before each software update, I update the ports on the servers and rebuild the indexes for the ports.


How? Git? If so, is one server on the quarterly branch?


----------



## richardtoohey2 (Nov 4, 2022)

laurentis said:


> graphics/libimagequant has been rewritten in rust. If you check the Makefile of graphics/gd, you'll find that you can remove this dependency by turning off the option LIQ.


As soon as I saw this recent update wanting to build and install cargo I knew rust wasn't far behind so I stopped the update and changed the config options for gd.

But it seems more and more is being re-built with rust so at some point I'll have a critical dependancy on rust and be forced to do things differently.


----------



## Jose (Nov 4, 2022)

richardtoohey2 said:


> As soon as I saw this recent update wanting to build and install cargo I knew rust wasn't far behind so I stopped the update and changed the config options for gd.
> 
> But it seems more and more is being re-built with rust so at some point I'll have a critical dependancy on rust and be forced to do things differently.


We need a libimagequant2 port. Not it!


----------



## bagas (Nov 4, 2022)

Jose said:


> How? Git? If so, is one server on the quarterly branch?


Yes git.
Didn't understand, what kind of quarterly branch.?


----------



## rafael_grether (Nov 4, 2022)

bagas

$ poudriere bulk -j jpoudriere -p HEAD -v -n -Ct graphics/gd

graphics/gd depends on graphics/libimagequant
graphics/libimagequant depends on devel/cargo-c
graphics/libimagequant depends on lang/rust

In fact, new graphics/libimagequant depends on RUST/Cargo-C now:








						graphics/libimagequant: update to 4.0.4 · freebsd/freebsd-ports@6a5b212
					

- Adjust license for "or later" clause - Point to homepage suggested upstream - Drop superfluous newlines - Take maintainership  Changes:	https://github.com/ImageOptim/libimagequant/compa...




					github.com
				




If you dont need libimagequant, "make config" in graphics/gd, then remove LIQ option.


----------



## Jose (Nov 4, 2022)

bagas said:


> Yes git.
> Didn't understand, what kind of quarterly branch.?











						Solved - Quarterly and Latest Ports Branches
					

I have read the below and wanted to get more insight. 4.4.2. Quarterly and Latest Ports Branches The Quarterly branch provides users with a more predictable and stable experience for port and package installation and upgrades. This is done essentially by only allowing non-feature updates...




					forums.freebsd.org


----------



## bagas (Nov 4, 2022)

Ports from git update about once a month.


----------



## bagas (Nov 4, 2022)

How do I give up rust?


----------



## zirias@ (Nov 4, 2022)

Well, avoid ports that unconditionally require it and disable port options that require it, simple as that 

But I guess in the long run, this will lead nowhere. Right now, I got the impression that rust is quickly adopted as an alternative to C and/or C++.


----------



## bagas (Nov 4, 2022)

> --- describe.x11-servers ---
> --- describe.x11-themes ---
> --- describe.x11-toolkits ---
> --- describe.x11-wm ---
> ...


Here is the infection! )))
I see that now every server will have this rust, I want to scold!


----------



## bagas (Nov 4, 2022)

zirias@ said:


> But I guess in the long run, this will lead nowhere. Right now, I got the impression that rust is quickly adopted as an alternative to C and/or C++.


As they say, the awl for soap change!


----------



## Erichans (Nov 4, 2022)

bagas said:


> [...] Installation on both servers came from /usr/ports/.
> 
> 
> > pkg version -v | grep "libimagequant"
> ...





bagas said:


> Ports from git update about once a month.



graphics/libimagequant was updated very recently*; look at graphics/libimagequant and its Commit History:


> 4.0.4
> 02 Nov 2022 13:58:14


I presume you were using something like**
`git clone https://git.FreeBSD.org/ports.git /usr/ports` 
and additional git commands for updating from the head branch of the remote repository (4.5.1. Installing the Ports Collection)

The latest branch at the remote repository can be updated at any time (that can be daily); the latest branch is on a rolling release. You have separate servers and get the sources from the remote repository via git commands on each server separately. That means you must be very careful that these servers have the same ports sources you use to build from. Check and compare the sources of graphics/libimagequant of both servers you mentioned.

If you want to completely eliminate the existence of individual sources on different servers, please consider 4.6. Building Packages with Poudriere. You can then build your own individually shaped packages at one local place and update your servers with packages from that local place.
___
* packages for the new version have not even been built; they are still on libimagequant-2.17.0.
** and not something like `git clone https://git.FreeBSD.org/ports.git -b 2020Q3 /usr/ports` for the quarterly branch


----------



## bagas (Nov 5, 2022)

If rust is installed as a binary package, pkg install rust and all other software is built from /usr/ports.
Then if i upgrade all the software on the server portupgrade -arR, then will rust from /usr/ports not be updated in this case?


----------



## VladiBG (Nov 5, 2022)

It will be upgraded when a newer version from ports exists.


----------



## bagas (Nov 5, 2022)

VladiBG said:


> It will be upgraded when a newer version from ports exists.


The bad thing I don't like about rust is that it is very resource intensive to update it.
rust updates occur regularly, once a month or 2 times a month.


----------



## zirias@ (Nov 5, 2022)

bagas said:


> The bad thing I don't like about rust is that it is very resource intensive to update it.


It's not much different from e.g. llvm. Such packages (compiler, language runtime, ...) just tend to be pretty large. Of course, we already have llvm in base, so as long as all you need is the version that's in base, you won't notice that unless you build base yourself.



bagas said:


> rust updates occur regularly, once a month or 2 times a month.


Which also isn't uncommon for actively developed software. The generic solution with FreeBSD ports is to use quarterly if you want to minimize updates while still receiving security- and other fixes.


----------



## Tieks (Nov 5, 2022)

bagas said:


> The bad thing I don't like about rust is that it is very resource intensive to update it.


The same goes for llvm. Since these are building tools not needed during runtime, `pkg autoremove` will remove these ports, causing unnecessary rebuilds. You can keep that from happening with `% pkg set -A 0 lang/rust`.


----------



## bagas (Nov 5, 2022)

Exactly, there is already one resource-intensive lvm engine for assembly, so now another one has appeared.


----------



## bagas (Nov 5, 2022)

I have a Linux Gentoo system on one of the servers, the Gentoo system has a similar port system.
In gentoo has a rust-bin port so as not to torment the server with the installation.
Is it possible to create like a port rust-bin port on FreeBSD to install from /usr/ports/ ?
Thinking out loud, I just don't see the point of compiling rust on the server to install a simple, single port.

example





						dev-lang/rust-bin – Gentoo Packages
					

Gentoo Packages Database




					packages.gentoo.org
				




It is very convenient to have such a port (rust-in), do not need to wait a lot of time until the rust port is assembled on a weak server hardware.


----------



## bagas (Nov 6, 2022)

I have all servers amd64, some of them have an intel processor, the other part is amd.
On one of the servers with an Intel xeon processor, build rust from /usr/ports, then create a binary package rust (pkg create -o /usr/ports/packages/ rust-1.64.0) and place it on all servers for installation (with an Intel processor) pkg add /usr/ports/packages/rust-1.64.0.pkg.
Repeat the same procedure on servers with an amd processor.
What do you think about this?


----------

