Rust building failed

Why don't you install rust from packages? I tend to get those big ugly things like llvm and rust from packages (I don't really care about options they have) and then build whatever I need with changed options myself.
 
Yeah, -j 1 is the next thing to try. Do you use ZFS there?
Nope, I don't use it on this machine (only 8 Go RAM). I'll try with one job, and if it fails again, I'll buy an older workstation (with a i5 CPU / 16 GO RAM) and set a poudriere on it, at my home. It will be less expensive than using ec2 instances and ressources.

We should treat building Rust as a sport.
?
 
And I tried ports-mgmt/poudriere-devel. With

Code:
PACKAGE_FETCH_BRANCH=latest
PACKAGE_FETCH_WHITELIST="rust"
PACKAGE_FETCH_URL=pkg+http://pkg.FreeBSD.org/\${ABI}

A pkg info | grep rust returns:
Code:
rust-1.71.0                    Language with a focus on memory safety and concurrency

However, when I do poudriere bulk -j 132Ramd64 security/py-certbot, it still trying to build devel/rust...
 
That's what I meant earlier, to be sure a binary package will be used (even with matching options etc), you should have a look at the builders to know the commit hash from which the repository was built and check out exactly this hash in your local ports tree used for poudriere.

Otherwise, your ports tree will always be newer (by a few days typically) than the one from which packages were built ... and as soon as the version of the package itself or any package it depends on doesn't match, it can't be used ... yes, that's a bit unfortunate, but I honestly don't see a way to solve this :(

Maybe someone could at least come up with a good solution for fetching exactly the ports tree from which the latest repo was built. Right now, it's a manual task....
 
I understand, thanks for your answer.
So, ports-mgmt/poudriere-devel does not help me.

I tried
Code:
DEFAULT_VERSIONS+=pycryptography=legacy
and it's ok for security/py-certbot. However, it's useless when I need to build sysutils/ec2-scripts, which has a runtime dependency with net/aws-ec2-imdsv2-get, which has a build dependency with... lang/rust, without using the configured DEFAULT_VERSIONS.

So, I need to:
- try to build lang/rust with one job (but it's really too heavy... and if I need to build it each time I have to upgrade a port...)
- try a stronger and faster machine

No other solution.
 
I'll buy an older workstation (with a i5 CPU / 16 GO RAM) and set a poudriere on it, at my home.

Not sure it will work: on my build server 16 GB RAM are not enough. But I use ZFS, maybe with UFS will work for you.

Building with one job didn't work, I'll try without TMPFS as suggested above and see. It should work but with even longer build time.

Using packaged version is not an option for me. I use Poudriere both to customize options and to have security fixes as soon as possible so checking out a days old ports tree to match the latest pkg repository is something I wish to avoid.
 
Not sure it will work: on my build server 16 GB RAM are not enough.
My old i5 (3470; 2 cores/4 threads; 16 GB) runs ZFS and poudriere. It's my "build" server. Yeah, it's not the fastest in the world, but it works just fine.

What it cannot do however is building LLVM and/or GCC and/or Rust at the same time. Which happened occasionally. So I now use multiple build runs. One to build rust (and rust alone), one to build GCC (and gcc alone), then I run the rest of my builds.

Code:
for j in ${SERVER_REPOS}; do
  ${POUDRIERE} bulk -j ${j} -p server -f ${BASEDIR}/rust.lst
  ${POUDRIERE} bulk -j ${j} -p server -f ${BASEDIR}/gcc.lst
  ${POUDRIERE} bulk -j ${j} -p server -f ${BASEDIR}/llvm.lst
  ${POUDRIERE} bulk -j ${j} -p server -f ${BASEDIR}/${j}-server-package.lst
done
 
My old i5 (3470; 2 cores/4 threads; 16 GB) runs ZFS and poudriere. It's my "build" server. Yeah, it's not the fastest in the world, but it works just fine.

I don't understand.. my Xeon E-2236 build server is slightly older but with 6 cores. Do you use TMPFS?
 
Thank you! I'll need to look better at this build failure.
 
My current box (12c12t) roughly peaks at 12G memory usage building Rust via ports, just the build itself, not subsystem etc. My old box with 12G of RAM in total and ZFS used from what I recall about 6Gbyte of swap at some stages building Rust with 2 cores and Poudriere with basicaly nothing running except the build.
 
I understand, thanks for your answer.
So, ports-mgmt/poudriere-devel does not help me.
Sure it can help (and I still think it's the most convenient solution if you don't fiddle with anything that would affect the rust package). It just requires these extra steps making sure your ports tree is on the exact commit from which the package repo was built to work reliably....
 
Sure it can help (and I still think it's the most convenient solution if you don't fiddle with anything that would affect the rust package). It just requires these extra steps making sure your ports tree is on the exact commit from which the package repo was built to work reliably....
Here's the script you posted in another thread to get the port hash - it does work but I haven't incorporated it into my build script to use Poudriere's Fetch feature:

 
I just read the current sample config file of ports-mgmt/poudriere-devel and had to giggle:
Code:
# List of package globs that are not allowed to use tmpfs for their WRKDIR
# Note that you *must* set TMPFS_BLACKLIST_TMPDIR
# EXAMPLE: TMPFS_BLACKLIST="rust"
Maybe that ;)
 
Here's a bit of tooling I use to build ports with poudriere-devel. The update-ports command is the one that does what zirias is describing:

Code:
#!/bin/sh
  commit=$(fetch -q -o - 'https://pkg-status.freebsd.org/api/1/builds?type=package&jailname=132amd64' | fx 'x["builds"].find(b => b.mastername == "132amd64-default" && b.status == "stopped:done:").buildname')
  if [ -z $commit ]; then
    echo 'Could not find completed build. Still running? https://pkg-status.freebsd.org/' 1>&2
    exit 1
  fi
  cd freebsd-ports.git/main && git remote update && git reset --hard $commit

Then you use -b latest (as used in the build-prod command) to fetch packages.

Every once in a while I have to build with -c to delete previously downloaded packages, because options have changed between the fetched version and git, and poudriere thinks it needs to rebuild.

Basic trick is to run with -n -v to see what triggers a build for a package that you expect to be downloaded.
 
Every once in a while I have to build with -c to delete previously downloaded packages, because options have changed between the fetched version and git, and poudriere thinks it needs to rebuild.
As weird as it sounds, in such a case it works even better to just interrupt poudriere after it deleted packages not matching any more and immediately restart it ... then it will download just these packages ?

edit: btw, your script looks cleaner than my attempt at first sight. Nice to see there actually are automated solutions. Maybe it might be possible to somehow integrate one of them into poudriere to have a poudriere-ports command automatically updating your tree to the state of the latest package repository ... well, just playing with ideas for now ?
 
Not sure it will work: on my build server 16 GB RAM are not enough. But I use ZFS, maybe with UFS will work for you.
Another try with a better ec2 instance, with 16 Go RAM, 8 Go swap (no ZFS, /tmp as tmpfs, with one job) : stil a fail after 5 hours.
The spirit of FreeBSD and port building is dead since lang/rust is a dependency for another ports. One year ago, it took 11 hours to build FreeBSD src. And today, no possibility to build a simple port...
 
Two things to remark here:

1. It's not FreeBSD deciding which languages third-party projects use, and just sticking to an outdated version (especially in a security context) is certainly not an option.
2. Compilers with tooling and "standard libs" these days are massive projects, there's no way to change that either. One of them, llvm (including what's necessary for C and C++) is part of base and indeed takes the vast majority of resources when building base from source. Rust is not in base, so, must be built from a port. If you install base from binary releases, but build ports yourself, you're getting a somewhat wrong picture here.

