[go-nuts] [golang/x/mobile] Can gomobile support build ios and android c static/dynamic lib.

2017-04-12 Thread hui zhang
Can gomobile support build ios and android c static/dynamic lib.

For some people do not link it to objc and java directly

It link with other C/C++ lib to form a common library , and then link to 
objc and java.

For example ,  in cocos2dx  , user use c++ to code.  But some logic they 
need go .

Can gomoblile add this support? 





-- 
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] swig and go

2017-04-12 Thread Ian Lance Taylor
On Wed, Apr 12, 2017 at 5:51 PM, larry104  wrote:
> I added a .go file - now go build complains about the incorrect swig version
> - The system installed swig version is 3.0.2  but I have 3.0.12 installed in
> linked in my bin. How can I tell go build to use this version instead?

The go tool will run whichever one is first on your PATH.

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] swig and go

2017-04-12 Thread larry104
I added a .go file - now go build complains about the incorrect swig 
version - The system installed swig version is 3.0.2  but I have 3.0.12 
installed in linked in my bin. How can I tell go build to use this version 
instead?

-- 
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] swig and go

2017-04-12 Thread larry104
The .go file can just be a dummy file with no real purpose?

On Wednesday, April 12, 2017 at 5:06:35 PM UTC-7, Ian Lance Taylor wrote:
>
> On Wed, Apr 12, 2017 at 4:42 PM, larry104  > wrote: 
> > 
> > I seems I need to manually run swig (swig -go -cgo -c++ -intgosize 64 
> > mylib.i) - it does not seem that 'go build' picks up the .i or .swig 
> file. 
> > Then I need to call 'go tool cgo mylib.go'. This creates an _obj 
> directory 
> > with a bunch of files. After that I tried calling 'go build'. This 
> errors 
> > out when my c++ code refers to some 3d party libs. How can I tell 'go 
> build' 
> > additional flags for compiling and linking like -I and -L flags? 
>
> When the go tool sees a .swig (for C) or .swigcxx (for C++) file, it 
> will invoke SWIG itself.  The file should be in the same directory as 
> the Go sources for the package.  See 
> https://golang.org/cmd/go/#hdr-Calling_between_Go_and_C .  Note that 
> there must be at least one .go files in the directory, and it needs to 
> be in a proper GOPATH directory. 
>
> Nevertheless, it should work to run SWIG yourself.  But running `go 
> tool cgo` yourself is just going to end in tears.  You're going to 
> need to let the go tool run cgo on your behalf. 
>
> To get -I and -L options, add a .go files that uses import "C" and 
> #cgo CFLAGS and #cgo LDFLAGS.  See https://golang.org/cmd/cgo and 
> https://github.com/golang/go/issues/6696#issuecomment-89016670 . 
>
> 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] swig and go

2017-04-12 Thread Ian Lance Taylor
On Wed, Apr 12, 2017 at 4:42 PM, larry104  wrote:
>
> I seems I need to manually run swig (swig -go -cgo -c++ -intgosize 64
> mylib.i) - it does not seem that 'go build' picks up the .i or .swig file.
> Then I need to call 'go tool cgo mylib.go'. This creates an _obj directory
> with a bunch of files. After that I tried calling 'go build'. This errors
> out when my c++ code refers to some 3d party libs. How can I tell 'go build'
> additional flags for compiling and linking like -I and -L flags?

When the go tool sees a .swig (for C) or .swigcxx (for C++) file, it
will invoke SWIG itself.  The file should be in the same directory as
the Go sources for the package.  See
https://golang.org/cmd/go/#hdr-Calling_between_Go_and_C .  Note that
there must be at least one .go files in the directory, and it needs to
be in a proper GOPATH directory.

Nevertheless, it should work to run SWIG yourself.  But running `go
tool cgo` yourself is just going to end in tears.  You're going to
need to let the go tool run cgo on your behalf.

To get -I and -L options, add a .go files that uses import "C" and
#cgo CFLAGS and #cgo LDFLAGS.  See https://golang.org/cmd/cgo and
https://github.com/golang/go/issues/6696#issuecomment-89016670 .

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] swig and go

2017-04-12 Thread Christopher Nielsen
For c++, your swig file needs to have a swigcxx extension for the go tool
to run swig properly.

On Apr 12, 2017 4:42 PM, "larry104"  wrote:

