Golang on DragonFly BSD
There is a problem with cgo, auxiliary C/Go integration, which I'm hoping will be fixed and pushed upstream with plenty of time to review before the Go 1.2 freeze which is scheduled for September 1st.
- Working cgo. https://codereview.appspot.com/13213043/
- Discussion of proper fix. https://groups.google.com/d/msg/golang-dev/O2ALUcNCTAQ/GhnnMguNFWIJ
- When building with no environment variable, loadlib() in src/cmd/6l/obj.c gets called within main() toward the end of the build process and results in an error on DragonFly BSD, but on FreeBSD, loadlib() doesn't get called at the same place late in the build process. This error which starts out with a call to loadlib() ends within the "if(sym.sym == nil)" block within ldelf() in src/cmd/ld/ldelf.c.
- Overview of the ld/6l linker. http://golang.org/cmd/ld/
- Overview of how cgo works. http://golang.org/misc/cgo/gmp/gmp.go
- Overview of how cgo works. http://golang.org/src/pkg/runtime/cgocall.c
- Log in as Root
- pkg_radd bash
- pkg_radd bison
- pkg_radd clang
- pkg_radd gcc47
- pkg_radd gmake
- pkg_radd mozilla-rootcerts
- pkg_radd nano
- rehash
- mkdir -p /etc/openssl/certs
- mozilla-rootcerts install
- nano /etc/rc.conf
- hostname="dfly.example.local"
- Ctrl-X, Y, Enter
- shutdown -r now
- Log in as User or Root
- mkdir ~/go
- git clone http://github.com/varialus/godfly.git ~/go/
- bash
- export CC=clang # Optional. Try both with and without this step.
- export GO_LDFLAGS="-linkmode external";vidcontrol -h 5000;cd ~/go/;git fetch origin cgo;git reset --hard FETCH_HEAD;git clean -df;cd ~/go/src/;./all.bash
- exit
- Push fixes to github.com.
- Repeat steps 20 through 24
- Log in as Root
- pkg_radd bash
- pkg_radd bison
- pkg_radd clang
- pkg_radd gcc
- pkg_radd gmake
- pkg_radd git
- pkg_radd mozilla-rootcerts
- pkg_radd nano
- rehash
- mkdir -p /etc/openssl/certs
- mozilla-rootcerts install
- nano /etc/rc.conf
- hostname="dfly.example.local"
- Ctrl-X, Y, Enter
- shutdown -r now
- Log in as User or Root
- mkdir ~/go
- git clone http://github.com/varialus/godfly.git ~/go/
- bash
- export CC=clang # Optional
- vidcontrol -h 5000;cd ~/go/;git fetch origin upstream;git reset --hard FETCH_HEAD;git clean -df;cd ~/go/src/;./all.bash
I'll improve the instructions either after cgo is working or after September 1st, whichever comes first.
- Add system installation instructions.
- Add per session environment variables.
- Add go get wingo instructions, including export GIT_SSL_CAINFO="/etc/ssl/certs/ca-certificates.crt"
- Add Hello World!