For massive builds these days, 16GiB of RAM is still kind of limited. I'd really still recommend to only build yourself what you must (because you need non-default build options) and use as many binary packages as possible. Even on my 64GiB server I use to build my repository, I still use poudriere's package pre-fetching, because there's just no point in building exactly the same thing locally that a FreeBSD build server already did.
 
Another try with a better ec2 instance, with 16 Go RAM, 8 Go swap (no ZFS, /tmp as tmpfs, with one job) : stil a fail after 5 hours.

Disabling TMPFS resulted in a successful build for me. 1:40 hours with 16 GB RAM on a 2019 Xeon E-2236.

Switching to poudriere-devel to disable TMPFS for rust only seems the best option for me.

I still don't understand why SirDice can build with TMPFS.
 
Even on my 64GiB server I use to build my repository, I still use poudriere's package pre-fetching, because there's just no point in building exactly the same thing locally that a FreeBSD build server already did.

If I understand correctly you do this by using the same commit of the port tree used to build the packages on the FreeBSD repository.

Doesn't it mean you get security updates a couple days later?
 
Two things to remark here:

1. It's not FreeBSD deciding which languages third-party projects use, and just sticking to an outdated version (especially in a security context) is certainly not an option.
2. Compilers with tooling and "standard libs" these days are massive projects, there's no way to change that either. One of them, llvm (including what's necessary for C and C++) is part of base and indeed takes the vast majority of resources when building base from source. Rust is not in base, so, must be built from a port. If you install base from binary releases, but build ports yourself, you're getting a somewhat wrong picture here.

For massive builds these days, 16GiB of RAM is still kind of limited. I'd really still recommend to only build yourself what you must (because you need non-default build options) and use as many binary packages as possible. Even on my 64GiB server I use to build my repository, I still use poudriere's package pre-fetching, because there's just no point in building exactly the same thing locally that a FreeBSD build server already did.
I understand your point. What I was trying to say is, for me, FreeBSD has always been a great OS for light and old machines. I use it since 2006, with... 256 Mo RAM (I could even build src with this). Of course, I had to increase the RAM and CPU years after years, yes. But increase from 4 Go to 64 Go is a huge gap... for a single port.

For the moment, I used:
Code:
DEFAULT_VERSIONS+=pycryptography=legacy
And I removed sysutils/ec2-scripts from my building list. All my ports (databases, python, nginx... webserver stuff) were build in only two hours!

It's ok for me to use pre-built packages, especially in that precise case. However, in my case, security/py-certbot is built with python3.9, which is too old for my applications.

I hope a solution will be found in the future for dependencies to lang/rust (why not include it in the base system?). I don't don't know if using will be a sane and viable solution in the future.

It's always a pleasure to read you, guys. Thanks a lot for your answers and advices!
 
Back
Top