I seems I need to manually run swig (swig -go -cgo -c++ -intgosize 64
mylib.i) - it does not seem that 'go build' picks up the .i or .swig file.
Then I need to call 'go tool cgo mylib.go'. This creates an _obj directory
with a bunch of files. After that I tried calling 'go build'. This errors
out when my c++ code refers to some 3d party libs. How can I tell 'go
build'  additional flags for compiling and linking like -I and -L flags?


On Tuesday, April 11, 2017 at 5:35:52 PM UTC-7, Ian Lance Taylor wrote:

> On Tue, Apr 11, 2017 at 5:00 PM, larry104  wrote:
> >
> > As it seems with go 1.5 there is no 6c compiler anymore - I had it all
> > working with go 1.4 but now upgrading to 1.8.1 I'm lost. Does anyone
> know a
> > link to an example how the flow from c++ to an .so  library which I can
> > include as package in go (>1.5) works?
>
> If you build using the go tool, everything will continue to work.
>
> If you can't use the go tool to invoke SWIG, then with current Go you
> need to invoke SWIG with the -cgo option to get an input file for Go's
> cgo tool.  And at that point, it will be much simpler to let the go
> tool take over.
>
> 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.

-- 
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] swig and go

2017-04-12 Thread larry104
I seems I need to manually run swig (swig -go -cgo -c++ -intgosize 64 
mylib.i) - it does not seem that 'go build' picks up the .i or .swig file. 
Then I need to call 'go tool cgo mylib.go'. This creates an _obj directory 
with a bunch of files. After that I tried calling 'go build'. This errors 
out when my c++ code refers to some 3d party libs. How can I tell 'go 
build'  additional flags for compiling and linking like -I and -L flags?


On Tuesday, April 11, 2017 at 5:35:52 PM UTC-7, Ian Lance Taylor wrote:
>
> On Tue, Apr 11, 2017 at 5:00 PM, larry104  > wrote: 
> > 
> > As it seems with go 1.5 there is no 6c compiler anymore - I had it all 
> > working with go 1.4 but now upgrading to 1.8.1 I'm lost. Does anyone 
> know a 
> > link to an example how the flow from c++ to an .so  library which I can 
> > include as package in go (>1.5) works? 
>
> If you build using the go tool, everything will continue to work. 
>
> If you can't use the go tool to invoke SWIG, then with current Go you 
> need to invoke SWIG with the -cgo option to get an input file for Go's 
> cgo tool.  And at that point, it will be much simpler to let the go 
> tool take over. 
>
> 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] Re: Clearer float parsing API

2017-04-12 Thread Uli Kunitz
I don't think that is a good idea because to stay consistent multiple 
versionw of ParseUint, ParseInt, FormatInt and FormatUint would have to be 
added to the package. Those functions would make the interface of package 
strconv much larger.

Nobody stops you though to define your private parseFloat32 wrapping 
ParseFloat.

On Wednesday, April 12, 2017 at 7:39:15 PM UTC+2, Andrew Pennebaker wrote:
>
> Could we separate ParseFloat() into distinct signatures for the 
> corresponding float widths? Parsing a 32-bit float shouldn't be returned as 
> a 64-bit float :/
>

-- 
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] time.Parse is failing to parse a date generated with time.Format using time.UnixDate as layout on 'empty' timezone

2017-04-12 Thread Ian Lance Taylor
On Wed, Apr 12, 2017 at 10:52 AM,   wrote:
>
> time.Parse is failing to parse a date generated with time.Format using
> time.UnixDate as layout here (if I use the similar).

Yes, time.UnixDate only really works if you have timezone data on your
system that describes the current time zone.

I suggest using time.RubyDate instead, that should avoid this kind of problem.

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] time.Parse is failing to parse a date generated with time.Format using time.UnixDate as layout on 'empty' timezone

2017-04-12 Thread henriquevicente
Hi,

time.Parse is failing to parse a date generated with time.Format using 
time.UnixDate as layout here (if I use the similar).

I have not ditched so much in the code, but it appears it is considering 
the timezone to be "" and trying to use the -03 value as offset (see 
example below). And I am also not sure if this is an issue with golang, my 
system, or just working as intended due to layout limitations.

$ date
Wed Apr 12 14:47:09 -03 2017
# if I change my timezone to, say, PST, it would show something like "Wed 
Apr 12 10:47:09 PST 2017"

