Re: [go-nuts] How does gccgo compile with my own package imported?
Hi Ian, OK I got it now. I have to separately compile the imported packages as .o if I use gccgo and then link them to the final executable. Resolving the dependency of the packages may be troublesome so go tool is good if we have choice. Thanks. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] How does gccgo compile with my own package imported?
On Fri, Jul 7, 2017 at 1:10 AM,wrote: > > So, is it strange that gccgo can't compile if the main.go imports some > non-standard library package? > Is it meaning with gccgo, we have to write a single go file to contain > everything, or just import only the standard library package? > I used to try -I to indicate the package path also it doesn't help, can I > conclude that gccgo doesn't fit for any complex go software development? No, I don't see why you would reach that conclusion. As I said before, the `gccgo` program acts like the `gcc` program. When you run `gcc` on a C program that depends on some non-standard library package, it will not go off and build that other non-standard library. `gccgo` is exactly the same. As I said before, you should instead use the `go` program to build your program. The `go` program will build all required libraries. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] How does gccgo compile with my own package imported?
Hi Ian, Thanks for your reply. Although I am a seasoned c programmer I am a go beginner. So, is it strange that gccgo can't compile if the main.go imports some non-standard library package? Is it meaning with gccgo, we have to write a single go file to contain everything, or just import only the standard library package? I used to try -I to indicate the package path also it doesn't help, can I conclude that gccgo doesn't fit for any complex go software development? What I am doing is try to build some open source go code into openWrt, with some unofficial patch I can build toolchain with gccgo support (hope some day go support officially into OpenWrt), but it only produces gccgo, there is no go tool. There is gcc-5.3.0/libgo/go/cmd/go in the toolchain, where I run "gccgo -o go `ls *.go | grep -v _test.go | grep -v bootstrap | grep -v doc`" gives many errors. Thanks -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] How does gccgo compile with my own package imported?
On Thu, Jul 6, 2017 at 2:10 AM, ajeewrote: > > Before I post here I did a lot of search by Google, there are several (but > not many) similar topics but all of them don't have valid answer or apply to > me. > > I have a simple code tree like this: > > ├── main.go > └── transform > ├── css.go > ├── html.go > ├── html_test.go > └── http.go > > The main.go starts like this: > > package main > > import ( > "crypto/tls" > "encoding/json" > "io" > "io/ioutil" > "log" > "net/http" > "strings" > "text/template" > "./transform" > ) > > > Since my target is a mips router I have only gccgo available, I compile it > with the gccgo of toolchain at the source directory: > *gccgo main.go > > > Then it complains as : > > main.go:12:13: error: import file './transform' not found > > If I compile it under Ubuntu with go, it works. How to work through it with > gccgo? You will want to use `go build` just as you do with the gc toolchain. The gccgo programs acts like GCC for other languages; it does not act like the go tool. When you install gccgo, you will get a copy of the go tool that will invoke the gccgo program as needed. Or you can use the go tool from the gc toolchain and run `go build -compiler=gccgo`. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] How does gccgo compile with my own package imported?
Hi, Before I post here I did a lot of search by Google, there are several (but not many) similar topics but all of them don't have valid answer or apply to me. I have a simple code tree like this: ├── main.go └── transform ├── css.go ├── html.go ├── html_test.go └── http.go The main.go starts like this: package main import ( "crypto/tls" "encoding/json" "io" "io/ioutil" "log" "net/http" "strings" "text/template" "./transform" ) Since my target is a mips router I have only gccgo available, I compile it with the gccgo of toolchain at the source directory: *gccgo main.go Then it complains as : *main.go:12:13: error: import file './transform' not found* If I compile it under Ubuntu with go, it works. How to work through it with gccgo? Thanks -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.