{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/13377","labels_url":"https://api.github.com/repos/golang/go/issues/13377/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/13377/comments","events_url":"https://api.github.com/repos/golang/go/issues/13377/events","html_url":"https://github.com/golang/go/issues/13377","id":118508844,"number":13377,"title":"Cross-compiling with cgo for ARMv7 fails","user":{"login":"gjstrange","id":15988955,"avatar_url":"https://avatars.githubusercontent.com/u/15988955?v=3","gravatar_id":"","url":"https://api.github.com/users/gjstrange","html_url":"https://github.com/gjstrange","followers_url":"https://api.github.com/users/gjstrange/followers","following_url":"https://api.github.com/users/gjstrange/following{/other_user}","gists_url":"https://api.github.com/users/gjstrange/gists{/gist_id}","starred_url":"https://api.github.com/users/gjstrange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gjstrange/subscriptions","organizations_url":"https://api.github.com/users/gjstrange/orgs","repos_url":"https://api.github.com/users/gjstrange/repos","events_url":"https://api.github.com/users/gjstrange/events{/privacy}","received_events_url":"https://api.github.com/users/gjstrange/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-11-24T00:59:32Z","updated_at":"2015-11-24T22:41:27Z","closed_at":"2015-11-24T18:30:51Z","body":"\r\nWe are using Go on a ARM335x/Linux board very similar to the BeagleBone black, but the cross compile fails if it involves mixed C and Go code and cgo.\r\n\r\nBackground: Using go version 1.5.1. Host is Ubunutu 15.04 running in a VM on a Mac. Target settings:\r\n    GOOS= linux\r\n    GOARCH=arm\r\n    GOARM=7\r\n\r\nCC, CXX, etc. are also set to the cross compiler gcc tools.\r\n\r\n\r\nThe error reported is:\r\n\r\n```# runtime/cgo\r\nIn file included from /opt/yogurt/AM335x-PD15.1.1/sysroots/cortexa8t2hf-vfp-neon-phytec-linux-gnueabi/usr/include/features.h:389:0,\r\n                 from /opt/yogurt/AM335x-PD15.1.1/sysroots/cortexa8t2hf-vfp-neon-phytec-linux-gnueabi/usr/include/errno.h:28,\r\n                 from /usr/local/go/src/runtime/cgo/cgo.go:50:\r\n/opt/yogurt/AM335x-PD15.1.1/sysroots/cortexa8t2hf-vfp-neon-phytec-linux-gnueabi/usr/include/gnu/stubs.h:7:29: fatal error: gnu/stubs-soft.h: No such file or directory\r\n # include <gnu/stubs-soft.h>\r\n                             ^\r\ncompilation terminated.```\r\n\r\n\r\n\r\nSome research showed that the problem stemmed from incorrect compiler flags. The ARMv7 processor (TI AM3359 Cortex A8 in this case), uses hardware hardware floating point, so the following flags need to be set:\r\n\r\n\"-mthumb-interwork\", \"-mfloat-abi=hard\", \"-mfpu=neon\"\r\n\r\nIt also should link against /lib/ld-linux-armhf.so.3, but links against /lib/ld-linux.so.3 instead.\r\n\r\nWe have a personal branch of Go now that fixes the problem, though we are new to Go, so the change may not be well done.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/159429203","html_url":"https://github.com/golang/go/issues/13377#issuecomment-159429203","issue_url":"https://api.github.com/repos/golang/go/issues/13377","id":159429203,"user":{"login":"minux","id":135652,"avatar_url":"https://avatars.githubusercontent.com/u/135652?v=3","gravatar_id":"","url":"https://api.github.com/users/minux","html_url":"https://github.com/minux","followers_url":"https://api.github.com/users/minux/followers","following_url":"https://api.github.com/users/minux/following{/other_user}","gists_url":"https://api.github.com/users/minux/gists{/gist_id}","starred_url":"https://api.github.com/users/minux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minux/subscriptions","organizations_url":"https://api.github.com/users/minux/orgs","repos_url":"https://api.github.com/users/minux/repos","events_url":"https://api.github.com/users/minux/events{/privacy}","received_events_url":"https://api.github.com/users/minux/received_events","type":"User","site_admin":false},"created_at":"2015-11-24T22:41:27Z","updated_at":"2015-11-24T22:41:27Z","body":"The problem is probably that when invoking the external linker, cmd/link\nfailed to to specify its float abi is hard, so gcc uses the normal dynamic\ninterpreter.\n"}}