$ go run time.go
current: Wed Apr 12 14:49:20 -03 2017
parsed: 0001-01-01 00:00:00 + UTC, err = parsing time "Wed Apr 12 
14:49:20 -03 2017" as "Mon Jan _2 15:04:05 MST 2006": cannot parse "-03 
2017" as "MST"

$ cat time.go
package main

import (
"fmt"
"time"
)

func main() {
var t = time.Now().Format(time.UnixDate)
fmt.Printf("current: %v\n", t)
var parsed, err = time.Parse(time.UnixDate, t)

fmt.Printf("parsed: %v, err = %v\n", parsed, err)
}


Since my last operating system update (macOS 10.12.4 (16E195)) my system 
timestamp is returning as '-03' as you can see in
https://gist.github.com/henvic/88b205389994bafb32b10961d1ddad2a

You can see this video I made showing what happens in practice:
https://cl.ly/0o3V1b0o3p0P/timezone-issue.gif

-- 
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] Clearer float parsing API

2017-04-12 Thread Andrew Pennebaker
Could we separate ParseFloat() into distinct signatures for the 
corresponding float widths? Parsing a 32-bit float shouldn't be returned as 
a 64-bit float :/

-- 
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] Re: [video] Golang's Realtime Garbage Collector

2017-04-12 Thread mhhcbon
hi,

it was very interesting and awesome!

thanks a lot for the sharing.

On Wednesday, April 12, 2017 at 3:50:08 PM UTC+2, Will Sewell wrote:
>
> My colleague Jim, and I, presented this video on Go's realtime GC at The 
> Realtime Guild in London. In the first half of the talk, Jim steps through 
> an animation of the tricolor mark and sweep algorithm. In the second half I 
> explain a benchmark we created to measure worst case pause times and look 
> at how the results compare to other languages.
>
> You can watch the video here: 
> https://pusher.com/sessions/meetup/the-realtime-guild/golangs-realtime-garbage-collector
>
> It's based on a blog post that we wrote a few months back which might also 
> be of interest: 
> https://making.pusher.com/golangs-real-time-gc-in-theory-and-practice/
>
> I hope you enjoy watching it!
>

-- 
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] Re: [ANN] Darwin/ARM (aka. iOS) port of Go is READY

2017-04-12 Thread mhhcbon
Hi,

It look awesome!

I d like very much to give it a try, can you clarify the procedure please ?
I was tempted to run this https://bitbucket.org/minux/goios/wiki/Home
through vagrant and post the result. But seems outdated ?

On Friday, January 6, 2012 at 10:05:34 PM UTC+1, minux wrote:
>
> Hi all,
>
>  I'm glad to announce that the Darwin/ARM port has just passed *ALL* 
> tests. It's ready to be 
> merged. I'm here to welcome anyone interested to test/use it.
>
>  I've got an iOS toolchain on Linux built, so you don't have to build 
> it on iDevice or Mac OS X
> any more. You can build the full set of packages and Go compiler for iOS 
> on your Linux box.
> Only testing requires a jailbroken iDevice.
>
>  Code is hosted at: https://bitbucket.org/minux/goios/ . You might 
> want to read the wiki  for 
> building
> and testing instructions.
>
>
> Best regards,
> minux
>

-- 
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] Re: [ANN] Enhanced Markdown template processor(emd): helper to generate README file

2017-04-12 Thread mhhcbon
Hi,

I wanted to announce this update of emd

Several updates summarized here,
https://github.com/mh-cbon/emd/releases/tag/0.0.9-beta

Its a beta because you might be debugging few small corner cases parsing 
issues, sorry >.<

You can check the newly resulting md https://github.com/mh-cbon/emd#emd
made with this template 
https://github.com/mh-cbon/emd/blob/master/README.e.md

Note, there are 2 template funcs deprecated, but not removed, please 
update, so they can be cleaned in future.


On Wednesday, February 22, 2017 at 10:40:27 PM UTC+1, mhh...@gmail.com 
wrote:
>
> Hi,
>
> I made this package to spare me some efforts 
> while maintaining README files of my projects.
>
> Its a binary written in go which take advantages
> of text/template to allow dynamic generation
> of the README file with help of
>  some fine grained helpers.
>
> Just check the README file of the project 
> and compare it with the e.md file 
> 
> I created for this project.
>
> With help of emd, now i can invoke 
>emd gen -out README.md
> to generate an updated version of the README file 
> (for most of what is doable to automate).
>
> Find the list of helpers here 
> 
>
> I think its a good companion with godoc, 
> each other being strong in the companion weaknesses.
> godoc is better for structured text for api documentation,
> markdown is better at loosely structured text.
>
> Find the repo at https://github.com/mh-cbon/emd
>
> That s it!
>

-- 
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] Re: Problem compiling go from source code in Alpine Linux powerpc64

2017-04-12 Thread Dave Cheney
This is the procedure I've used to bootstrap the toolchain on a platform 
that is not supported by Go 1.4

https://dave.cheney.net/2015/10/16/bootstrapping-go-1-5-on-non-intel-platforms

On Thursday, 13 April 2017 00:03:56 UTC+10, Roberto Oliveira wrote:
>
> I did what you suggested.
>
> I cross compiled a helloworld.go in Alpine Linux x86_64 (env GOOS=linux 
> GOARCH=ppc64le go build helloworld.go), scp the binary to an Alpine Linux 
> ppc64le and I run it, the binary run fine.
>

-- 
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] Re: Problem compiling go from source code in Alpine Linux powerpc64

2017-04-12 Thread Roberto Oliveira
I did what you suggested.

I cross compiled a helloworld.go in Alpine Linux x86_64 (env GOOS=linux 
GOARCH=ppc64le go build helloworld.go), scp the binary to an Alpine Linux 
ppc64le and I run it, the binary run fine.

-- 
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] [video] Golang's Realtime Garbage Collector

2017-04-12 Thread Will Sewell
My colleague Jim, and I, presented this video on Go's realtime GC at The 
Realtime Guild in London. In the first half of the talk, Jim steps through 
an animation of the tricolor mark and sweep algorithm. In the second half I 
explain a benchmark we created to measure worst case pause times and look 
at how the results compare to other languages.

You can watch the video 
here: 
https://pusher.com/sessions/meetup/the-realtime-guild/golangs-realtime-garbage-collector

It's based on a blog post that we wrote a few months back which might also 
be of 
interest: https://making.pusher.com/golangs-real-time-gc-in-theory-and-practice/

I hope you enjoy watching it!

-- 
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] Re: [ANN] Darwin/ARM (aka. iOS) port of Go is READY

2017-04-12 Thread fastfading
Hi Minx 
It is go 1.8 now. how to build arm/darwin on macos ?  Is the wiki still 
workable since go 1.5 has a great change .
How to go build with cgo arm/darwin static/dynamic c lib for ios and 
android ?
Yes I need* c lib* , not gomobile framwork/aar file.
Could u give a tutorial ?
There is little doc on google. And this cross compile always fail for me 
for weeks.



在 2012年1月7日星期六 UTC+8上午5:05:34,minux写道:
>
> Hi all,
>
>  I'm glad to announce that the Darwin/ARM port has just passed *ALL* 
> tests. It's ready to be 
> merged. I'm here to welcome anyone interested to test/use it.
>
>  I've got an iOS toolchain on Linux built, so you don't have to build 
> it on iDevice or Mac OS X
> any more. You can build the full set of packages and Go compiler for iOS 
> on your Linux box.
> Only testing requires a jailbroken iDevice.
>
>  Code is hosted at: https://bitbucket.org/minux/goios/ . You might 
> want to read the wiki  for 
> building
> and testing instructions.
>
>
> Best regards,
> minux
>

-- 
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] [tour] What about changing the icon to report an issue on Github?

2017-04-12 Thread Alessandro Baffa
Hello,

there are a lot of issues of type "tour: [REPLACE WITH SHORT DESCRIPTION]" on 
Github that have been - I guess - opened by mistake. I guess people just 
want to try the small *bizarre-looking* icon on the top right and then they 
get confused on Github and create an actual issue. At the moment there are 
28 opened issue which could be closed. 

What about changing the icon into something more clear like a text "*Open 
an issue on Github*", or something like that, so to increase the usability 
of the Tour on this particular feature?

Any feedback is very welcome :)

Thank you!
Alessandro

-- 
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] Re: Write a program for Linux in Go lang which can run any command (of coder's choice) on another machine (privately or publicly accessible) and prints its output.

2017-04-12 Thread Rich
Let me get you pointed in the right direction. I do this ALL the time. 
First it to learn the Godoc site. Godoc is an awesome site that you can 
search for different community written extensions to go, as well as get 
documentation on the existing go language packages -- if you're going to 
write in go, godoc.org is your best friend. https://www.godoc.org. once 
there search for a tool called 'gexpect' by ThomasRooney.  This will allow 
you to control an ssh session by any user to any system that user has 
access to.  Another way is to use the built in os/exec: cmd := exec.Command(
"/usr/bin/ssh", "-oStrictHostKeyChecking=no", cHost, cHostCmd)

 To get the user's input use fmt.Scanln.  

fmt.Printf("Remote Host: ")
cHost:=fmt.Scanln("\n")
fmt.Printf("Command: ")
cHostCmd:= fmt.Scanln("\n")

On Monday, April 10, 2017 at 6:42:32 PM UTC-4, Owais Hashmi wrote:
>
> Write a program for Linux in Go lang which can run any command (of coder's 
> choice) on another machine (privately or publicly accessible) and prints 
> its output.
>

-- 
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 to distinguish a interface{} from a real type value?

2017-04-12 Thread xjdrew
Got your idea, 3x.

On Tuesday, April 11, 2017 at 5:41:43 PM UTC+8, Jakob Borg wrote:
>
> The int gets boxed into an interface{} as part of the function call, 
> making it equivalent to the other interface{} passed. However: 
>
> https://play.golang.org/p/uxFkrMa_cD 
>
> > On 11 Apr 2017, at 11:32, xjdrew  
> wrote: 
> > 
> > package main 
> > 
> > import ( 
> > "reflect" 
> > ) 
> > 
> > func main() { 
> > var a interface{} 
> > a = 5 
> > b := 5 
> >  
> > println(a == b) 
> > println(reflect.TypeOf(a) == reflect.TypeOf(b)) 
> > } 
> > 
> > As the above code show, a is a interface{} associated with a int value, 
> b is int, how can I point out the difference of their type? 
> > 
> > play ground: https://play.golang.org/p/hpbHWLjnms 
> > 
> > 
> > -- 
> > 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...@googlegroups.com . 
> > For more options, visit https://groups.google.com/d/optout. 
>
>

-- 
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] Re: Generate static library written in golang

2017-04-12 Thread hui zhang
I am using go1.8   arm/ darwin not work ,  for both bin and archive .how 
 to solve that

 GOOS=darwin GOARCH=arm GOARM=7  go build -buildmode=c-archive -o libmug.a
> can't load package: package .: no buildable Go source files in 
>
> GOOS=darwin GOARCH=arm  go build -v -o hello.ios main.go
> runtime/internal/sys
> runtime/internal/atomic
> runtime
> math
> command-line-arguments
> # command-line-arguments
> warning: unable to find runtime/cgo.a
> /usr/local/Cellar/go/1.8.1/libexec/pkg/tool/darwin_amd64/link: running 
> clang failed: exit status 1
> ld: warning: ignoring file 
> /var/folders/cp/561_gl9j1wzd8dgv_fn5mk7cgn/T/go-link-691505992/go.o, 
> file was built for armv7 which is not the architecture being linked 
> (x86_64): 
> /var/folders/cp/561_gl9j1wzd8dgv_fn5mk7cgn/T/go-link-691505992/go.o
> Undefined symbols for architecture x86_64:
>   "_main", referenced from:
>  implicit entry/start for main executable
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see 
> invocation)


在 2015年6月3日星期三 UTC+8下午8:34:38,Sarim Khan写道:
>
> Hello,
>
> go version go1.4 darwin/amd64
>
> I'm trying to create a static library written in golang, then using that 
> static library in a c/obj/xcode project. 
>
> == gittu.go ==
>
> package gittu
>
> import "C"
>
> //export getGittu
> func getGittu() *C.char {
> s := "Hello Gittu"
> return C.CString(s)
> }
>
> ==
>
> After that i use "go install" to generate a gittu.a in 
> $GOPATH/pkg/darwin_amd64/..
>
> But when i include that gittu.a in xcode, i get this error,
>
> ignoring file /usr/local/Cellar/go/1.4/packages/pkg/darwin_amd64/
> github.com/sarim/gittu.a, file was built for archive which is not the 
> architecture being linked (x86_64)
>
> I manually tried to run cc, but still the same error. Any idea how to 
> generate x86_64 static lib?
>

-- 
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.