Skip to content

Instantly share code, notes, and snippets.

@eglaysher
Created March 7, 2011 23:49
Show Gist options
  • Save eglaysher/859542 to your computer and use it in GitHub Desktop.
Save eglaysher/859542 to your computer and use it in GitHub Desktop.
golang has problems compiling cgo; can't find fflush or fputs?
--- cd ../misc/cgo/stdio
rm -rf *.o *.a *.[568vq] [568vq].out hello fib chain run.out *.so _obj _test _testmain.go *.exe _cgo* *.cgo[12].*
CGOPKGPATH= cgo -- align.go file.go test.go test1.go
touch _obj/_cgo_run
6g -o _go_.6 _obj/align.cgo1.go _obj/file.cgo1.go _obj/test.cgo1.go _obj/test1.cgo1.go _obj/_cgo_gotypes.go
6c -FVw -I/home/erg/go/pkg/linux_amd64 -I . -o "_cgo_defun.6" _obj/_cgo_defun.c
gcc -m64 -I . -g -fPIC -O2 -o _cgo_main.o -c _obj/_cgo_main.c
gcc -m64 -I . -g -fPIC -O2 -o align.cgo2.o -c _obj/align.cgo2.c
gcc -m64 -I . -g -fPIC -O2 -o file.cgo2.o -c _obj/file.cgo2.c
gcc -m64 -I . -g -fPIC -O2 -o test.cgo2.o -c _obj/test.cgo2.c
gcc -m64 -I . -g -fPIC -O2 -o test1.cgo2.o -c _obj/test1.cgo2.c
gcc -m64 -I . -g -fPIC -O2 -o _cgo_export.o -c _obj/_cgo_export.c
gcc -m64 -g -fPIC -O2 -o _cgo1_.o _cgo_main.o align.cgo2.o file.cgo2.o test.cgo2.o test1.cgo2.o _cgo_export.o
/usr/bin/ld: _cgo_main.o: in function _cgohack_sys_errlist:_cgo_main.c(.data.rel+0x10): warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
cgo -dynimport _cgo1_.o >_obj/_cgo_import.c_ && mv -f _obj/_cgo_import.c_ _obj/_cgo_import.c
6c -FVw -I . -o "_cgo_import.6" _obj/_cgo_import.c
rm -f _obj/stdio.a
gopack grc _obj/stdio.a _go_.6 _cgo_defun.6 _cgo_import.6 align.cgo2.o file.cgo2.o test.cgo2.o test1.cgo2.o _cgo_export.o
cp _obj/stdio.a "/home/erg/go/pkg/linux_amd64/stdio.a"
6g hello.go
6l -o hello hello.6
/home/erg/go/pkg/linux_amd64/stdio.a(align.cgo2.o)(.text): fflush: not defined
/home/erg/go/pkg/linux_amd64/stdio.a(file.cgo2.o)(.text): fputs: not defined
/home/erg/go/pkg/linux_amd64/stdio.a(file.cgo2.o)(.text): fflush: not defined
fputs(0): not defined
fflush(0): not defined
make: *** [hello] Error 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment