Skip to content

wasmup/go-build-from-src

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

build from src

Go build from source

# real	1m48.236s
# user	8m49.113s
# sys	0m54.546s

Open JDK build from the source

# real  18m45.866s
# user  107m24.467s
# sys   9m47.515s

go-build-from-src

https://go.dev/doc/install/source

wget https://go.dev/dl/go1.25.0.src.tar.gz
tar -xzf go1.25.0.src.tar.gz

which go
export GOROOT_BOOTSTRAP=/usr/local/go

# Run to get GOAMD64
cd example
go run .
cd ..
# set GOAMD64
# export GOAMD64=v1
# export GOAMD64=v2
# export GOAMD64=v3
# export GOAMD64=v4
echo $GOAMD64

cd go/src
time ./make.bash
# real	1m48.236s
# user	8m49.113s
# sys	0m54.546s


# ./all.bash
cd ../..
file ./go/bin/go
./go/bin/go version

rm -rf ./go/doc ./go/misc ./go/test ./go/api
file ./go/bin/go
ls -lh  ./go/bin/go
strip ./go/bin/go
strip ./go/bin/gofmt
strip ./go/pkg/tool/linux_amd64/*

./go/bin/go version -m ./go/bin/go

tar -czf go1.25.0.linux-amd64.tar.gz --exclude='.git' --exclude='.github' --exclude='.gitattributes'  --exclude='.gitignore' go/

ls -lh

sudo rm -r /usr/local/go
sudo tar -C /usr/local -zxf go1.25.0.linux-amd64.tar.gz
go version
which go
file $(which go)
go version -m $(which go)

Open JDK build from the source

https://github.com/openjdk/jdk

https://github.com/openjdk/jdk/tags

# cd ssd
wget https://github.com/openjdk/jdk/archive/refs/tags/jdk-26+12.tar.gz
tar -tf jdk-26+12.tar.gz
tar -xvzf jdk-26+12.tar.gz


sudo apt-get install build-essential autoconf
# CUPS, Common UNIX Printing System header files:
sudo apt-get install libcups2-dev
# X11:
sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev
# ALSA
sudo apt-get install libasound2-dev

# optimize OpenJDK build for your CPU:
make clean
bash configure --with-jvm-variants=server --with-jvm-features=link-time-opt --with-extra-cflags='-Ofast -march=native -funroll-loops -fomit-frame-pointer' --with-extra-cxxflags='-Ofast -march=native -funroll-loops -fomit-frame-pointer'

# -march=native tells the compiler to generate code optimized specifically for the CPU model of the build machine.
# -Ofast enables aggressive optimizations.
# -funroll-loops enables loop unrolling for better pipeline efficiency.
# -fomit-frame-pointer frees a register by omitting frame pointers (may impact debugging).



time make images
# real  18m45.866s
# user  107m24.467s
# sys   9m47.515s

./build/*/images/jdk/bin/java -version
# openjdk version "26-internal" 2026-03-17
# OpenJDK Runtime Environment (build 26-internal-adhoc.a.jdk-jdk-26-12)
# OpenJDK 64-Bit Server VM (build 26-internal-adhoc.a.jdk-jdk-26-12, mixed mode, sharing)
./build/*/images/jdk/bin/java -XshowSettings:vm -version
# VM settings:
#     Max. Heap Size (Estimated): 3.86G
#     Using VM: OpenJDK 64-Bit Server VM
./build/*/images/jdk/bin/java -Xinternalversion
# OpenJDK 64-Bit Server VM (26-internal-adhoc.a.jdk-jdk-26-12) for linux-amd64 JRE (26-internal-adhoc.a.jdk-jdk-26-12), built on 2025-08-24T05:46:42Z with gcc 13.3.0

# readelf -p .GCC.command.line build/linux-x86_64-server-release/images/jdk/lib/server/libjvm.so

# Run basic tests:
# make test-tier1

About

Open JDK and Go build from source

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages