Showing posts with label rust. Show all posts
Showing posts with label rust. Show all posts

Wednesday, August 13, 2025

benchmark compile times

Goal 

Compare rustc and cranelift compile times.
 
 
git clone https://github.com/zed-industries/zed.git

 

Building Zed for macOS

https://github.com/zed-industries/zed/discussions/24512

 

# Build CLI
cd crates/cli/
cargo build --release
# Build Editor
cd ../zed/
cargo build --release --verbose 
   Compiling env_filter v0.1.3
Compiling email_address v0.2.9
Compiling num-cmp v0.1.0
warning: webrtc-sys@0.3.7: webrtc-sys downloading webrtc to "/Users/baxter/baxdocs/rust_learn/zed/target/release/build/webrtc-sys-8cf4e81cad33241f/out/livekit/mac-arm64-release-webrtc-b99fd2c-6/mac-arm64-release"
warning: webrtc-sys@0.3.7: In file included from /Users/baxter/baxdocs/rust_learn/zed/target/release/build/webrtc-sys-8cf4e81cad33241f/out/cxxbridge/sources/webrtc-sys/src/peer_connection.rs.cc:1:
warning: webrtc-sys@0.3.7: In file included from ./include/livekit/rtc_error.h:19:
warning: webrtc-sys@0.3.7: In file included from /Users/baxter/baxdocs/rust_learn/zed/target/release/build/webrtc-sys-8cf4e81cad33241f/out/livekit/mac-arm64-release-webrtc-b99fd2c-6/mac-arm64-release/include/api/rtc_error.h:17:
warning: webrtc-sys@0.3.7: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/string:569:
warning: webrtc-sys@0.3.7: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__algorithm/remove.h:12:
warning: webrtc-sys@0.3.7: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__algorithm/find.h:13:
warning: webrtc-sys@0.3.7: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__algorithm/unwrap_iter.h:14:
warning: webrtc-sys@0.3.7: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__memory/pointer_traits.h:118:22: error: implicit instantiation of undefined template 'std::__pointer_traits_element_type<rust::Slice<const unsigned char>::iterator>'
warning: webrtc-sys@0.3.7: typedef typename __pointer_traits_element_type<pointer>::type element_type;
warning: webrtc-sys@0.3.7: ^
warning: webrtc-sys@0.3.7: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__memory/pointer_traits.h:182:20: note: in instantiation of template class 'std::pointer_traits<rust::Slice<const unsigned char>::iterator>' requested here
warning: webrtc-sys@0.3.7: decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))
warning: webrtc-sys@0.3.7: ^
warning: webrtc-sys@0.3.7: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__memory/pointer_traits.h:195:59: note: during template argument deduction for class template partial specialization '_HasToAddress<_Pointer, decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer &>()))>' [with _Pointer = rust::Slice<const unsigned char>::iterator]
warning: webrtc-sys@0.3.7: static const bool value = _HasArrow<_Pointer>::value || _HasToAddress<_Pointer>::value;
warning: webrtc-sys@0.3.7: ^
warning: webrtc-sys@0.3.7: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__memory/pointer_traits.h:195:59: note: in instantiation of template class 'std::_HasToAddress<rust::Slice<const unsigned char>::iterator>' requested here
warning: webrtc-sys@0.3.7: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__type_traits/conjunction.h:27:32: note: in instantiation of template class 'std::_IsFancyPointer<rust::Slice<const unsigned char>::iterator>' requested here
warning: webrtc-sys@0.3.7: __expand_to_true<__enable_if_t<_Pred::value>...> __and_helper(int);
warning: webrtc-sys@0.3.7: ^
warning: webrtc-sys@0.3.7: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__type_traits/conjunction.h:38:39: note: while substituting explicitly-specified template arguments into function template '__and_helper'
warning: webrtc-sys@0.3.7: using _And _LIBCPP_NODEBUG = decltype(std::__and_helper<_Pred...>(0));
warning: webrtc-sys@0.3.7: ^
warning: webrtc-sys@0.3.7: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__memory/pointer_traits.h:200:5: note: (skipping 4 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
warning: webrtc-sys@0.3.7: _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value
warning: webrtc-sys@0.3.7: ^
warning: webrtc-sys@0.3.7: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__iterator/concepts.h:193:7: note: in instantiation of requirement here
warning: webrtc-sys@0.3.7: { _VSTD::to_address(__i) } -> same_as<add_pointer_t<iter_reference_t<_Ip>>>;
warning: webrtc-sys@0.3.7: ^~~~~~~~~~~~~~~~~~~~~~
warning: webrtc-sys@0.3.7: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__config:897:17: note: expanded from macro '_VSTD'
warning: webrtc-sys@0.3.7: # define _VSTD std
warning: webrtc-sys@0.3.7: ^
warning: webrtc-sys@0.3.7: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__iterator/concepts.h:192:3: note: while substituting template arguments into constraint expression here
warning: webrtc-sys@0.3.7: requires(const _Ip& __i) {
warning: webrtc-sys@0.3.7: ^~~~~~~~~~~~~~~~~~~~~~~~~~
warning: webrtc-sys@0.3.7: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__ranges/concepts.h:122:5: note: while checking the satisfaction of concept 'contiguous_iterator<rust::Slice<const unsigned char>::iterator>' requested here
warning: webrtc-sys@0.3.7: contiguous_iterator<iterator_t<_Tp>> &&
warning: webrtc-sys@0.3.7: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: webrtc-sys@0.3.7: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__ranges/concepts.h:122:5: note: while substituting template arguments into constraint expression here
 

 

Can't compile ZED anymore using Vendor - error: failed to run custom build command for `webrtc-sys v0.3.5 #24512

Compilation error when compiling webrtc-sys (from zed-industries/livekit-rust-sdks clone) #23697


macos 14.7.7

Xcode 14.2 

cargo add webrtc
 Did not solve the problem.

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept

 

Solution

Install:

Xcode 15.2, command line tools for Xcode 15.2  

 

 

 

Tuesday, August 12, 2025

faster rust compiling

 How Usable is the Rust Cranelift Backend Today


A Possible New Backend for Rust


Cranelift

https://blog.rust-lang.org/inside-rust/2020/11/15/Using-rust...


Cranelift codegen backend for rust

https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_cranelift/Readme.md

rustup component add rustc-codegen-cranelift-preview --toolchain nightly

#cranelift forum

rustup component remove rustc-codegen-cranelift-preview --toolchain nightly

 

Cranelift Examples

 

Cranelift code generation comes to Rust

$ git clone https://github.com/rust-lang/rustc_codegen_cranelift
$ cd rustc_codegen_cranelift
$ ./y.sh build

 People can now try the Cranelift backend using rustup and cargo:

$ rustup component add rustc-codegen-cranelift-preview --toolchain nightly $ export CARGO_PROFILE_DEV_CODEGEN_BACKEND=cranelift $ cargo +nightly build -Zcodegen-backend

bjorn3 latest progress report  

 
 
'rustup component' (with examples)
 
 
 

Karabiner-Elements

Keyboard short cuts.

= = = = =

Fujiyoshida, Yamanashi prefecture, Japan

*Fuji Asada City “Hotspot” Drama Turns Mount Fuji Area into Tourist Attraction


Wednesday, July 17, 2024

using git; rust doc guessing game

using git

 

git init

git add .

git commit . -m "initial commit"

git status .

git log gen-man.py

Clone a repo

git clone https://github.com/Macchina-CLI/macchina.git

Using git stash

Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory.

https://opensource.com/article/21/4/git-stash

git stash

Update local repo to latest commit

git pull git://git.savannah.gnu.org/emacs emacs-30.1

Files to exclude from version control

.gitignore
https://github.com/github/gitignore/blob/main/Rust.gitignore
 
https://github.com/github/gitignore/blob/main/Haskell.gitignore
 

and for other languages.

git - the simple guide

MS Class Github Foundations


 

git config user.email querqus@blair-pop.local

git commit -m "how preview" man_page.py


How to Delete a Forked Repository in GitHub?

https://lifeincoding.com/how-to-delete-a-forked-repository-in-github/  

Clone repo from a specific date 

 https://forums.freebsd.org/threads/git-download-source-from-a-specific-date.81558/ 

git clone https://github.com/zed-industries/zed.git
git log --after="2023-05-17 13:00" --before="2023-10-17 13:00"
git reset --hard 291d35f337b6a9b49beff2c2d40aa741ace843a4

 

 Rust update to next version


rustup update > up.txt 2>&1
it worked:
info: syncing channel updates for 'stable-aarch64-apple-darwin'
info: latest update on 2024-11-28, rust version 1.83.0 (90b35a623 2024-11-26)
info: downloading component 'rust-std' for 'wasm32-wasi'
info: downloading component 'rust-src'
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: removing previous version of component 'rust-std' for 'wasm32-wasi'
info: removing previous version of component 'rust-src'
info: removing previous version of component 'cargo'
info: removing previous version of component 'clippy'
info: removing previous version of component 'rust-docs'
info: removing previous version of component 'rust-std'
info: removing previous version of component 'rustc'
info: removing previous version of component 'rustfmt'
info: installing component 'rust-std' for 'wasm32-wasi'
info: installing component 'rust-src'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
info: syncing channel updates for '1.80-aarch64-apple-darwin'
info: checking for self-update

stable-aarch64-apple-darwin updated - rustc 1.83.0 (90b35a623 2024-11-26) (from rustc 1.79.0 (129f3b996 2024-06-10))
1.80-aarch64-apple-darwin unchanged - rustc 1.80.1 (3f5fd8dd4 2024-08-06)

info: cleaning up downloads & tmp directories

Programming a Guessing Game

Rust Book: Guessing Game

 

Monday, July 15, 2024

cargo-generate bug iconv libiconv match libraries

linking error between macOS and macport provided libiconv library #1208

The problem is widespread and long lasting with many long discussions.

_libiconv or _iconv undefined symbol on Mac OSX

 

R-Problems with iconv on macOS

Longstanding GHC linking issues when multiple iconv libraries are installed on macOS (Haskell #18743)

 

long discussion:

MacOS iconv linkage misdetection (also deprecation warnings) #830

 

libiconv breaks compatibility with OS-provided #57821

 

rav1e @0.6.6: iconv linking fails, expecting symbols from MacOS's iconv lib #68026

rav1e: build fails due to git_allocator missing members #68178


 

Examples of possible fixes: 

ghc: Bugfixes for test and iconv linking #8523

Fix i/macOS libc++ initialization on early instrumentation #194

frida/frida-core

 

solution: libiconv on Mac OS X


FindIconv: Problem on macOS with mac ports


I can't imagine how cmake could possibly help you with this problem. The only thing cmake does is tell you where libiconv is located. It should not matter at all to your application whether it tells you about a system copy of libiconv like the one in /usr on macOS or a third-party copy of libiconv like the one in /opt/local provided by MacPorts, so long as you use both the headers and the library from the same place. The only way the problem you're experiencing could occur is if you're using the headers from one place and the library from another, so Don't Do That.

 

Friday, May 24, 2024

Part 2: rustup; why; using git

 

rustup; why

Turns out rustup is essential to many projects (zed, redox).
 

curl –proto ‘=https’ –tlsv1.2 -sSf https://sh.rustup.rs | sh

https://www.rust-lang.org/learn/get-started
Don't forget to update every once in a while (see Issue #1208 ).

rustup update
 
Ignore what I said:
 
rustup self uninstall

https://code2care.org/rust/uninstall-rust-lang-from-mac-linux-or-ubuntu/

 

Using git


Thursday, May 9, 2024

Why Linux will take over the world!

Linux reaches 4%

   will take over in 2040!

 No. 

Linux distributions can be usable even by regular folk depending on how they use them.  For web browsing, working on documents, spreadsheets and drawing its usable its fine.

 But once you go off a very narrow path of those basic tasks you may wind up fiddling with apt, peering into the terminal, trying to install package mostly succeeding but sometimes failing in mysterious ways.

 


LibreOffice endless fonts menu

font snafu reponse to EULA fails?

virtualbox additions barf (gcc-11 or gcc-12??); works from virtualbox menu but not from inside the vm session.

installing rust on ubuntu confusion no rustup in the 22.04 repo!



-----

  4% worldwide in 2022

Wednesday, April 24, 2024

learning rust; installing rustup; macchina; build redox

rust / rustup /  cargo
 
rust

the language 

https://tourofrust.com/index.html

redox os (unix-like os written in rust)

rustup

macports had to migrate, old install was on Monterey now on Ventura 13.6.6

setup steps (with brew)

Install rustup package manager first and then have rustup install rustc, cargo.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup toolchain install stable

 

the rust compiler is rustc

To clean up debug and other build files:

cargo clean

Apple Silicon Development Set up for Rust


Using Rust from Python

Pyo3

 

 

Crux

Cross-platform app development in Rust

Learn how to use Crux in your project

 

 

GUI Tool kits

slint

iced 

Tauri 2.0

  https://www.youtube.com/watch?v=rC4FCS-oMpg

  https://github.com/makepad/makepad

 
 
 
Comfy - 2d game engine in Rust/wgpu

Leaving Rust gamedev after 3 years

Miniquad/Macroquad

  Using D lang to mix C++ and Rust.

www.tipi.build

https://www.youtube.com/watch?v=z6j-lCOi4XM

Corrosion.rs c++ rust bridge


apps

warp (advanced feature terminal; requires login)

gitoxide

media

Writing an OS in Rust

  Philipp Oppermann's blog

  

Brodie interviews Jeremy Soller developer of Redox OS

Building a secure Operating System (Redox OS) with Rust (Interview)

 

https://areweguiyet.com/

zed.dev

A fast new editor to try:

zed.dev (macos, build on linux)

Configuring Rust Analyzer

 

run PopOS arm64

Reddit discussion: Installation guide for Pop!_OS (arm64) on Apple Silicon
  works great using UTM.
  Installation Guide.
 
 UTM cheat sheet

disabling GNOME

Learn Rust

 Crust of Rust by Jon Gjengset



nala install pop_OS!

apt search nala
sudo apt install nala

sudo nala install curl

## install rustup toolchain manager
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

## install rustc and cargo
rustup toolchain install stable

sudo nala install git
sudo nala install build-essential
sudo nala install clang
sudo nala install strip-nondeterminism


 

compile macchina on pop_OS!

# install macchina alt to neofetch
# https://github.com/Macchina-CLI/macchina/wiki/Installation#build-for-everything-else
#
git clone https://github.com/grtcdr/macchina
cd macchina
cargo build --release

strip target/release/macchina
cargo run --release

Build redox disk img

mkdir -p ~/tryredox
cd ~/tryredox/git clone https://gitlab.redox-os.org/redox-os/redox.git --origin upstream --recursive
cd redox/
  370  make pull
  371  pwd
  372  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  373  nala search rust
  374  which rustc
  375  which cargo
  376  nala search rustc
  377  nala --help
  378  nala remove rustc
  379  sudo nala remove rustc
  380  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  381  exit
  382  which rust
  383  which rustc
  384  pwd
  385  cd tryredox/redox/
  386  make pull
  387  rustup --help
  388  cargo install --force cbindgen
  389  make pull
  390  cargo install --force nasm
  391  make pull
  392  nala search nasm
  393  nala install nasm
  394  sudo nala install nasm
  395  pwd
  396  make pull
  397  ls
  398  more build.sh
  399  ls
  400  pwd
  401  more README.md
  402  ./bootstrap.sh -d
  403  rustup toolchain list
  404  time make all
  405  ll
  406  cd build
  407  cd ..
  408  more README.md
  409  cd build
  410  ls
  411  cd x86_64/
  412  ls
  413  cd desktop/
  414  ll
  415  df -h .
  416  mount
  417  neofetch
  418  uptime
  419  sudo shutdown -h now


 
 
 

 



Tuesday, April 23, 2024

part 1:clean rust install

Note:

If you need rustc and cargo to learn rust you might not need rustup.  However it is required for most projects.   So follow this.

Install Rust (macos)

 curl –proto ‘=https’ –tlsv1.2 -sSf https://sh.rustup.rs | sh

 

The install (see above) is as easy as the official site (https://www.rust-lang.org/tools/install) says.   So why don't I like it?

Well I know I would have to:

  1. examine the script and try to figure out what it was doing
  2. write a note to myself about some directory paths
  3. review above note to uninstall 
  4. leave behind a bunch of left over files

Instructions

macport is the package manager I use.

download and install macports from macports.org

A how to for homebrew users.

You don't need xcode but you will need the tools.  Launch terminal and enter these commands:

xcode-select --install

sudo port install rust
sudo port install cargo

 

cd /opt/local/bin 

./rustc --version
rustc 1.77.1 (7cf61ebde 2024-03-27) (built from a source tarball)
 

Success you have installed rust!

macos 12.7 Monterey macbook pro 2.7 GHz Core i5 (I5-5257U)

Part 2: rustup; why