Re: [go-nuts] insane idea to eliminate CGO latency

2021-03-14 Thread Elias Naur
On Sun Mar 14, 2021 at 13:03, Jan Mercl wrote:
> On Sun, Mar 14, 2021 at 12:57 PM Elias Naur  wrote:
>
> > > Eg. if you really need to hook at battle-tested C code that needs no 
> > > further maintenance, you may try  https://github.com/minio/c2goasm
> > > It lets you bootstrap fast, then you may aim at a proper rewrite.
> > >
> >
> > A rewrite is one thing, maintenance is another. Do you have the
> > resources to match those poured into SQLite or Harfbuzz?
>
> Harfbuzz is C++ so until someone helps with converting it into pure C
> it's off limits to ccgo. But it can handle SQLite already:
> https://pkg.go.dev/modernc.org/sqlite. Passing more than 900k Tcl
> tests that SQLite includes.

Indeed, I didn't mean to ignore ccgo. My point was aimed at the "then
you may aim at a proper rewrite" part which seems to argue that
rewriting is always the better approach.

Elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/C9X2NM4AAJ4C.3UHAPTBAIMZQY%40themachine.


Re: [go-nuts] insane idea to eliminate CGO latency

2021-03-14 Thread Elias Naur
On Sun Mar 14, 2021 at 12:30, Wojciech S. Czarnecki wrote:
> On Sat, 13 Mar 2021 22:57:11 -0800 (PST)
> "Jason E. Aten"  wrote:
>
> > Iminimize the cost of crossing the CGO barrier from Go code into C code and 
> > back.
>
> I personally regard this cost as godsend ;) It incentivises us to rewrite C 
> codebases into proper Go.
>

Rewriting (and maintaining!) mature and well-maintained libraries is 
impractical.
Rewriting platform-bound APIs (OpenGL, Cocoa) is impossible.

> > How crazy is this? :)
>
> There are more "crazy" solutions that actually work:
>
> Eg. if you really need to hook at battle-tested C code that needs no further 
> maintenance, you may try  https://github.com/minio/c2goasm 
> It lets you bootstrap fast, then you may aim at a proper rewrite.
>  

A rewrite is one thing, maintenance is another. Do you have the
resources to match those poured into SQLite or Harfbuzz?

Elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/C9X204WR6MT1.6XVL4AY3M8RX%40themachine.


Re: [go-nuts] Re: Link Go againsta a static 32 bit 3rd party library

2021-02-21 Thread Elias Naur
On Sun, Feb 21, 2021, 22:03 Luis Furquim  wrote:

> Great! It works!
> May I post your answer (also giving the credits) on stack overflow?
>


Sure. No credit necessary, you're doing the work of posting it :)

Elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMAFT9V%3D7aTaHZ-jLTcjZQVkA-wix1mJ6iC-AUaxkjKVzNoVTQ%40mail.gmail.com.


Re: [go-nuts] Re: [ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

2020-04-28 Thread Elias Naur
On Tue, Apr 28, 2020 at 3:23 PM Fino  wrote:
>
> hello Elias,
>
> as far as I understand, GIO is a 2D GUI lib, maybe similar with Flutter,
>
> is it possible to embed one/multi 3D widget inside a view/window?
>
> any architecture thinking on such requirement?
>

The other way around is possible: embedding Gio into a program that uses
the GPU. See the "glfw" example:

https://git.sr.ht/~eliasnaur/gio/tree/master/example/glfw/main.go

-- elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMAFT9Ud%3DLy9Gr8ES%3DiWx5w7ap-wEkWWmKQAfomn-RXAsPvy4A%40mail.gmail.com.


Re: [go-nuts] Re: [ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

2020-04-18 Thread Elias Naur
On Fri Apr 17, 2020 at 6:38 PM,  wrote:
>
> Thank you for your Contribution to ease the gioui.
> Following link you mentioned for installation in your read file
>
> https://man.sr.ht/~eliasnaur/gio/install.md
>
> does not working now.
>
> Please explain me how to install goui.
> Thank you again.
>

Hi,

The website for Gio is gioui.org, which should contain enough
information for you to get started.

-- elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/C2463TEF5HQW.29AKNX1DTVCB9%40testmac.


Re: [go-nuts] Re: [ANN] Unik, a Go unikernel capable of running Gio GUI programs

2020-04-14 Thread Elias Naur
On Mon Apr 13, 2020 at 2:06 PM, Brian Candler wrote:
> --=_Part_1452_1022817720.1586811991060
> Content-Type: text/plain; charset="UTF-8"
>
> On Monday, 13 April 2020 19:42:17 UTC+1, Elias Naur wrote:
> >
> > The project is an experiment in a larger exploration of the question: 
> > "what if the operating
> > system process abstraction were a virtual machine?
> >
>
> Interesting.
>
> BTW, have you seen gVisor <https://gvisor.dev/docs/>? It takes a
> different
> approach to the problem: emulating the syscall interface on top of a
> running kernel, rather than on top of (real or emulated) bare metal. I
> was
> reminded of it since it also "pretends to be a Linux kernel" - and is
> written in Go.
>

Yes. gVisor is similar in many ways and I hope to re-use parts of it, 
for example their Go network stack implementation.

The main difference is that I want to avoid the Linux kernel, or any
kernel for that matter.

-- elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/C20QS8H4213C.1OAOJM5YTMD39%40testmac.


Re: [go-nuts] Re: [ANN] Unik, a Go unikernel capable of running Gio GUI programs

2020-04-14 Thread Elias Naur
On Mon Apr 13, 2020 at 4:15 PM, Michael Jones wrote:
> IBM VM/370 and much that followed is exactly this “VM is a hardware
> abstraction” line of reasoning. Logging into a user session was to
> “IPL a
> machine.” (Initial Program Load, imagine an IBM PC bios screen rushing
> by)
>

Exactly. It was embarrassing to re-discover the virtues of past
computing.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/C20QQ3IV1QC8.PVF27OVZTWMF%40testmac.


[go-nuts] [ANN] Unik, a Go unikernel capable of running Gio GUI programs

2020-04-13 Thread Elias Naur
Hi,

I just completed the proof-of-concept for a Go unikernel, Unik, which 
allows Go programs
to run without an operating system directly in virtual machines. Unlike 
similar projects
Unik is written in Go (and assembler), and it is compiled into Go programs 
just like any other
Go dependency. Unik does includes a UEFI bootloader written in C.

The source code is open sourced at

https://eliasnaur.com/unik

along with a demo that demonstrates a funtional Gio GUI program (GPU+mouse 
works, I ran
out of time to implement a keyboard driver).

The project is an experiment in a larger exploration of the question: "what 
if the operating
system process abstraction were a virtual machine? It's also a response to 
my failed attempt
to get unikernel support into upstream Go project 
(https://github.com/golang/go/issues/35956);
Unik pretends to be a Linux kernel, implementing enough system calls to 
fool the Go runtime.

-- elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6dd3a14e-484c-41f1-996b-d45dd1502742%40googlegroups.com.


Re: [go-nuts] Re: [ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

2020-03-12 Thread Elias Naur
On Thu, Mar 12, 2020 at 6:03 PM husam alkdary  wrote:
>
> where I can find a simple examples of GIO with golang so I can try it
>

There are 4 examples here:

https://git.sr.ht/~eliasnaur/gio/tree/master/example

You can run them from a Go module with `go run`. For example:

$ go run gioui.org/example/kitchen

For a primer of the unusual stateless approach to GUI programming, see the
article

https://eliasnaur.com/blog/immediate-mode-gui-programming

-- elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMAFT9U5N4sSmRpcd2cYzu6UWALKzqqmz-YN%3DyOvVifMPxmMHQ%40mail.gmail.com.


Re: [go-nuts] Re: [ANN] Renderview v0.1.0 with go mod, Gio, and Fyne support

2020-02-27 Thread Elias Naur
On Mon, Feb 24, 2020 at 9:36 AM Elias Naur  wrote:

>> For example, with Gio, I had to download a set of .DLL files and extract 
>> them into the root folder of my Go build, as documented on the Gio website.
>
>
> I happen to be working on a direct3d port of Gio which I hope to have ready 
> within this week, in which case the 3 opengl DLLs are no longer needed. You 
> can follow the work at https://git.sr.ht/~eliasnaur/gio/log/d3d11.
>

Direct3D is now done, which should eliminate the dependency on OpenGL
emulation DLLs.

-- elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMAFT9XJKG3Oq0CCPHQVx6HGYnB%3D6Y5%2BdtrJWQyKRiFcRq-gSg%40mail.gmail.com.


Re: [go-nuts] Re: [ANN] Renderview v0.1.0 with go mod, Gio, and Fyne support

2020-02-26 Thread Elias Naur
On Tue Feb 25, 2020 at 3:21 PM,  wrote:
> I worked it out, will update the programs later. It was not that the
> events
> were missing - once I enabled the good old Printf debugger, I saw that
> the
> events are flowing fine. The issue is that on Linux, every Move Mouse
> event
> reflected what buttons were pressed the entire time they were pressed.
> On
> Windows, only the Press Mouse event included a value for the Button that
> was pressed (i.e. pointer.ButtonLeft).
>

That's a bug, now fixed with


https://git.sr.ht/~eliasnaur/gio/commit/e3f8d1a1afb27213f5e4c2e0b161e76d69778ff3

Thanks for finding it!

-- elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/C0W07JWK2MY0.OTB79OIYI1FI%40testmac.


[go-nuts] Re: [ANN] Renderview v0.1.0 with go mod, Gio, and Fyne support

2020-02-24 Thread Elias Naur


On Saturday, February 22, 2020 at 5:00:33 AM UTC+1, howar...@gmail.com 
wrote:
>
>
> I have updated it to support go modules, and added support for the 
> recently appearing Gio and Fyne GUI toolkits. They are both operational, if 
> a bit oddly. I tested Gio on Windows yesterday when I had a chance, and it 
> did build, but for some reason, did not respond to mouse movements, only 
> mouse scrolling, and I have not resolved that issue yet.
>
>
I would love to figure out what causes the missing mouse events on Windows. 
To not derail this thread, please do file an issue on gioui.org/issue/, 
join #gioui on the gophers.slack.com channel, or write me directly at 
m...@eliasnaur.com.

FWIW, I ran the renderview/cmd/cmdgui program on Windows 10 which showed me 
a bunch of editable fields, all clickable.
 

> So now, in addition to serving as a quick and dirty tool for exercising 
> your image generating or algorithm visualizing code, the code-base itself 
> serves as a comparative implementation of the same task in Shiny,  go-gtk, 
> GoTK3, Gio, and Fyne.
>
>
Nice.
 

> As far as Windows goes, the Shiny backend works fine to draw a pannable, 
> zoomable image with Renderview on Windows, and as far as I am aware, 
> requires no further dependencies. But there is still not an editable text 
> widget in Shiny, and while I was able to find a third-party multi-line text 
> editor, I was not able to find a single-line one suitable for using as a 
> generic data entry field. 
>

Have you seen https://github.com/aarzilli/nucular? I believe it has a Shiny 
backend.

For example, with Gio, I had to download a set of .DLL files and extract 
> them into the root folder of my Go build, as documented on the Gio website.
>

I happen to be working on a direct3d port of Gio which I hope to have ready 
within this week, in which case the 3 opengl DLLs are no longer needed. You 
can follow the work at https://git.sr.ht/~eliasnaur/gio/log/d3d11.

-- elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/3b77319e-780e-4496-b691-bd77e08b8c1d%40googlegroups.com.


[go-nuts] Re: wasm - Browser gets stuck due memory usage

2019-11-10 Thread Elias Naur
Possible duplicate of https://github.com/golang/go/issues/35111 (garbage 
collection of js.Value references)
which was recently fixed.

Please try with gotip (https://godoc.org/golang.org/dl/gotip) or build from 
source. Note that the fix for #35111
made js.Value equality tests a compile time error, so you might need to 
update your code to use the new
IsNull, IsUndefined, Equal, IsNaN.

-- elias

On Sunday, November 10, 2019 at 11:12:14 AM UTC+1, mihai barbulescu wrote:
>
> I'm trying to build a web/client app using Go (compiled to wasm). The 
> issue is that the browser(both FF and Chrome) gets stuck(i.e and I get a 
> notice "A page is slowing your browser | Stop it | Wait" ) shortly after 
> some minimal interaction (initial page is loaded and a form is processed).
> I took a Memory sample using firefox developer tools(see the print-screen) 
> but I can't find what exactly the culprit. Any idea what could cause it or  
> how to better debug it? Most of the memory seems to go into 
> runtime.ScheduleTimeoutEvent. 
> The program is built using Go tip. 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/7d7f869b-6700-48c2-be57-659b73432d63%40googlegroups.com.


Re: [go-nuts] micro review and hello gio: portable GUI code, all in Go

2019-10-04 Thread Elias Naur


> FYI, Elias gave a talk about this project at Gophercon: 
> https://www.youtube.com/watch?v=9D6eWP4peYM . 
>
> Ian 
>

And another at Gophercon UK:
https://www.youtube.com/watch?v=PxnL3-Sex3o

And there will be another (+workshop) at GoLab later this month :)

Thank you for the glowing (micro) review, Jason! It
warms my heart to know my work is appreciated.

You're also spot on: I want to see Go turn into a great
(or even preferred) choice for GUI programs and games.

-- elias.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/0854d8dc-1756-4bce-83ab-5477343cdbf4%40googlegroups.com.


Re: [go-nuts] Re: x/mobile: Samples for reverse binding in gomobile

2019-09-12 Thread Elias Naur
On Thu Sep 12, 2019 at 2:35 AM Jay Sharma wrote:
> 
> *Hello Elias,*
> 
> *Following is my java file: *
> 
> 
> package reversebinding;
> 
> public class RBinding {
>  public static String getStringFromJava() {
> return "Hello from java !!";
> }
> }
> 
> 
> 

Your Java method is declared as "static"; static methods are exported as
regular functions in reverse bindings. Remove "static" and you might have
better luck calling it.

> 
> *I tried the following in my go file : *
> 
> 
> 
> import "Java/reversebinding/RBinding"
> 
> 
> // creating object like this: 
> 
> javaObj := JavaAPI.New()
> javaObj.GetStringFromJava()
> 
> *But while building using the gomobile it is giving following error: *
> JavaObj.GetStringFromJava undefined (type Java.Reversebinding_JavaAPI has 
> no field or method GetStringFromJava)
> undefined: val
> 
> 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/BWXZ06VB2ULU.2HUEH0Y162LFV%40toolbox.


Re: [go-nuts] Re: x/mobile: Samples for reverse binding in gomobile

2019-09-11 Thread Elias Naur
On Wed Sep 11, 2019 at 7:20 AM Jay Sharma wrote:
> 
> 
> *Now, I want to create object of this class in go and want to call method 
> using that object from go. *
> 
> I was checking your proposal (https://github.com/golang/go/issues/16876) 
> but could not able to make it. :(

The proposal suggests calling the generated New method on the object.
Did you try that? If so, what went wrong?

-- elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/BWXAZ4Z6L5WG.6AV43I4ZQQCC%40testmac.


Re: [go-nuts] Re: x/mobile: Samples for reverse binding in gomobile

2019-09-11 Thread Elias Naur
On Wed Sep 11, 2019 at 3:51 AM Jay Sharma wrote:
> 
> 
> I have one doubt when we build using gomobile in that I am giving the 
> classpath to my .class java file. 
> *Will it be included in .aar or I have to include that .class file along 
> with .aar in my android application. *
> 

The class file is not automatically included, that wasn't clear from my earlier
reply. Please include the class file in your project and try my suggestion to
call your code from Java.

-- elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/BWX4HNJBFFHC.1LTPFNFL2HB48%40themachine.


Re: [go-nuts] Re: x/mobile: Samples for reverse binding in gomobile

2019-09-10 Thread Elias Naur
On Tue Sep 10, 2019 at 4:26 AM Jay Sharma wrote:
> --=_Part_1258_983331168.1568114760099
> Content-Type: text/plain; charset="UTF-8"
> 
> Hello @elias,
> 
> I tried the following:
> 
> 1. Created a java class : 
> 
> package reversebinding;
> 
> public class RBinding {
>  public static String getStringFromJava() {
> return "Hello from java !!";
> }
> }
> 
> 2. Generated the .class file for this file. 
> 
> 3. Generated the android binding using gomobile tool and used 
> -classpath="Path to my .class file"
> 
> 4. Binding is generated successfully. 
> 
> *But when I used that generated (.aar) file in my android app and tried to 
> trigger the api it is crashing; *
> 
> 2019-09-10 16:36:54.199 9400-9430/com.sample  E/GoLog: 2019/09/10 11:06:54 
> test.go:134: testFunction [Test]
> 2019-09-10 16:36:54.199 9400-9430/com.sample  E/GoLog: 2019/09/10 11:06:54 
> test.go:136: [Test] Now going to call a java system function 
> (System.CurrentTimeMillis()).
> 2019-09-10 16:36:54.200 9400-9434/com.sample  E/GoLog: 2019/09/10 11:06:54 
> test.go:138: [Test] Called java function return value is:  1568113614199
> 2019-09-10 16:36:54.200 9400-9434/com.sample  E/GoLog: 2019/09/10 11:06:54 
> test.go:140: [Test] Now going to call my java function.
> 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: panic: runtime error: 
> invalid memory address or nil pointer dereference
> 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: [signal SIGSEGV: 
> segmentation violation code=0x1 addr=0x0 pc=0x7568010708]
> 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: goroutine 17 [running, 
> locked to thread]:
> 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: 
> test.testFunction(0x400738)
> 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: 
> /home/test/2019/test/test.go:141 +0x190
> 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: 
> main.proxytest__testFunction(...)
> 2019-09-10 16:36:54.203 9400-0/com.sample com.sample E/Go: 
> /tmp/gomobile-work-071468276/src/gobind/go_testmain.go:199
> 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: 
> main._cgoexpwrap_5427a26f9204_proxytest__testFunction(0x8020080280200802)
> 2019-09-10 16:36:54.203 9400-0/com.sample  E/Go: _cgo_gotypes.go:606 
> +0x1c
> 2019-09-10 16:36:54.204 9400-9423/com.sample  A/libc: Fatal signal 6 
> (SIGABRT), code -6 in tid 9423 (Thread-2)
> 

The error is arguably not very helpful. Are you sure there is not another error
before the nil pointer exception? In any case, did you ensure that the .class
is included in the Android apk? An easy check is to try to call your method
from Java before trying from Go.

-- elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/BWWFDRSGTVCY.3RJOHGGDYAVUF%40toolbox.


Re: [go-nuts] Re: x/mobile: Samples for reverse binding in gomobile

2019-09-09 Thread Elias Naur
On Mon Sep 9, 2019 at 3:09 AM Jay Sharma wrote:
> 
> *Next I want to try with my own classes in java.. I want to define class 
> and call it from go. *
> *Can you please suggest, in that case how to build with gomobile ?*
> 

I think you can use the -classpath option to gomobile.

-- elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/BWVGLNVRYFPP.2S3AHD3ABK0VZ%40toolbox.


[go-nuts] Re: x/mobile: Samples for reverse binding in gomobile

2019-09-06 Thread Elias Naur


fredag den 6. september 2019 kl. 13.29.33 UTC+2 skrev Jay Sharma:
>
> Hello All,
>
> *I can not see any samples for reverse binding (Calling function from go 
> layer of java layer) in gomobile.*
>
>
>
There is the original proposal:

https://github.com/golang/go/issues/16876

There is also some example code in

https://github.com/golang/mobile/blob/master/bind/testdata/classes.go

-- elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/5f00b73e-eb21-4076-8508-6df651245519%40googlegroups.com.


Re: [go-nuts] Re: [ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

2019-09-05 Thread Elias Naur
> 
> Hi, I wanted to try gio this week, and after a lot of work getting 
> kde-plasma v5.14.3 working on Wayland (Funtoo x86_64), I now have hit the 
> same issue here:
> 
> https://git.sr.ht/~eliasnaur/gio/tree/master/ui/app/os_wayland.go#L1134
> 
> "wayland: no xdg_wm_base available"
> 
> I'm a newbie to Wayland -- what does this mean and what component needs 
> upgrading?
> 

I'm sorry that you had to go through all that work. If its any
consolation, there is progress on the X11 port over at
gioui.org/issue/8.

In the shorter term, I'm not sure why the xdg_wm_base is not available
in your version of Plasma. According to

https://phabricator.kde.org/D13510

and

http://blog.davidedmundson.co.uk/blog/my-month-in-kwinwayland/

"...KWin 5.14 will have support for XDG WM Base..."

the xdg_wm_base extension should be available in the version you run.

Is there a chance you might be running the Weston reference compositor?
Being a reference implementation, it lags behind on the desktop-oriented
features. For example, you need Weston 6.0 to get xdg_wm_base support.

If you can, please post a dump of running a Gio program with
WAYLAND_DEBUG=1 set. That dump should reveal whether it is really your
compositor lacking xdg_wm_base or a Gio bug.

-- elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/BWRYG13XWSEO.J1COPIFVIIYH%40testmac.


[go-nuts] Re: GoMobile tools not recognised

2019-08-28 Thread Elias Naur


søndag den 18. august 2019 kl. 21.27.24 UTC+1 skrev starzar:
>
> On installing Golang mobile tools 
>  on my 
> Windows10-64bit machine,the gomobile tools are not recognised . The 
> installation path is the *GOROOT PATH C:\Go*. 
>
> GolangVersion :- *go1.11.5 windows/amd64* 
>
> Please let me know how to get Golang mobile tools to work
>
>
> PS C:\Go> go get golang.org/x/mobile/cmd/gomobile
> PS C:\Go> gomobile init
> gomobile : The term 'gomobile' is not recognized as the name of a cmdlet, 
> function, script file, or operable program. Check the spelling of the name
> , or if a path was included, verify that the path is correct and try again
> . At line:1 char:2 + gomobile init +  + CategoryInfo : 
> ObjectNotFound: (gomobile:String) [], CommandNotFoundException + 
> FullyQualifiedErrorId : CommandNotFoundException
> PS C:\Go> gomobile version
> gomobile : The term 'gomobile' is not recognized as the name of a cmdlet, 
> function, script file, or operable program. Check the spelling of the name
> , or if a path was included, verify that the path is correct and try again
> . At line:1 char:1 + gomobile version +  + CategoryInfo : 
> ObjectNotFound: (gomobile:String) [], CommandNotFoundException + 
> FullyQualifiedErrorId : CommandNotFoundException
> PS C:\Go> go version 
> go version go1.11.5 windows/amd64
>
>
>

When you install gomobile, its tools go in the %USERPROFILE%\go\bin 
directory. You probably need to add that path to your PATH environment 
variable.

 - elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/bbb9dcf1-e8e4-48e3-88c2-2de7444835bb%40googlegroups.com.


[go-nuts] Re: Replace modules from command line

2019-08-08 Thread Elias Naur


mandag den 5. august 2019 kl. 18.46.01 UTC+2 skrev Peter Feichtinger:
>
> Hi Go Nuts,
>
> I have a rather unusual use case and I'm hoping for some input.
>
> For testing purposes, I want to build a Go binary with different versions 
> of one of its dependencies. The only way I could think of was to modify the 
> go.mod file to add a replace directive with the version I want to test.
> Instead I'd like to avoid having to modify the go.mod file during the 
> build and specify the replacement on the command line instead, but I don't 
> think that's possible.
>
> Do you guys have any ideas on how else I might accomplish overriding a 
> module version during build?
>
>
I don't think it's possible today. There is an issue for it: 
https://github.com/golang/go/issues/26640

 - elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/babd85e2-c5ec-43f4-a301-717719cdefe8%40googlegroups.com.


[go-nuts] Re: Can you spare a Samsung S5 for the Gio project?

2019-07-29 Thread Elias Naur
On Mon, Jul 29, 2019 at 7:15 PM Tanguy ⧓ Herrmann
 wrote:
>
> Mine actually died today, so I can't even reproduce that bug anymore…
> And it was my spare. Waiting for the repair of my S8 meanwhile.
>

Heh. I suppose that's another way to fix the issue: killing all S5s one by one.

 - elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMAFT9VFBs75SUNQKQzW%3DLe5ypfpcJN2AqD15tzenDq7j7O6Mg%40mail.gmail.com.


[go-nuts] Can you spare a Samsung S5 for the Gio project?

2019-07-29 Thread Elias Naur
Hi,

I'm trying to fix a Gio (gioui.org) bug where the rendering is
corrupted on a Samsung S5 (https://todo.sr.ht/~eliasnaur/gio/10). I
can't reproduce it on my own devices, so on the off chance someone has
a spare lying around I would greatly appreciate if you could send it
to me. I'll cover the shipping costs to Denmark.

 - elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMAFT9UjgHz8eyOLE73%2BmjzRFDjU1abMmLqyN_SWUDo2ujkpRA%40mail.gmail.com.


[go-nuts] Re: [ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

2019-06-14 Thread Elias Naur


On Friday, June 14, 2019 at 12:58:40 PM UTC+2, Mark Bauermeister wrote:
>
> Any plans for a Vulkan back-end?
>

When I'm happy with the OpenGL ES backend then yes, Vulkan is the logical 
next step.

 - elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/4325d589-2a7b-4970-a07a-b4158cd1ea25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] [ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

2019-06-11 Thread Elias Naur

>
> And on android, I can delete characters, but not input any (Samsung Galaxy 
>> S8, Android 9)
>>
>>
> Thanks for bringing it up, I've added it to the issue tracker: 
> https://todo.sr.ht/~eliasnaur/gio/7. It's not entirely unexpected; I have 
> only implemented the very basic parts of the Android and iOS text input 
> interfaces.
>
>
That issue should now be resolved. I don't have a Samsung phone myself, but 
the fix worked with the SwiftKey keyboard that had the same symptoms.

 - elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f2d9b9d8-7440-42a9-89ae-685d9418dffa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] [ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

2019-06-06 Thread Elias Naur


On Thursday, 6 June 2019 00:43:22 UTC+2, dol...@gmail.com wrote:
>
> Him
>
> Source Hut actually requires me to create an account to read the mailing 
> list. Hmph.
>

That's surprising. I went to https://lists.sr.ht/~eliasnaur/gio-dev with a 
private browser session and it showed up fine. The "new post" link also 
worked fine (it's just a mailto: URL).
 

> Anyway, I tried to run it on android and web (don't have wayland), and 
> they work!
> It's just weird to interact within a canvas on the web and not get all the 
> niceties of the classic html controls.
>

Indeed. The webassembly/webgl port is intended for easy porting of an 
existing native app, not as a competitor to the web native controls.
 

> And on android, I can delete characters, but not input any (Samsung Galaxy 
> S8, Android 9)
>
>
Thanks for bringing it up, I've added it to the issue tracker: 
https://todo.sr.ht/~eliasnaur/gio/7. It's not entirely unexpected; I have 
only implemented the very basic parts of the Android and iOS text input 
interfaces.

 - elias

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/96a191b0-bc60-4637-a464-c24ba5cc62ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: gomobile genjava duplicate constructor definition

2019-03-18 Thread Elias Naur
On Mon, Mar 18, 2019 at 6:33 PM  wrote:
>
> Elias, thank you for the prompt response and submitting a fix.
>
> I have checked this out, and though it does result in successful compilation, 
> it does not solve my problem because the public constructor is removed 
> allowing me no initializer access from the application side. I had attempted 
> to fix this issue by removing the constructor before because it is not used 
> internally.
>

I see. I think it's possible to keep your constructors by not using
constructors for the internal initialization of proxy objects.
However, that's a bigger change so I kept the fix small by skipping
the offending constructor.

Perhaps you could use Go "int" types for your constructors instead of
"int32". I believe that will generate a non-clashing constructor that
takes a Java long instead of an Java int.

 - elias

-- 
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] Re: OpenAL and microphone on macos using the mobile pkg

2019-03-08 Thread Elias Naur
On Thu, Mar 7, 2019 at 11:11 PM whitehexagon via golang-nuts
 wrote:
>
> Thanks! That got me some steps further down the rabbit hole :)
>
> gomobile: the Android requires the golang.org/x/mobile/exp/audio/al, but the 
> OpenAL libraries was not found. Please run gomobile init with the -openal 
> flag pointing to an OpenAL source directory.
>
> So first I tried 'brew reinstall --build-from-source openal-soft'  but there 
> were still no sources in that directory (although everything built fine).
>
> Next I located the downloaded brew .bz2 file, which was located in: 
> '~/Library/Caches/Homebrew' and using a symlink of 
> 'openal-soft--1.19.1.tar.bz2'
>
> Manually unpacking that, and then running a new gomobile init pointing to 
> that directory got me some distance further before sadly failing.
>
> [  2%] Building C object CMakeFiles/common.dir/common/alcomplex.c.o
> In file included from /Users/me/openal-soft-1.19.1/common/alcomplex.c:5:
> /Users/me/openal-soft-1.19.1/common/math_defs.h:36:21: error: static 
> declaration of 'log2f' follows non-static declaration
> static inline float log2f(float f)
> ^
> /Users/me/go/pkg/gomobile/ndk-toolchains/arm/bin/../sysroot/usr/local/include/math.h:38:15:
>  note: previous declaration is here
> float log2f(float);
>
> Is there anyway to bypass this step of having to rebuild OpenAL?
>
>

I don't think there's a way around it, unfortunately. As far as I
know, there are no prebuilt openal libraries for Android available.

I'm not even sure openal builds with a recent NDK where gcc is gone
and replaced with clang.

 - elias

-- 
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] Re: gomobile: what's the right way to make widgets?

2018-11-11 Thread Elias Naur
søn. 11. nov. 2018 14.48 skrev komuW :

> Do you plan on making that UI library public(open source or not) at some
> point?
>

Yes. As soon as I'm happy with the API I'll release it under a very liberal
licence, perhaps even unlicenced.


> On Monday, 29 October 2018 16:51:02 UTC+3, Elias Naur wrote:
>>
>>
>>
>> On Monday, October 29, 2018 at 11:48:06 AM UTC+1, Laurent Moussault wrote:
>>>
>>>
>>> IMHO there is vacuum right-now, an opportunity for a native framework
>>> that allows the same design freedom as web interfaces, but implemented
>>> directly on top of the OSes (and Vulkan, probably). I think something like
>>> flutter, but implemented in a more mainstream language (and supporting the
>>> desktop), would have a shot at success. A GUI framework that does not come
>>> with a complete set of ready-to-use widgets and containers (as in
>>> traditional native UIs), but allows to easily design custom ones, with
>>> beautiful layouts. This is, obviously, a huge amount of work...
>>>
>>>
>> I'm glad you think that; I happen to be working on such an UI library :)
>> Its core is 100% Go, and it only uses Cgo for the necessary integration
>> with the low level OS primitives, input, window management and GPU access
>> (OpenGL ES for now). My library is also inspired by Flutter: it took a lot
>> of work to get into a usable state, but is now very portable and flexible.
>> My other inspiration is imgui: I hope that getting rid of the implicit
>> widget hierarchy will result in UI programs that are much easier to
>> maintain and keep bug free.
>>
>>  - elias
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/4JF_G7qYBDg/unsubscribe.
> To unsubscribe from this group and all its topics, 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.


[go-nuts] Re: gomobile: what's the right way to make widgets?

2018-10-29 Thread Elias Naur


On Monday, October 29, 2018 at 11:48:06 AM UTC+1, Laurent Moussault wrote:
>
>
> IMHO there is vacuum right-now, an opportunity for a native framework that 
> allows the same design freedom as web interfaces, but implemented directly 
> on top of the OSes (and Vulkan, probably). I think something like flutter, 
> but implemented in a more mainstream language (and supporting the desktop), 
> would have a shot at success. A GUI framework that does not come with a 
> complete set of ready-to-use widgets and containers (as in traditional 
> native UIs), but allows to easily design custom ones, with beautiful 
> layouts. This is, obviously, a huge amount of work...
>
>
I'm glad you think that; I happen to be working on such an UI library :) 
Its core is 100% Go, and it only uses Cgo for the necessary integration 
with the low level OS primitives, input, window management and GPU access 
(OpenGL ES for now). My library is also inspired by Flutter: it took a lot 
of work to get into a usable state, but is now very portable and flexible. 
My other inspiration is imgui: I hope that getting rid of the implicit  
widget hierarchy will result in UI programs that are much easier to 
maintain and keep bug free.

 - elias

-- 
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: [gomobile] How to generate reverse-bindings for Java without the gradle-plugin?

2018-10-19 Thread Elias Naur
You're not using the imports. To avoid generating for the entire Android 
API, the reverse generator only generates bindings referenced by your code. 
For examples, see golang.org/x/mobile/bind/testdata/testpkg/javapkg. This 
works for me:

$ gomobile bind golang.org/x/mobile/bind/testdata/testpkg/javapkg

I agree that the error message could be better, or that an empty packages 
could be generated for your example. Reverse bindings are not of the same 
quality as regular bindings, I'm sorry.

 - elias

On Friday, October 19, 2018 at 9:38:33 AM UTC+2, Tim Cooijmans wrote:
>
> Hi,
>
> I just tried but it doesn't work:
> $ ls 
> /Users/timcooijmans/Development/AndroidSDK/platforms/android-27/android.jar 
> /Users/timcooijmans/Development/AndroidSDK/platforms/android-27/android.jar
> $ gomobile bind -v -bootclasspath 
> /Users/timcooijmans/Development/AndroidSDK/platforms/android-27/android.jar 
> git.xxx.com/test
> type-checking package "git.xxx.com/test" failed 
> (/Users/timcooijmans/Development/xxx/src/git.xxx.com/test/gobind.go:4:2: 
> could not import Java/android/content (cannot find package 
> "Java/android/content" in any of:
> /usr/local/Cellar/go/1.11.1/libexec/src/Java/android/content (from $GOROOT)
> /Users/timcooijmans/Development/xxx/src/Java/android/content (from 
> $GOPATH)))
>
> gomobile: /Users/timcooijmans/Development/xxx/bin/gobind -lang=go,java 
> -outdir=/var/folders/wz/4c7lp4w92y99_2bmpyx0j8smgn/T/gomobile-work-615111792
>  
> -bootclasspath=/Users/timcooijmans/Development/AndroidSDK/platforms/android-27/android.jar
>  
> git.xxx.com/test failed: exit status 1
>
>
> On Friday, October 19, 2018 at 9:30:04 AM UTC+2, Elias Naur wrote:
>>
>> I see. For Android API, you'll need to specify the bootstrap classpath by 
>> setting the gomobile -bootclasspath flag to point to the android.jar from 
>> the Android SDK that matches your platform version. For example:
>>
>> $ gomobile bind -bootclasspath /platforms/android-27/android.jar > pkg>
>>
>> If you need access to your own Java classes, use the -classpath flag.
>>
>>  - elias
>>
>> On Friday, October 19, 2018 at 8:49:50 AM UTC+2, Tim Cooijmans wrote:
>>>
>>> Simple example:
>>> package test
>>>
>>>
>>> import (
>>>  "Java/android/content"
>>>  "Java/android/content/pm"
>>> )
>>>
>>>
>>>
>>>
>>> func Test() string {
>>>  return "Hello world"
>>> }
>>>
>>>
>>> returns
>>> $ gomobile bind -v git.xxx.com/test
>>> type-checking package "git.xxx.com/test" failed 
>>> (/Users/xxx/Development/xxx/src/git.xxx.com/test/gobind.go:4:2: could 
>>> not import Java/android/content (cannot find package "Java/android/content" 
>>> in any of:
>>> /usr/local/Cellar/go/1.11.1/libexec/src/Java/android/content (from 
>>> $GOROOT)
>>> /Users/xxx/Development/xxx/src/Java/android/content (from $GOPATH)))
>>>
>>> gomobile: /Users/xxx/Development/xxx/bin/gobind -lang=go,java 
>>> -outdir=/var/folders/wz/4c7lp4w92y99_2bmpyx0j8smgn/T/gomobile-work-238062479
>>>  
>>> git.xxx.com/test failed: exit status 1
>>>
>>>
>>> On Thursday, October 18, 2018 at 11:28:25 PM UTC+2, Elias Naur wrote:
>>>>
>>>> Does
>>>>
>>>> gomobile bind 
>>>>
>>>> work? If not, what does it say?
>>>>
>>>>  - elias
>>>>
>>>>

-- 
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: [gomobile] How to generate reverse-bindings for Java without the gradle-plugin?

2018-10-19 Thread Elias Naur
I see. For Android API, you'll need to specify the bootstrap classpath by 
setting the gomobile -bootclasspath flag to point to the android.jar from 
the Android SDK that matches your platform version. For example:

$ gomobile bind -bootclasspath /platforms/android-27/android.jar 

If you need access to your own Java classes, use the -classpath flag.

 - elias

On Friday, October 19, 2018 at 8:49:50 AM UTC+2, Tim Cooijmans wrote:
>
> Simple example:
> package test
>
>
> import (
>  "Java/android/content"
>  "Java/android/content/pm"
> )
>
>
>
>
> func Test() string {
>  return "Hello world"
> }
>
>
> returns
> $ gomobile bind -v git.xxx.com/test
> type-checking package "git.xxx.com/test" failed 
> (/Users/xxx/Development/xxx/src/git.xxx.com/test/gobind.go:4:2: could not 
> import Java/android/content (cannot find package "Java/android/content" in 
> any of:
> /usr/local/Cellar/go/1.11.1/libexec/src/Java/android/content (from $GOROOT)
> /Users/xxx/Development/xxx/src/Java/android/content (from $GOPATH)))
>
> gomobile: /Users/xxx/Development/xxx/bin/gobind -lang=go,java 
> -outdir=/var/folders/wz/4c7lp4w92y99_2bmpyx0j8smgn/T/gomobile-work-238062479
>  
> git.xxx.com/test failed: exit status 1
>
>
> On Thursday, October 18, 2018 at 11:28:25 PM UTC+2, Elias Naur wrote:
>>
>> Does
>>
>> gomobile bind 
>>
>> work? If not, what does it say?
>>
>>  - elias
>>
>>

-- 
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] [gomobile] How to generate reverse-bindings for Java without the gradle-plugin?

2018-10-18 Thread Elias Naur
Does

gomobile bind 

work? If not, what does it say?

 - elias

-- 
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: x/mobile: forcing IntelliJ to fully reload changes to AAR

2018-09-21 Thread Elias Naur
Hi,

Since the gradle has no maintaner anymore 
(https://github.com/golang/go/issues/25314) so I deleted its mention from 
the Wiki page.

I think you're better off not using the plugin and manually rebuild the AAR 
file with gomobile bind.

 - elias

On Friday, September 21, 2018 at 8:13:20 PM UTC+2, Damien Radtke wrote:
>
> I've been playing around with building an Android application using Go by 
> binding the Go code into an AAR library that Android can use: 
> https://github.com/golang/go/wiki/Mobile#building-and-deploying-to-android-1
>
> I've come up with a successful build setup that utilizes the gobind gradle 
> plugin and an "implementation files(...)" line, but I'm not able to easily 
> reload changes to the Go source code. Simply rerunning the gobind task does 
> nothing, so I have to take the following steps to ensure that changes are 
> noticed:
>
> 1. Delete the existing AAR file
> 2. Rerun gobind
> 3. Ensure Gradle changes are synced
>
> I'm trying to find an easy way to consolidate these three steps into one, 
> but I've not had any luck so far. I tried defining a custom gradle task 
> that performs at least steps 1 and 2, but for some reason that causes a 
> gradle sync to also delete the library, which thereby causes the build to 
> fail.
>
> Anyone have any tips on how to do this? The setup in the mobile's example 
> repository seems to be even harder to reload changes, since there I had to 
> comment out the "implementation project(...)" line, sync, uncomment, and 
> resync.
>

-- 
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: I want to run a go project called syncthing on iOS , but I have some issues

2018-09-12 Thread Elias Naur
Tamás is right: go install or go build should be enough. Mare sure you have 
a recent version of Xcode (I use version 9.x) installed.

Here's my attempt:

$ go get -u github.com/syncthing/syncthing/cmd/syncthing
$ GOARCH=arm64 CGO_ENABLED=1 ~/go-tip/bin/go build -tags ios -o syncthing 
github.com/syncthing/syncthing/cmd/syncthing
# github.com/syncthing/syncthing/vendor/github.com/syncthing/notify
../go/src/github.com/syncthing/syncthing/vendor/github.com/syncthing/notify/watcher_fsevents_cgo.go:10:10:
 
fatal error: 'CoreServices/CoreServices.h' file not found
#include 
 ^
1 error generated.

The CoreServices error is probably because CoreServices is not available 
until iOS 12.

What are you trying to do? Command line programs are not supported on iOS, 
unless your device is jailbroken.

 - elias

On Wednesday, September 12, 2018 at 6:28:12 AM UTC+2, m18742...@163.com 
wrote:
>
> *I run the shell *
>
>
> *set -eecho "Done 1"*
>
>
> *HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd 
> )"GO=$HOME/golang/bin/go*
>
>
>
> *if [ ! -d "$HOME/cgo-obj" ]; thenmkdir $HOME/cgo-objfi*
>
>
>
> *if [ ! -d "$HOME/go-obj" ]; thenmkdir $HOME/go-objfi*
>
>
>
>
>
>
>
>
>
>
> *echo "Done 2"CGO_ENABLED=1 GOARCH=arm64 GOARM=7 $GO tool cgo -objdir 
> $HOME/cgo-obj 
> $HOME/syncthing/src/github.com/syncthing/syncthing/cmd/syncthing/main.go 
> echo "Done 
> 3"GOPATH=$HOME/syncthing CGO_ENABLED=1 GOARCH=arm64 $GO build -v -o 
> syncthing-exc -ldflags "-tmpdir $HOME/go-obj -linkmode 
> external" github.com/syncthing/syncthing/cmd/syncthing 
> echo "Done 4"when I 
> run it on xcode  *
>
>   runtime/cgo
>
> # runtime/cgo
>
> In file included from _cgo_export.c:3:
>
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/stdlib.h:63:
>
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/_types.h:27:
>
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:32:
>
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/cdefs.h:761:2:
>  
> error: Unsupported architecture
>
> In file included from _cgo_export.c:3:
>
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/stdlib.h:63:
>
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/_types.h:27:
>
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:33:
>
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/machine/_types.h:34:2:
>  
> error: architecture not supported
>
> In file included from _cgo_export.c:3:
>
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/stdlib.h:63:
>
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/_types.h:27:
>
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:55:9:
>  
> error: unknown type name '__int64_t'; did you mean '__int128_t'?
>
> note: '__int128_t' declared here
>
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:56:9:
>  
> error: unknown type name '__int32_t'; did you mean '__int128_t'?
>
> note: '__int128_t' declared here
>
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:57:9:
>  
> error: unknown type name '__int32_t'; did you mean '__int128_t'?
>
> note: '__int128_t' declared here
>
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:60:9:
>  
> error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
>
> note: '__uint128_t' declared here
>
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:61:9:
>  
> error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
>
> note: '__uint128_t' declared here
>
> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:62:9:
>  
> error: unknown type name '__uint64_t'; did you mean '__uint128_t'?
>
> note: '__uint128_t' 

[go-nuts] gomobile bind "skipped function" error in xcode

2018-04-29 Thread Elias Naur
Only byte slices ([]byte) are supported by gomobile bind. Try replacing your 
int slices with byte slices and it should appear in ObjC.

-- 
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: using gofmt "internally" to format a string, aka in memory go code formatter

2018-03-26 Thread Elias Naur
The gofmt command by default reads from standard input and outputs to 
standard output. It doesn't need a temporary file.

Alternatively, use the go/ast package to parse Go source and go/printer to 
pretty print it.

 - elias

On Monday, March 26, 2018 at 7:29:15 PM UTC+2, Darko Luketic wrote:
>
> How would I use something like gofmt to format a string in memory?
>
> I wouldn't want to write a temporary file then os.Exec gofmt and re-read 
> that file.
> There has to be a better way. Did anyone do anything like that before?
>

-- 
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: flutter' app crash met with gomobile package .aar

2018-03-21 Thread Elias Naur
I have no experience with that combination. Is there a stack trace or error 
message along with the crash?

On Wednesday, March 21, 2018 at 1:37:11 PM UTC+1, jlp hu wrote:
>
> flutter' app crash met with gomobile package .aar
>
>1. 
>
>I follow the guidence https://flutter.io/platform-channels/ ... It 
>works; I can see the result in Simulator.
>2. 
>
>I write a simple code in Golang, Gomobile bind -target=android, get 
>.aar file, put into libs, the app stopped when the call happened. The code 
>is very simple:
>
> package bond
>
> import (
>
> )
>
> func FirstCall() int{
> return 20180311
> }
>
> func SecondCall() string{
> return "20180311"
> }
>
> func ThirdCall() {
> }
>
> type Counter struct {
> Value int
> }
>
> func (c *Counter) Inc() { c.Value++ }
>
> func NewCounter() *Counter { return { 5 } }
> 3) I create app with Android Studio, put the .aar file in, and call, it 
> gets the right return.
>
> final String stext=Bond.secondCall();
> 4) So the problem is, there are 2 bridges here; each of them work, but put 
> together, it crashes.
>
> Anybody could give me a solution? Is the problem in Flutter or Gomobile?
>

-- 
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: gomobile - SIGPIPE

2018-02-13 Thread Elias Naur
Thank you for the reproduction program. I think the problem is that the 
Xcode debugger stops on a SIGPIPE, making it look like your app crashed. If 
I run your app, provoke the SIGPIPE and then select Debug > Continue, your 
test app continues without crashing. The same happens if I run your test 
directly from a device without the Xcode debugger attached.

The CL that fixed issue 17393, 
https://go-review.googlesource.com/c/go/+/35960, made sure SIGPIPEs from Go 
itself was properly handled, but it didn't suppress SIGPIPE. There's is a 
socket option for that, SO_NOSIGPIPE, but unfortunately that's only 
available on Darwin so it isn't used.

 - elias 

On Tuesday, February 13, 2018 at 7:54:09 AM UTC+1, mi...@ubo.ro wrote:
>
>  I managed to get a small reproducible test case. The issue is easy to 
> reproduce. Basically if you spawn some http requests immediately after the 
> application comes back from background you get SIGPIPE. 
> Step by step:
> 1. Open ios remote.xcodeproj in XCode
> 2. Run the application on a real device.
> 3. Put the application in background (press the "stand by/lock-in" button)
> 4. Get it out of background (i.e. unlock the phone)
> 5. You get SIGPIPE 
>
> https://github.com/themihai/testios
>
>
> gomobile version
> gomobile version +5704e18 Mon Jan 22 17:02:51 2018 + (android,ios); 
> androidSDK=
>
> Mihai.
>
>
>
> On Tuesday, February 6, 2018 at 12:53:06 AM UTC+2, Elias Naur wrote:
>>
>> It's hard to know what's causing the SIGPIPE without more information. 
>> Ideally, a standalone recipe to reproduce the problem.
>>
>> Make sure you have the latest version of gomobile as well.
>>
>>  - elias
>>
>> On Monday, February 5, 2018 at 10:53:09 PM UTC+1, mi...@ubo.ro wrote:
>>>
>>> I'm trying to develop a gomobile application using a http server serving 
>>> html and a swift client serving the content from localhost through a 
>>> WKWebView. All the work happens inside the http handlers(i.e. http requests 
>>> to external API servers). 
>>>   The issue is that after several requests the application crashes with 
>>> SIGPIPE. I've searched through issues and it seems this was a known issue 
>>> and apparently  was fixed in [0]. How can I debug this further or is there 
>>> any known fix? 
>>>
>>>
>>> libsystem_kernel.dylib`mach_msg_trap:
>>>
>>> 0x180c5b560 <+0>: movx16, #-0x1f
>>>
>>> 0x180c5b564 <+4>: svc#0x80
>>>
>>> ->  0x180c5b568 <+8>: ret
>>>
>>>
>>>
>>>
>>> $ go version
>>> go version go1.9.2 darwin/amd64
>>>
>>>
>>> https://github.com/golang/go/issues/17393
>>>
>>

-- 
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: gomobile - SIGPIPE

2018-02-05 Thread Elias Naur
It's hard to know what's causing the SIGPIPE without more information. 
Ideally, a standalone recipe to reproduce the problem.

Make sure you have the latest version of gomobile as well.

 - elias

On Monday, February 5, 2018 at 10:53:09 PM UTC+1, mi...@ubo.ro wrote:
>
> I'm trying to develop a gomobile application using a http server serving 
> html and a swift client serving the content from localhost through a 
> WKWebView. All the work happens inside the http handlers(i.e. http requests 
> to external API servers). 
>   The issue is that after several requests the application crashes with 
> SIGPIPE. I've searched through issues and it seems this was a known issue 
> and apparently  was fixed in [0]. How can I debug this further or is there 
> any known fix? 
>
>
> libsystem_kernel.dylib`mach_msg_trap:
>
> 0x180c5b560 <+0>: movx16, #-0x1f
>
> 0x180c5b564 <+4>: svc#0x80
>
> ->  0x180c5b568 <+8>: ret
>
>
>
>
> $ go version
> go version go1.9.2 darwin/amd64
>
>
> https://github.com/golang/go/issues/17393
>

-- 
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: gomobile bind -target=ios ld: framework not found OpenGL

2018-01-28 Thread Elias Naur
Only OpenGL ES (OpenGLES.framework) is available on iOS. Furthermore, iOS 
builds use the frameworks installed in the platform directory. On my system 
that's 

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks

or

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks

for simulator builds. Both directories contain OpenGLES.framework but no 
OpenGL.framework.

 - elias

On Saturday, January 27, 2018 at 3:12:23 PM UTC+1, John Teasdale wrote:
>
> I'm having a problem building an ios framework that depends on a OpenGL 
> library. 
>
> if this is the file:
>
> package gfx
>
>
> import (
>  "github.com/goxjs/gl"
> )
>
>
> func test() {
>  gl.Clear(gl.COLOR_BUFFER_BIT)
> }
>
>
> This is the build output:
> gomobile bind -target=ios
> gomobile: go install 
> -pkgdir=/Users/johnteasdale/gocode/pkg/gomobile/pkg_darwin_arm 
> -tags ios github.com/jpteasdale/gfx failed: exit status 2 
> # github.com/jpteasdale/gfx/vendor/github.com/go-gl/gl/v2.1/gl 
> ld: framework not found OpenGL 
> clang: error: linker command failed with exit code 1 (use -v to see 
> invocation)
>
>
>
> I know where the framework is:
>
> ls /System/Library/Frameworks/OpenGL.framework
> Headers Libraries Modules OpenGL Resources Versions
>
>
>
> I've tried all of the following with the same result:
>
> gomobile bind -target=ios -ldflags "-L /System/Library/Frameworks"
>
> gomobile bind -target=ios -ldflags "-F /System/Library/Frameworks"
>
> gomobile bind -target=ios -ldflags "-extldflags -F 
> /System/Library/Frameworks"
>
> LDFAGS="-F/System/Library/Frameworks" gomobile bind -target=ios
>
> CGO_LDFLAGS="-F /System/Library/Frameworks" gomobile bind -target=io
>
>
>
> There isn't much documentaiton on this, so I was hoping one of y'all had 
> seen this before.
>
> Versions:
> macOS 10.13.2 
>
> go version
>
> go version go1.9.2 darwin/amd64
>
> gomobile version
>
> gomobile version +5704e18 Mon Jan 22 17:02:51 2018 + (android,ios); 
> androidSDK=
>
>
> clang -v
>
> Apple LLVM version 9.0.0 (clang-900.0.39.2)
>
> Target: x86_64-apple-darwin17.3.0
>
> Thread model: posix
>
> InstalledDir: 
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
>
>

-- 
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] Re: Invalid Segment Alignment when pushing to iTunesConnect

2017-10-23 Thread Elias Naur
There's a guide at https://golang.org/doc/contribute.html to help
submitting a change to the code review tool used by Go. Raising an issue is
great, but an actual change is the fastest way forward in this case (iOS is
a fringe OS in Go). With a CL, the change will be reviewed by someone who
knows the low level linker flags such as pagezero_size.

 - elias

On Mon, Oct 23, 2017 at 6:56 PM <pru...@gmail.com> wrote:

> Maybe? I would appreciate your help in this matter. What is the quickest
> way to confirm that the change makes sense, doesn't break previous ios
> related stuff, and get it into the next go release? I don't want to hold
> things up as I google "change list" with various combinations of "golang",
> "git" and "submit go patch".
>
> I had thought about raising a golang issue as the next step. Would this
> make sense?
>
> On Monday, October 23, 2017 at 12:31:44 PM UTC-4, Elias Naur wrote:
>>
>> Fantastic! Would you like to send this patch as a change list?
>>
>>  - elias
>>
>> On Monday, October 23, 2017 at 6:24:05 PM UTC+2, pru...@gmail.com wrote:
>>>
>>> Making the following change fixes the original problem and allows my ios
>>> apps to be uploaded:
>>>
>>> diff --git a/src/cmd/link/internal/ld/lib.go
>>> b/src/cmd/link/internal/ld/lib.go
>>> index bd3abbba0a..45642e8ad7 100644
>>> --- a/src/cmd/link/internal/ld/lib.go
>>> +++ b/src/cmd/link/internal/ld/lib.go
>>> @@ -1105,7 +1105,7 @@ func (ctxt *Link) hostlink() {
>>> switch ctxt.BuildMode {
>>> case BuildModeExe:
>>> if ctxt.HeadType == objabi.Hdarwin {
>>> -   argv = append(argv, "-Wl,-pagezero_size,400")
>>> +   argv = append(argv,
>>> "-Wl,-pagezero_size,1")
>>> }
>>> case BuildModePIE:
>>> // ELF.
>>>
>>>
>>> On Monday, October 23, 2017 at 11:54:41 AM UTC-4, pru...@gmail.com
>>> wrote:
>>>>
>>>> On the off chance that it might be useful, here is some information on
>>>> the bind example that validated:
>>>>
>>>>
>>>> ~/Library/Developer/Xcode/Archives/2017-10-23 <20%2017%2010%2023>/bind
>>>> 2017-10-23 <20%2017%2010%2023>, 11.24
>>>> AM.xcarchive/Products/Applications/bind.app: size -x -l -m bind
>>>>
>>>> Segment __PAGEZERO: 0x1 (vmaddr 0x0 fileoff 0)
>>>>
>>>> Segment __TEXT: 0x94000 (vmaddr 0x1 fileoff 0)
>>>>
>>>> Section __text: 0x8a3e0 (addr 0x177e8 offset 30696)
>>>>
>>>> Section __stubs: 0x258 (addr 0x100091bc8 offset 596936)
>>>>
>>>> Section __stub_helper: 0x270 (addr 0x100091e20 offset 597536)
>>>>
>>>> Section __objc_methname: 0xd1a (addr 0x100092090 offset 598160)
>>>>
>>>> Section __cstring: 0x412 (addr 0x100092daa offset 601514)
>>>>
>>>> Section __objc_classname: 0x8f (addr 0x1000931bc offset 602556)
>>>>
>>>> Section __objc_methtype: 0x8e7 (addr 0x10009324b offset 602699)
>>>>
>>>> Section __gcc_except_tab: 0x3b8 (addr 0x100093b34 offset 604980)
>>>>
>>>> Section __const: 0x8 (addr 0x100093ef0 offset 605936)
>>>>
>>>> Section __unwind_info: 0x108 (addr 0x100093ef8 offset 605944)
>>>>
>>>> total 0x8c812
>>>>
>>>> Segment __DATA: 0xc4000 (vmaddr 0x100094000 fileoff 606208)
>>>>
>>>> Section __got: 0x38 (addr 0x100094000 offset 606208)
>>>>
>>>> Section __la_symbol_ptr: 0x190 (addr 0x100094038 offset 606264)
>>>>
>>>> Section __mod_init_func: 0x18 (addr 0x1000941c8 offset 606664)
>>>>
>>>> Section __cfstring: 0x1e0 (addr 0x1000941e0 offset 606688)
>>>>
>>>> Section __objc_classlist: 0x38 (addr 0x1000943c0 offset 607168)
>>>>
>>>> Section __objc_protolist: 0x28 (addr 0x1000943f8 offset 607224)
>>>>
>>>> Section __objc_imageinfo: 0x8 (addr 0x100094420 offset 607264)
>>>>
>>>> Section __objc_const: 0x1710 (addr 0x100094428 offset 607272)
>>>>
>>>> Section __objc_selrefs: 0x130 (addr 0x100095b38 offset 613176)
>>>>
>>>> Section __objc_classrefs: 0x60 (addr 0x100095c68 offset 613480)
>>>>
>>>> Section __objc_superrefs: 0x30 (addr 0x100095cc8 offset

Re: [go-nuts] Re: Invalid Segment Alignment when pushing to iTunesConnect

2017-10-23 Thread Elias Naur
; Section __objc_methname: 0xda1 (addr 0x413f020 offset 1306656)
>>
>> Section __objc_classname: 0x5a (addr 0x413fdc1 offset 1310145)
>>
>> Section __objc_methtype: 0xa0a (addr 0x413fe1b offset 1310235)
>>
>> Section __cstring: 0x3733 (addr 0x4140825 offset 1312805)
>>
>> Section __unwind_info: 0xa4 (addr 0x4143f58 offset 1326936)
>>
>> total 0x13d64c
>>
>> Segment __DATA: 0x13c000 (vmaddr 0x4144000 fileoff 1327104)
>>
>> Section __got: 0x20 (addr 0x4144000 offset 1327104)
>>
>> Section __la_symbol_ptr: 0x158 (addr 0x4144020 offset 1327136)
>>
>> Section __const: 0x80 (addr 0x4144178 offset 1327480)
>>
>> Section __cfstring: 0x80 (addr 0x41441f8 offset 1327608)
>>
>> Section __objc_classlist: 0x10 (addr 0x4144278 offset 1327736)
>>
>> Section __objc_protolist: 0x20 (addr 0x4144288 offset 1327752)
>>
>> Section __objc_imageinfo: 0x8 (addr 0x41442a8 offset 1327784)
>>
>> Section __objc_const: 0xf98 (addr 0x41442b0 offset 1327792)
>>
>> Section __objc_selrefs: 0xf0 (addr 0x4145248 offset 1331784)
>>
>> Section __objc_classrefs: 0x28 (addr 0x4145338 offset 1332024)
>>
>> Section __objc_superrefs: 0x8 (addr 0x4145360 offset 1332064)
>>
>> Section __objc_ivar: 0x14 (addr 0x4145368 offset 1332072)
>>
>> Section __objc_data: 0xa0 (addr 0x4145380 offset 1332096)
>>
>> Section __rodata: 0x6f038 (addr 0x4145420 offset 1332256)
>>
>> Section __typelink: 0x12f4 (addr 0x41b4460 offset 1786976)
>>
>> Section __itablink: 0x2c8 (addr 0x41b5758 offset 1791832)
>>
>> Section __gopclntab: 0x8f0fd (addr 0x41b5a20 offset 1792544)
>>
>> Section __gosymtab: 0x0 (addr 0x4244b1d offset 2378525)
>>
>> Section __noptrdata: 0x109a0 (addr 0x4244b20 offset 2378528)
>>
>> Section __data: 0x72a0 (addr 0x42554c0 offset 2446528)
>>
>> Section __bss: 0x1d1f8 (addr 0x425c760 offset 0)
>>
>> Section __noptrbss: 0x2338 (addr 0x4279960 offset 0)
>>
>> Section __common: 0x1638 (addr 0x427bc98 offset 0)
>>
>> total 0x1392b5
>>
>> Segment __LINKEDIT: 0x78000 (vmaddr 0x428 fileoff 2490368)
>>
>> total 0x42f8000
>>
>>
>> On Monday, October 23, 2017 at 11:28:13 AM UTC-4, pru...@gmail.com wrote:
>>>
>>> Ok thank you!. Bind does validate after setting ENABLE_BITCODE to NO in 
>>> the build settings.
>>>
>>> On Monday, October 23, 2017 at 11:03:51 AM UTC-4, Elias Naur wrote:
>>>>
>>>> To successfully build the bind example you need to disable bitcode (and 
>>>> import the framework as you did). Sorry.
>>>>
>>>> - elias
>>>>
>>>> Den man. 23. okt. 2017 17.00 skrev <pru...@gmail.com>:
>>>>
>>>>> Trying bind this time.
>>>>> Not able to build in Xcode with bind example. Xcode can't find the 
>>>>> Hello module when following the instructions. Dropping the 
>>>>> hello.framework 
>>>>> into the ios folder seems to help but leads to the following linker error:
>>>>>
>>>>> ld: '/Users/rust/code/src/
>>>>> golang.org/x/mobile/example/bind/ios/Hello.framework/Hello(02.o)' 
>>>>> does not contain bitcode. You must rebuild it with bitcode enabled (Xcode 
>>>>> setting ENABLE_BITCODE), obtain an updated library from the vendor, or 
>>>>> disable bitcode for this target. for architecture arm64
>>>>>
>>>>> clang: error: linker command failed with exit code 1 (use -v to see 
>>>>> invocation)
>>>>>
>>>>> Do the bind instructions from https://github.com/golang/go/wiki/Mobile 
>>>>> work 
>>>>> for you in Xcode 9? I accepted all Xcode fixes. Is it better to not do 
>>>>> this?
>>>>>
>>>>> On Monday, October 23, 2017 at 10:27:24 AM UTC-4, Elias Naur wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, Oct 23, 2017 at 2:09 PM <pru...@gmail.com> wrote:
>>>>>>
>>>>>>> I reproduced the problem using the gomobile bind example with the 
>>>>>>> following code changes.
>>>>>>>
>>>>>>> diff --git a/cmd/gomobile/build_iosapp.go 
>>>>>>> b/cmd/gomobile/build_iosapp.go
>>>>>>>
>>>>>>> index 0b2a923..8480790 100644
>>>>>>>
>>>>>>> --- a/cmd/gomobile/build_iosap

Re: [go-nuts] Re: Invalid Segment Alignment when pushing to iTunesConnect

2017-10-23 Thread Elias Naur
Great, thank you! I know very little about gomobile build, but I noticed
that gomobile bind uses the -buildmode=c-archive flag to go build while
gomobile build doesn't. Does the following (completely untested) patch make
any difference:

diff --git a/cmd/gomobile/build_iosapp.go b/cmd/gomobile/build_iosapp.go
index 0b2a923..cf8da09 100644
--- a/cmd/gomobile/build_iosapp.go
+++ b/cmd/gomobile/build_iosapp.go
@@ -63,7 +63,7 @@ func goIOSBuild(pkg *build.Package) (map[string]bool,
error) {
ctx.BuildTags = append(ctx.BuildTags, "ios")

armPath := filepath.Join(tmpdir, "arm")
-   if err := goBuild(src, darwinArmEnv, "-o="+armPath); err != nil {
+   if err := goBuild(src, darwinArmEnv, "-buildmode=c-archive",
"-o="+armPath); err != nil {
return nil, err
}
nmpkgs, err := extractPkgs(darwinArmNM, armPath)
@@ -72,7 +72,7 @@ func goIOSBuild(pkg *build.Package) (map[string]bool,
error) {
}

arm64Path := filepath.Join(tmpdir, "arm64")
-   if err := goBuild(src, darwinArm64Env, "-o="+arm64Path); err != nil
{
+   if err := goBuild(src, darwinArm64Env, "-buildmode=c-archive",
"-o="+arm64Path); err != nil {
return nil, err
}

?

 - elias

On Mon, Oct 23, 2017 at 5:28 PM <pru...@gmail.com> wrote:

> Ok thank you!. Bind does validate after setting ENABLE_BITCODE to NO in
> the build settings.
>
>
> On Monday, October 23, 2017 at 11:03:51 AM UTC-4, Elias Naur wrote:
>
>> To successfully build the bind example you need to disable bitcode (and
>> import the framework as you did). Sorry.
>>
>> - elias
>>
>> Den man. 23. okt. 2017 17.00 <20%2017%2017%2000> skrev <pru...@gmail.com
>> >:
>>
> Trying bind this time.
>>> Not able to build in Xcode with bind example. Xcode can't find the Hello
>>> module when following the instructions. Dropping the hello.framework into
>>> the ios folder seems to help but leads to the following linker error:
>>>
>>> ld: '/Users/rust/code/src/
>>> golang.org/x/mobile/example/bind/ios/Hello.framework/Hello(02.o)'
>>> does not contain bitcode. You must rebuild it with bitcode enabled (Xcode
>>> setting ENABLE_BITCODE), obtain an updated library from the vendor, or
>>> disable bitcode for this target. for architecture arm64
>>>
>>> clang: error: linker command failed with exit code 1 (use -v to see
>>> invocation)
>>>
>>> Do the bind instructions from https://github.com/golang/go/wiki/Mobile work
>>> for you in Xcode 9? I accepted all Xcode fixes. Is it better to not do this?
>>>
>>> On Monday, October 23, 2017 at 10:27:24 AM UTC-4, Elias Naur wrote:
>>>
>>>>
>>>>
>>>> On Mon, Oct 23, 2017 at 2:09 PM <pru...@gmail.com> wrote:
>>>>
>>>>> I reproduced the problem using the gomobile bind example with the
>>>>> following code changes.
>>>>>
>>>>> diff --git a/cmd/gomobile/build_iosapp.go
>>>>> b/cmd/gomobile/build_iosapp.go
>>>>>
>>>>> index 0b2a923..8480790 100644
>>>>>
>>>>> --- a/cmd/gomobile/build_iosapp.go
>>>>>
>>>>> +++ b/cmd/gomobile/build_iosapp.go
>>>>>
>>>>> @@ -31,7 +31,7 @@ func goIOSBuild(pkg *build.Package)
>>>>> (map[string]bool, error) {
>>>>>
>>>>> infoplist := new(bytes.Buffer)
>>>>>
>>>>> if err := infoplistTmpl.Execute(infoplist, infoplistTmplData{
>>>>>
>>>>> // TODO: better bundle id.
>>>>>
>>>>> -   BundleID: "org.golang.todo." + productName,
>>>>>
>>>>> +   BundleID: "com.galvanizedlogic.bios",
>>>>>
>>>>> Name: strings.Title(path.Base(pkg.ImportPath)),
>>>>>
>>>>> }); err != nil {
>>>>>
>>>>> return nil, err
>>>>>
>>>>> @@ -97,7 +97,7 @@ func goIOSBuild(pkg *build.Package)
>>>>> (map[string]bool, error) {
>>>>>
>>>>> // Build and move the release build to the output directory.
>>>>>
>>>>> cmd = exec.Command(
>>>>>
>>>>> "xcrun", "xcodebuild",
>>>>>
>>>>> -   "-co

Re: [go-nuts] Re: Invalid Segment Alignment when pushing to iTunesConnect

2017-10-23 Thread Elias Naur
To successfully build the bind example you need to disable bitcode (and
import the framework as you did). Sorry.

- elias

Den man. 23. okt. 2017 17.00 skrev <pru...@gmail.com>:

> Trying bind this time.
> Not able to build in Xcode with bind example. Xcode can't find the Hello
> module when following the instructions. Dropping the hello.framework into
> the ios folder seems to help but leads to the following linker error:
>
> ld: '/Users/rust/code/src/
> golang.org/x/mobile/example/bind/ios/Hello.framework/Hello(02.o)'
> does not contain bitcode. You must rebuild it with bitcode enabled (Xcode
> setting ENABLE_BITCODE), obtain an updated library from the vendor, or
> disable bitcode for this target. for architecture arm64
>
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
> Do the bind instructions from https://github.com/golang/go/wiki/Mobile work
> for you in Xcode 9? I accepted all Xcode fixes. Is it better to not do this?
>
> On Monday, October 23, 2017 at 10:27:24 AM UTC-4, Elias Naur wrote:
>
>>
>>
>> On Mon, Oct 23, 2017 at 2:09 PM <pru...@gmail.com> wrote:
>>
>>> I reproduced the problem using the gomobile bind example with the
>>> following code changes.
>>>
>>> diff --git a/cmd/gomobile/build_iosapp.go b/cmd/gomobile/build_iosapp.go
>>>
>>> index 0b2a923..8480790 100644
>>>
>>> --- a/cmd/gomobile/build_iosapp.go
>>>
>>> +++ b/cmd/gomobile/build_iosapp.go
>>>
>>> @@ -31,7 +31,7 @@ func goIOSBuild(pkg *build.Package) (map[string]bool,
>>> error) {
>>>
>>> infoplist := new(bytes.Buffer)
>>>
>>> if err := infoplistTmpl.Execute(infoplist, infoplistTmplData{
>>>
>>> // TODO: better bundle id.
>>>
>>> -   BundleID: "org.golang.todo." + productName,
>>>
>>> +   BundleID: "com.galvanizedlogic.bios",
>>>
>>> Name: strings.Title(path.Base(pkg.ImportPath)),
>>>
>>> }); err != nil {
>>>
>>> return nil, err
>>>
>>> @@ -97,7 +97,7 @@ func goIOSBuild(pkg *build.Package) (map[string]bool,
>>> error) {
>>>
>>> // Build and move the release build to the output directory.
>>>
>>> cmd = exec.Command(
>>>
>>> "xcrun", "xcodebuild",
>>>
>>> -   "-configuration", "Release",
>>>
>>> +   "-configuration", "Release", "-allowProvisioningUpdates",
>>>
>>> "-project", tmpdir+"/main.xcodeproj",
>>>
>>> )
>>>
>>> if err := runCmd(cmd); err != nil {
>>>
>>> @@ -312,12 +312,14 @@ const projPbxproj = `// !$*UTF8*$!
>>>
>>>  ORGANIZATIONNAME = Developer;
>>>
>>>  TargetAttributes = {
>>>
>>>254BB83D1B1FD08900C56DE9 = {
>>>
>>> -CreatedOnToolsVersion = 6.3.1;
>>>
>>> +CreatedOnToolsVersion = 9.0;
>>>
>>> +DevelopmentTeam = 9829M3WGFP;
>>>
>>> +ProvisioningStyle = Automatic;
>>>
>>>};
>>>
>>>  };
>>>
>>>};
>>>
>>>buildConfigurationList = 254BB8391B1FD08900C56DE9 /* Build
>>> configuration list for PBXProject "main" */;
>>>
>>> -  compatibilityVersion = "Xcode 3.2";
>>>
>>> +  compatibilityVersion = "Xcode 8.0";
>>>
>>>developmentRegion = English;
>>>
>>>hasScannedForEncodings = 0;
>>>
>>>knownRegions = (
>>>
>>> Then repackaged bios.app and bios.ipa using the binary from the gomobile
>>> basic.app (avoids a bunch of invalid or missing icon errors). Validated
>>> that the app runs on an iphone 7. The upload ipa resulted in the following
>>> errors:
>>>
>>>
>>> The "Invalid Bundle" is because gomobile builds a binary with both 32
>>> and 64 bit executables.
>>> I can't explain the PIE error. I did not get this error in the bios
>>> build even though I saw the "-nopie" when looking at a previous bios linker
>>> debug output.
>>>
>>>
>>
>> This seems like the "gomobile build" mode, not gomobile bind. There is a
>> difference: build is for apps in 100% Go, while bind are for apps where a
>> part is in Go. With gomobile bind, the Go part is built as a c-archive
>> library and packaged in a framework. I know that you're interested in the
>> gomobile build mode, but knowing whether gomobile bind apps have the same
>> validation errors might help to debug the problem.
>>
>>  - elias
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/DaCOnoSWvBw/unsubscribe.
> To unsubscribe from this group and all its topics, 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] Re: Invalid Segment Alignment when pushing to iTunesConnect

2017-10-23 Thread Elias Naur
On Mon, Oct 23, 2017 at 2:09 PM  wrote:

> I reproduced the problem using the gomobile bind example with the
> following code changes.
>
> diff --git a/cmd/gomobile/build_iosapp.go b/cmd/gomobile/build_iosapp.go
>
> index 0b2a923..8480790 100644
>
> --- a/cmd/gomobile/build_iosapp.go
>
> +++ b/cmd/gomobile/build_iosapp.go
>
> @@ -31,7 +31,7 @@ func goIOSBuild(pkg *build.Package) (map[string]bool,
> error) {
>
> infoplist := new(bytes.Buffer)
>
> if err := infoplistTmpl.Execute(infoplist, infoplistTmplData{
>
> // TODO: better bundle id.
>
> -   BundleID: "org.golang.todo." + productName,
>
> +   BundleID: "com.galvanizedlogic.bios",
>
> Name: strings.Title(path.Base(pkg.ImportPath)),
>
> }); err != nil {
>
> return nil, err
>
> @@ -97,7 +97,7 @@ func goIOSBuild(pkg *build.Package) (map[string]bool,
> error) {
>
> // Build and move the release build to the output directory.
>
> cmd = exec.Command(
>
> "xcrun", "xcodebuild",
>
> -   "-configuration", "Release",
>
> +   "-configuration", "Release", "-allowProvisioningUpdates",
>
> "-project", tmpdir+"/main.xcodeproj",
>
> )
>
> if err := runCmd(cmd); err != nil {
>
> @@ -312,12 +312,14 @@ const projPbxproj = `// !$*UTF8*$!
>
>  ORGANIZATIONNAME = Developer;
>
>  TargetAttributes = {
>
>254BB83D1B1FD08900C56DE9 = {
>
> -CreatedOnToolsVersion = 6.3.1;
>
> +CreatedOnToolsVersion = 9.0;
>
> +DevelopmentTeam = 9829M3WGFP;
>
> +ProvisioningStyle = Automatic;
>
>};
>
>  };
>
>};
>
>buildConfigurationList = 254BB8391B1FD08900C56DE9 /* Build
> configuration list for PBXProject "main" */;
>
> -  compatibilityVersion = "Xcode 3.2";
>
> +  compatibilityVersion = "Xcode 8.0";
>
>developmentRegion = English;
>
>hasScannedForEncodings = 0;
>
>knownRegions = (
>
> Then repackaged bios.app and bios.ipa using the binary from the gomobile
> basic.app (avoids a bunch of invalid or missing icon errors). Validated
> that the app runs on an iphone 7. The upload ipa resulted in the following
> errors:
>
>
> The "Invalid Bundle" is because gomobile builds a binary with both 32 and
> 64 bit executables.
> I can't explain the PIE error. I did not get this error in the bios build
> even though I saw the "-nopie" when looking at a previous bios linker debug
> output.
>
>

This seems like the "gomobile build" mode, not gomobile bind. There is a
difference: build is for apps in 100% Go, while bind are for apps where a
part is in Go. With gomobile bind, the Go part is built as a c-archive
library and packaged in a framework. I know that you're interested in the
gomobile build mode, but knowing whether gomobile bind apps have the same
validation errors might help to debug the problem.

 - elias

-- 
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: Invalid Segment Alignment when pushing to iTunesConnect

2017-10-22 Thread Elias Naur
Another thing: Is the problem present in go tip (to become 1.10) as well? 
And finally, can you reproduce the problem with the simple 
golang.org/x/mobile/example/bind example?

 - elias

On Sunday, October 22, 2017 at 10:26:15 AM UTC+2, Elias Naur wrote:
>
> Hi Paul,
>
> What version of Go, Xcode an macOS are you using? I'd like to help you 
> debug the problem, but Xcode doesn't seem to allow me to run the validation 
> of an archived build without a developer account.
>
>  - elias
>
> On Sunday, October 22, 2017 at 6:34:15 AM UTC+2, pru...@gmail.com wrote:
>>
>> I'm getting the following error when trying to publish a go app to the 
>> itunes connect app store.
>>
>> ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 
>> 'bios.app/bios' does not have proper segment alignment. Try rebuilding the 
>> app with the latest Xcode version."
>>
>> Please: Can anyone tell me what this error means and how to debug it?
>> I need help to determine if its just a matter of adding some external 
>> linker flags,
>> or if Apple has changed their ios binary requirements, or its something 
>> else entirely. 
>> I've created a test project at github.com/gazed/bios that can be used to 
>> recreate the error.
>>
>> Background:
>>
>>- Similar to 
>>https://groups.google.com/forum/#!topic/golang-nuts/7TyYy5OIqD0
>>- I've duplicated this error using the above github project, and also 
>>by submitting from xcode directly, and also by using a generated xcode 
>>project and the command line xcodebuild.
>>- The above basic ios app works in developer mode. Its been run it on 
>>iphones 6S, 7, an ipad mini, and an ipad pro (great job on the go arm64 
>>support!).
>>- I have submitted an ios developer support ticket asking apple for 
>>more details regarding the apple error from the apple Application Loader 
>>tool. Apple replied:
>>
>> "Thank you for contacting Apple Developer Technical Support (DTS). 
>> We’ve determined that your question should be addressed by the support 
>> channel for Go - the third-party resource you are using.  DTS supports 
>> developers using Apple-authored tools and frameworks only.".
>>
>>
>> Does the go development team have better access to apple support 
>> regarding details on apple errors? 
>>
>>
>>- The google info on this error is sketchy. It is sometimes raised by 
>>those using ios framework tools and the problems are resolved by the 
>>framework developers, but I've not yet located a detailed description of 
>>the problem or how to debug it.
>>
>> Thank you,
>> Paul
>>
>

-- 
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: Invalid Segment Alignment when pushing to iTunesConnect

2017-10-22 Thread Elias Naur
Hi Paul,

What version of Go, Xcode an macOS are you using? I'd like to help you 
debug the problem, but Xcode doesn't seem to allow me to run the validation 
of an archived build without a developer account.

 - elias

On Sunday, October 22, 2017 at 6:34:15 AM UTC+2, pru...@gmail.com wrote:
>
> I'm getting the following error when trying to publish a go app to the 
> itunes connect app store.
>
> ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 
> 'bios.app/bios' does not have proper segment alignment. Try rebuilding the 
> app with the latest Xcode version."
>
> Please: Can anyone tell me what this error means and how to debug it?
> I need help to determine if its just a matter of adding some external 
> linker flags,
> or if Apple has changed their ios binary requirements, or its something 
> else entirely. 
> I've created a test project at github.com/gazed/bios that can be used to 
> recreate the error.
>
> Background:
>
>- Similar to 
>https://groups.google.com/forum/#!topic/golang-nuts/7TyYy5OIqD0
>- I've duplicated this error using the above github project, and also 
>by submitting from xcode directly, and also by using a generated xcode 
>project and the command line xcodebuild.
>- The above basic ios app works in developer mode. Its been run it on 
>iphones 6S, 7, an ipad mini, and an ipad pro (great job on the go arm64 
>support!).
>- I have submitted an ios developer support ticket asking apple for 
>more details regarding the apple error from the apple Application Loader 
>tool. Apple replied:
>
> "Thank you for contacting Apple Developer Technical Support (DTS). 
> We’ve determined that your question should be addressed by the support 
> channel for Go - the third-party resource you are using.  DTS supports 
> developers using Apple-authored tools and frameworks only.".
>
>
> Does the go development team have better access to apple support regarding 
> details on apple errors? 
>
>
>- The google info on this error is sketchy. It is sometimes raised by 
>those using ios framework tools and the problems are resolved by the 
>framework developers, but I've not yet located a detailed description of 
>the problem or how to debug it.
>
> Thank you,
> Paul
>

-- 
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: gomobile bind doesn't work for socket.

2017-10-16 Thread Elias Naur
The zsys_* files are automatically generated with the cgo tool so they 
shouldn't be blindly copied. Perhaps you should try to generate on for 
darwin/arm64 by running the cgo tool manually (perhaps with GOOS=darwin 
GOARCH=arm64 set). Perhaps a golang.org/x/net maintainer knows better.

 - elias

On Monday, October 16, 2017 at 2:01:33 PM UTC+2, dumm...@gmail.com wrote:
>
>  Very thanks,  I got the library compiled after doing the fix. ( copy 
> zsys_darwin_amd64.go as zsys_darwin_arm64.go )
> I notice that this socket platform go files content is defined by platform 
> and bit. so I think zsys_darwin_amd64.go and zsys_darwin_arm64.go should be 
> same.
>
>  The unlucky thing is the behaviour is invalid.
>  I use the library to connect server. Server Accept the connection. But 
> the library didn't send any more data. (The original go code is right and I 
> use it on the desktop)
>
>  I am not sure whether I did bad fix. It really like that socket didn't 
> work. 
>
> 在 2017年10月16日星期一 UTC+8下午5:56:45,Elias Naur写道:
>>
>> I was wrong. The root cause seem to be that the zsys_darwin_arm64.go (for 
>> iOS arm64) is missing from golang.org/x/net/internal/socket. There is a 
>> zsys_darwin_arm.go (for iOS arm), so it should be easy to add. You should 
>> raise an issue on the golang bug tracker.
>>
>>  - elias
>>
>> On Monday, October 16, 2017 at 11:33:44 AM UTC+2, dumm...@gmail.com 
>> wrote:
>>>
>>> Thanks for the reply. But I can go get github.com/xtaci/kcp-go and use 
>>> it without problem.
>>>
>>> So I need config something to support socket packing, Right?
>>> I am new for golang And feel no way to go when seeing the error and I 
>>> didn't google the solution about how to fix it. 
>>> It's very appreciated if you can give me some hints about the root 
>>> reason of this problem or the possible sollution. 
>>>
>>> 在 2017年10月16日星期一 UTC+8下午5:11:52,Elias Naur写道:
>>>>
>>>> I think this is a problem with the kcp-go package. Building the package 
>>>> for darwin/arm64 gives me the same error:
>>>>
>>>> $ GOOS=darwin GOARCH=arm64 go install github.com/xtaci/kcp-go
>>>> # golang.org/x/net/internal/socket
>>>> dev/go/src/golang.org/x/net/internal/socket/cmsghdr.go:9:10: 
>>>> undefined: cmsghdr
>>>>
>>>>  - elias
>>>>
>>>>

-- 
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: gomobile bind doesn't work for socket.

2017-10-16 Thread Elias Naur
I was wrong. The root cause seem to be that the zsys_darwin_arm64.go (for 
iOS arm64) is missing from golang.org/x/net/internal/socket. There is a 
zsys_darwin_arm.go (for iOS arm), so it should be easy to add. You should 
raise an issue on the golang bug tracker.

 - elias

On Monday, October 16, 2017 at 11:33:44 AM UTC+2, dumm...@gmail.com wrote:
>
> Thanks for the reply. But I can go get github.com/xtaci/kcp-go and use it 
> without problem.
>
> So I need config something to support socket packing, Right?
> I am new for golang And feel no way to go when seeing the error and I 
> didn't google the solution about how to fix it. 
> It's very appreciated if you can give me some hints about the root reason 
> of this problem or the possible sollution. 
>
> 在 2017年10月16日星期一 UTC+8下午5:11:52,Elias Naur写道:
>>
>> I think this is a problem with the kcp-go package. Building the package 
>> for darwin/arm64 gives me the same error:
>>
>> $ GOOS=darwin GOARCH=arm64 go install github.com/xtaci/kcp-go
>> # golang.org/x/net/internal/socket
>> dev/go/src/golang.org/x/net/internal/socket/cmsghdr.go:9:10: undefined: 
>> cmsghdr
>>
>>  - elias
>>
>>

-- 
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: gomobile bind doesn't work for socket.

2017-10-16 Thread Elias Naur
I think this is a problem with the kcp-go package. Building the package for 
darwin/arm64 gives me the same error:

$ GOOS=darwin GOARCH=arm64 go install github.com/xtaci/kcp-go
# golang.org/x/net/internal/socket
dev/go/src/golang.org/x/net/internal/socket/cmsghdr.go:9:10: undefined: cmsghdr

 - elias

-- 
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] Gomobile and SAF

2017-10-12 Thread Elias Naur
Hi,

As I noted on the issue, you should avoid the reverse binding for now and use 
Go interfaces instead. The following change to the gomobile bind example 
demonstrates the technique:

diff --git 
a/example/bind/android/app/src/main/java/org/golang/example/bind/MainActivity.java
 
b/example/bind/android/app/src/main/java/org/golang/example/bind/MainActivity.java
index 47248d9..fce9a7b 100644
--- 
a/example/bind/android/app/src/main/java/org/golang/example/bind/MainActivity.java
+++ 
b/example/bind/android/app/src/main/java/org/golang/example/bind/MainActivity.java
@@ -11,6 +11,8 @@ import android.os.Bundle;
 import android.widget.TextView;
 
 import hello.Hello;
+import hello.ContentProvider;
+import hello.Writer;
 
 public class MainActivity extends Activity {
 
@@ -25,5 +27,16 @@ public class MainActivity extends Activity {
 // Call Go function.
 String greetings = Hello.greetings("Android and Gopher");
 mTextView.setText(greetings);
+
+   Hello.initContentProvider(new ContentProvider() {
+   @Override public Writer open(String name) throws 
Exception {
+   return new Writer() {
+   @Override public long write(byte[] 
data) throws Exception {
+   return 0;
+   }
+   };
+   }
+   });
+   Hello.useContentProvider();
 }
 }
diff --git a/example/bind/android/hello/build.gradle 
b/example/bind/android/hello/build.gradle
index 92fb0bd..11345e4 100644
--- a/example/bind/android/hello/build.gradle
+++ b/example/bind/android/hello/build.gradle
@@ -4,7 +4,7 @@
  */
 
 plugins {
-id "org.golang.mobile.bind" version "0.2.9"
+id "org.golang.mobile.bind" version "0.2.7"
 }
 
 gobind {
diff --git a/example/bind/hello/hello.go b/example/bind/hello/hello.go
index 2d98ff9..96301da 100644
--- a/example/bind/hello/hello.go
+++ b/example/bind/hello/hello.go
@@ -10,3 +10,28 @@ import "fmt"
 func Greetings(name string) string {
return fmt.Sprintf("Hello, %s!", name)
 }
+
+var contentProvider ContentProvider
+
+type ContentProvider interface {
+   Open(name string) (Writer, error)
+}
+
+type Writer interface {
+   Write(b []byte) (int, error)
+}
+
+func InitContentProvider(cp ContentProvider) {
+   contentProvider = cp
+}
+
+func UseContentProvider() {
+   w, err := contentProvider.Open("test")
+   if err != nil {
+   // handle error
+   }
+   _, err = w.Write([]byte("data"))
+   if err != nil {
+   // handle error
+   }
+}


The gobind plugin downgrade is https://github.com/golang/go/issues/21594.

 - elias

-- 
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] cannot assign 1 values to 2 variables [simple error handling]

2017-09-18 Thread Elias Naur
Just to expand on Ian's reply: you seem to want to have loadPage return any 
errors, similar to what ReaedFile does. If so, you need to declare loadPage 
to return two values, like so:

func loadPage(title string) (*Page, error)

And return a nil *Page and the error if ReadFile fails:

body, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}

The same goes for the sucess path:

return {Title: title, Body: body}, nil

HTH,
 - elias

On Monday, September 18, 2017 at 7:25:39 AM UTC+2, Ian Lance Taylor wrote:
>
> You are trying to assign the result of loadPage to two variables, but 
> loadPage only returns one result.
>
> In the "here is OK" section you are assigning the result of 
> ioutil.ReadFile to two variables.  That is OK because ioutil.ReadFile 
> returns two results.  You can see the definition of ioutil.ReadFile at 
> https://golang.org/src/io/ioutil/ioutil.go#L45 .
>
> Ian
>
>
>
> On Sun, Sep 17, 2017 at 8:00 PM, Ângelo Chida  > wrote:
>
>> Hi, I'm new in Golang but I'm PHP StackDev since 10 years ago
>> I'm following this tutorial https://golang.org/doc/articles/wiki/ on how 
>> to build a web app, but I'm stuck on some error and can't find anywhere a 
>> solution. Please help
>> Take a look at the image
>> My go version is 1.9
>>
>>
>> *sorry
>>  
>> for poor english, it is not my native language 
>> 
>>
>>
>>
>> -- 
>> 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: DNS problem and cross-compile to GOOS=android|linux GOARCH=arm + CC=

2017-09-15 Thread Elias Naur
On Friday, September 15, 2017 at 7:15:25 PM UTC+2, ulde...@strongdm.com 
wrote:

> Hi,
>
>
> It fails when I run:
> ```
> CC="${GOPATH}/android-ndk/bin/arm-linux-androideabi-gcc" GOOS=android 
> GOARCH=arm GOARM=7 go build
> # github.com/ucirello/android-test
> warning: unable to find runtime/cgo.a
> ```
>
>
This seems like the standard library is not built for android. Have you 
tried running

CC_FOR_TARGET= GOARCH=... ./androidtest.bash

from the src directory? With that, you shouldn't need to set CC. 

 - elias

-- 
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] Why is Shiny's text rendering quantizes to the pixel grid?

2017-09-15 Thread Elias Naur
Hi,

Working on a immediate mode fork of Shiny, I ran into this comment:

// We round up the ascent and descent separately, instead of asking for
// the metrics' height, since we quantize the baseline to the integer
// pixel grid. For example, if ascent and descent were both 3.2 pixels,
// then the naive height would be 6.4, which rounds up to 7, but we
// should really provide 8 pixels (= ceil(3.2) + ceil(3.2)) between
// each line to avoid overlap.

(
https://github.com/golang/exp/blob/50c28f97489115b511c3104aafe83f148deb39a9/shiny/text/text.go#L151
)

Is there a fundamental reason to quantize the baseline? The
golang.org/x/image/font package offers (fixed point) subpixel accuracy, so
why not use it? Is there a performance advantage or is it easier to cache
pre-rendered text?

Finally, is the origin argument of node.Paint(Base) for the same reason? It
seems to me it could be baked into the context's src2dst matrix.

 - elias

-- 
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: gomobile socket permissions

2017-08-16 Thread Elias Naur
Hi,

Have you tried the golang.org/x/mobile/example/network example? It's a 
"pure" Go app that doesn't use Java bindings, but its network access 
properties should be the same.

If that works, you could modify golang.org/x/mobile/example/bind to 
introduce a simple http.Get (or net.Dial) and see if that works. If so, you 
have a basis for bisection.

 - elias

On Wednesday, August 16, 2017 at 4:54:58 PM UTC+2, Dan Ballard wrote:
>
> https://github.com/dballard/AndroidOD is the Java side
> Manifest 
>
> https://github.com/dballard/AndroidOD/blob/master/app/src/main/AndroidManifest.xml
>
>  
> http://schemas.android.com/apk/res/android; 
>  package="im.ricochet.androidod"> 
>
>   
>   />
>
> Connect Activity
>
> https://github.com/dballard/AndroidOD/blob/master/app/src/main/java/im/ricochet/androidod/ConnectActivity.java
>
> Where the previous snippets are from setting the policy, opening a socket 
> in java and calling go
>
> The Go code it calls is a simple wrapper:
>
> https://github.com/dballard/goRicochetMobile/blob/master/goRicochetMobile.go
>
> of 
> https://github.com/s-rah/go-ricochet
>
> The actual connection should be happening in
>
> https://github.com/s-rah/go-ricochet/blob/master/vendor/github.com/yawning/bulb/conn.go
> Dial() at line 214
>
>
>
> On Tuesday, August 15, 2017 at 8:58:21 AM UTC-7, Dan Ballard wrote:
>>
>> StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().
>> permitAll().build();
>> StrictMode.setThreadPolicy(policy);
>> Socket socket = new Socket("127.0.0.1", 5051);
>>
>> Works, no error. When I then:
>>
>> GoRicochetMobile.echoBot(privateKey);
>>
>> I get:
>>
>> 08-15 08:24:27.441 26959-26959/? I/GoLog: error setting up onion service: 
>> dial tcp4 127.0.0.1:9051: getsockopt: connection refused
>>
>> Has any one had anyluck getting go code to make network connections on 
>> Android?
>>
>>

-- 
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: gomobile socket permissions

2017-08-15 Thread Elias Naur
I've only had problems when I forgot to ask for android.permission.INTERNET 
whic I assume you have. Can you post a more complete program that 
demonstrates the problem?

 - elias

On Tuesday, August 15, 2017 at 5:58:21 PM UTC+2, Dan Ballard wrote:
>
> StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().
> permitAll().build();
> StrictMode.setThreadPolicy(policy);
> Socket socket = new Socket("127.0.0.1", 5051);
>
> Works, no error. When I then:
>
> GoRicochetMobile.echoBot(privateKey);
>
> I get:
>
> 08-15 08:24:27.441 26959-26959/? I/GoLog: error setting up onion service: 
> dial tcp4 127.0.0.1:9051: getsockopt: connection refused
>
> Has any one had anyluck getting go code to make network connections on 
> Android?
>
>

-- 
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] Re: gobind generated constructor for struct containing []byte sometimes corrupts data

2017-08-04 Thread Elias Naur
Den fre. 4. aug. 2017 01.26 skrev Antonio Marcedone <a.marced...@gmail.com>:

> Thanks! The only information I could find about this on the gobind
> documentation is (https://godoc.org/golang.org/x/mobile/cmd/gobind)
>
> - Byte slice types. Note that byte slices are passed by reference,
>   and support mutation.
>
> However, this version of the code still shows the problem:
>
>> String s = "This is a test string";
>>
> byte[] b = s.getBytes();
>> MyStruct struct = new MyStruct(b);
>
>
>> tv.append("\nFirst time: "+ new String(struct.getE(), "UTF-8"));
>>
> tv.append("\nOriginal: "+ new String(b, "UTF-8"));
>>
>>
Sometimes, the Java runtime will copy the byte array before passing it to
Go and then copy it back just before returning from the call.

Holding on to references to Java byte arrays really is not supported. If
you want to know the technical details look up GetByteArrayElements and
ReleaseByteArrayElements in the JNI reference documentation.


> which is confusing as here b shold not be garbage collected, so even a
> pass by reference should work. Can you point me somewhere I can read more
> about this issue please?
>
> Also, are the automatically generated setters (i.e. struct.setE() ) doing
> the necessary cloning, or should I implement my own?
>

The setters are cloning. If not it's a bug :)


> Thanks a lot again!
>
> On Thursday, August 3, 2017 at 1:33:03 AM UTC-7, Elias Naur wrote:
>
>> Yes, byte slices are special and are not reference counted like other
>> objects. You need to copy it on the Go side.
>>
>> - elias
>>
>> Den tor. 3. aug. 2017 03.21 skrev Antonio Marcedone <a.mar...@gmail.com>:
>>
> My intuition above seems to contrast with
>>> https://godoc.org/golang.org/x/mobile/cmd/gobind:
>>>
>>> Avoid reference cycles
>>>> The language bindings maintain a reference to each object that has been
>>>> proxied. When a proxy object becomes unreachable, its finalizer reports
>>>> this fact to the object's native side, so that the reference can be
>>>> removed, potentially allowing the object to be reclaimed by its native
>>>> garbage collector. The mechanism is symmetric.
>>>
>>>
>>>
>>> On Wednesday, August 2, 2017 at 5:30:16 PM UTC-7, Antonio Marcedone
>>> wrote:
>>>>
>>>> I am not sure I understand what is going on here.
>>>> For reference, the relevant code is:
>>>>
>>>> String s = "This is a test string";
>>>>
>>>> MyStruct struct = new MyStruct(s.getBytes("UTF-8"));
>>>> //struct.setE(s.getBytes("UTF-8"));
>>>> tv.append("\nFirst time: "+ new String(struct.getE(), 
>>>> "UTF-8"));
>>>>
>>>>
>>>> with corresponding go part:
>>>>
>>>> package test
>>>>
>>>> type MyStruct struct{
>>>> E []byte}
>>>>
>>>> func NewMyStruct(e []byte) *MyStruct{
>>>> return {e}}
>>>>
>>>>
>>>> so s.getBytes allocates a new byte[] (in Java). Then the MyStruct
>>>> constructor is called, and it gets a reference to such byte[].
>>>> Are you saying that since the Java garbage collector is not aware that
>>>> a reference to that array is stored in some variable in the go code, then
>>>> it just deletes it as soon as the constructor returns?
>>>> And then the getE method just reads whatever happens to be in memory
>>>> where the old array was without throwing any error despite the fact that
>>>> the old byte[] has been garbage collected and might have been overwritten
>>>> by arbitrary data?
>>>>
>>>> Thanks a lot for your response!
>>>> Antonio
>>>>
>>>> On Wednesday, August 2, 2017 at 3:30:06 PM UTC-7, Elias Naur wrote:
>>>>>
>>>>> []byte arguments are passed by reference, not copied. You need to copy
>>>>> any byte slices you retain after the function or method call.
>>>>>
>>>>>  - elias
>>>>>
>>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "golang-nuts" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/golang-nuts/TLy4sa3XRec/unsubscribe.
>>>
>> To unsubscribe from this group and all its topics, 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 a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/TLy4sa3XRec/unsubscribe.
> To unsubscribe from this group and all its topics, 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] Re: gobind generated constructor for struct containing []byte sometimes corrupts data

2017-08-03 Thread Elias Naur
Yes, byte slices are special and are not reference counted like other
objects. You need to copy it on the Go side.

- elias

Den tor. 3. aug. 2017 03.21 skrev Antonio Marcedone <a.marced...@gmail.com>:

> My intuition above seems to contrast with
> https://godoc.org/golang.org/x/mobile/cmd/gobind:
>
> Avoid reference cycles
>> The language bindings maintain a reference to each object that has been
>> proxied. When a proxy object becomes unreachable, its finalizer reports
>> this fact to the object's native side, so that the reference can be
>> removed, potentially allowing the object to be reclaimed by its native
>> garbage collector. The mechanism is symmetric.
>
>
>
> On Wednesday, August 2, 2017 at 5:30:16 PM UTC-7, Antonio Marcedone wrote:
>>
>> I am not sure I understand what is going on here.
>> For reference, the relevant code is:
>>
>> String s = "This is a test string";
>>
>> MyStruct struct = new MyStruct(s.getBytes("UTF-8"));
>> //struct.setE(s.getBytes("UTF-8"));
>> tv.append("\nFirst time: "+ new String(struct.getE(), "UTF-8"));
>>
>>
>> with corresponding go part:
>>
>> package test
>>
>> type MyStruct struct{
>> E []byte}
>>
>> func NewMyStruct(e []byte) *MyStruct{
>> return {e}}
>>
>>
>> so s.getBytes allocates a new byte[] (in Java). Then the MyStruct
>> constructor is called, and it gets a reference to such byte[].
>> Are you saying that since the Java garbage collector is not aware that a
>> reference to that array is stored in some variable in the go code, then it
>> just deletes it as soon as the constructor returns?
>> And then the getE method just reads whatever happens to be in memory
>> where the old array was without throwing any error despite the fact that
>> the old byte[] has been garbage collected and might have been overwritten
>> by arbitrary data?
>>
>> Thanks a lot for your response!
>> Antonio
>>
>> On Wednesday, August 2, 2017 at 3:30:06 PM UTC-7, Elias Naur wrote:
>>>
>>> []byte arguments are passed by reference, not copied. You need to copy
>>> any byte slices you retain after the function or method call.
>>>
>>>  - elias
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/TLy4sa3XRec/unsubscribe.
> To unsubscribe from this group and all its topics, 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.


[go-nuts] gobind generated constructor for struct containing []byte sometimes corrupts data

2017-08-02 Thread Elias Naur
[]byte arguments are passed by reference, not copied. You need to copy any byte 
slices you retain after the function or method call.

 - elias

-- 
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] Shiny

2017-07-16 Thread Elias Naur
Hi,

I had plans to work on a GUI library that follows many of the design 
choices from Flutter. In particular, I'd like to experiment with immediate 
mode drawing and a layout manager based on Cassowary. As backend I plan to 
avoid too much upfront work and bind to Skia. I'd be very interested in 
your approach as well.

 - elias

On Sunday, July 16, 2017 at 1:24:37 PM UTC+2, Joe Blue wrote:
>
> Hey
>
> All gophers that want a GUI toolkit... 
> We are doing a bring up that is planned to work on all desktops, mobile 
> and embedded.
>
> Support the following app types:: 
> forms, 2d surface and 3d surface.
>
> Will have:
> Material design components, virtual keyboard, cut and paste, audio and 
> video capture and playback.
> Intimate gesture control and keyboard mapping.
> Printing via pdf
>
> We are right now working out if we use OpenGL or Vulkan.
> Also the best immutable data binding approach.
>
> Then the long work on building pixel perfect material design conformance 
> with CI testing of it.
>
> If you interested in forging the approach or have ideas please ping me. 
> The system is not ready for general usage yet so it's better if people that 
> have some golang open GL experience ping me so we can make sure the design 
> covers / considers your needs.
>
> Joeblew99 at Gmail dot com.
>
>

-- 
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: http.Server.Shutdown() crashing?

2017-07-09 Thread Elias Naur
Your main goroutine probably exits before the handler gets to write "after 
shutdown" to the console. Try adding a time.Sleep(1*time.Second) as the 
very last line in main().

 - elias

On Sunday, July 9, 2017 at 1:53:36 PM UTC+2, char...@gmail.com wrote:
>
> Hi,
>
> Go code after calling srv.Shutdown() simply isn't called. There is no 
> error message, no dump, nothing. This is the output after visiting 
> http://localhost:8080/stop on my browser
>
> 2017/07/09 13:58:40 Server starting up...
> 2017/07/09 13:58:44 Server shutting down...
> test - before shutdown
>
> Notice that "test - after shutdown" doesn't show up. What am I doing wrong?
>
> func main() {
> srv := {Addr: ":8080", Handler: http.DefaultServeMux}
>
> http.Handle("/web/", http.FileServer(http.Dir("./")))
> http.HandleFunc("/stop", func(w http.ResponseWriter, r *http.Request) {
> log.Println("Server shutting down...")
> fmt.Println("test - before shutdown")
> err := srv.Shutdown(context.Background())
> fmt.Println("test - after shutdown")
> log.Println("Error: %v", err)
> })
> http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
> log.Println("Got request")
> time.Sleep(6000 * time.Millisecond)
> fmt.Fprintf(w, "Hello @ %s", time.Now())
> log.Println("Finished request")
> })
>
> log.Println("Server starting up...")
> if err := srv.ListenAndServe(); err != http.ErrServerClosed {
> log.Fatalf("Server startup failed! Error: %v", err)
> }
> }
>
>
>

-- 
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: x/mobile: using syscalls on iOS

2017-06-27 Thread Elias Naur
I believe this is https://github.com/golang/go/issues/17490 . I don't know 
if any apps have been rejected because of the use of raw syscalls. I know 
of several apps that were accepted.

 - elias

On Tuesday, June 27, 2017 at 2:44:59 PM UTC+2, petra...@minus5.hr wrote:
>
> Hello,
>
>
> While on WWDC, an Apple engineer who works on compilers and build process 
> in Xcode told me that there is a problem with frameworks made with 
> gomobile. 
> So, Go is using syscalls on iOS, and that is not allowed because it's 
> private API and Apple doesn't guarantee ABI stability on iOS updates. 
> I've already read about problems you've had because of this, e.g. fixing 
> gettimeofday ABI change on iOS 10 
> .
>
> Is there a way to avoid syscalls in frameworks produced with gomobile?
> Are apps getting rejected on AppStore because of that?
>
>
> Regards,
> Petra
>

-- 
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: Attemping a native Go android app, running into gobind error

2017-06-26 Thread Elias Naur
Hi Dan,

The gomobile reverse mode is very experimental, much more so than regular 
gomobile bindings. When in trouble, you'll probably have most luck going 
back to a working state and then add imports and usages of the reverse 
packages one at a time.

Also, while the reverse bindings can be useful to access Java/Android APIs 
easily from Go, I don't think it's realistic to use the reverse bindings to 
create an Androi app in (close to) 100% Go. The fundamental road block I 
found was keeping track of references between Java and Go, making sure no 
reference cycles persisted. And even if you succeeded, there's still iOS.

I'm currently researching ways to create the UI natively in Go; I'm 
particularly interested in the way Flutter is designed.

 - elias

On Monday, June 26, 2017 at 9:29:45 AM UTC+2, Dan Ballard wrote:
>
> So one thing slowing me down a bit is that there don't seem to be doc for 
> gobind reverse stuff, I'm just using AndroidStudio and the gobind gradle 
> plugin to call it. I'm not sure how to invoke it manually to try and debug 
> it easier, and it seems the documentation for 
> https://godoc.org/golang.org/x/mobile/cmd/gobind
> should be updated with invocation examples?
>
> On Saturday, June 24, 2017 at 7:05:50 AM UTC-7, Dan Ballard wrote:
>>
>> I am working on creating an android app entirely in go using the Java og 
>> bindings, as outlined in
>> https://github.com/golang/mobile/tree/master/example/reverse
>>
>> I created a go project under my goroot and an android project in my 
>> ~/AndroidStuioProjects
>> I seem to have the configs right but I seem to have run into a problem
>>
>> :app:gobindDebug
>> 2017/06/23 18:10:03 failed to go install the generated Java wrappers: 
>> exit status 2: go: cannot find GOROOT directory: /usr/local/go
>>
>>  FAILED
>>
>> FAILURE: Build failed with an exception.
>>
>> * What went wrong:
>> Execution failed for task ':app:gobindDebug'.
>> > Process 'command '/home/user/src/go/bin/gobind'' finished with non-zero 
>> exit value 1
>>
>>
>>
>> Which as far as I can tell if caused by
>> https://github.com/golang/go/issues/18209 [x/mobile: gobind ignores 
>> $GOROOT]
>>
>>
>> The only options I see are 
>> 1) put in a very hacky symlink
>> 2) actually look at solving the bug
>>
>> Anyone else see an option I'm missing?
>>
>

-- 
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] Re: Go + Android NDK + Intel Processor

2017-05-01 Thread Elias Naur
On Mon, May 1, 2017 at 9:30 PM Tomi Häsä  wrote:

> The situation with MIPS seems intriguing. There were promises of Android
> MIPS devices for last year:
>
>
> http://www.pcworld.com/article/2601040/first-mobile-device-with-mips-64bit-processor-coming-in-2016.html
>
> State of MIPS regarding Android could be quite dead, if you can trust this
> discussion:
>
>
> https://www.reddit.com/r/Android/comments/4ofdkv/state_of_mips_plus_some_statistics/
>
>
FWIW, Go itself added support for mips32 and mips64 recently, so adding Go
Mobile support probably wouldn't be that much extra work.


> I have stumbled upon mentions of different ARMv[number] discussions like
> this one:
>
>
> https://android.stackexchange.com/questions/34958/what-are-the-minimum-hardware-specifications-for-android
>
> Teaching the basics of processor architectures is probably off-topic on
> the wiki page, but maybe there is a good introduction to processors like
> ARMv5 (minimum for Android) somewhere? If I develop for Android 4+, maybe I
> don't even need to understand processor architectures that much?
>
>
No. AFAIK, every recent (4+) Android device is at least armv7 (or arm64).


> The reason why I'm interested in using Go with Android is I just love the
> simplicity of the syntax of Go. I could use Go instead of C/C++ (I have
> programmed with C++) to add some security by accessing a database or
> something else (save some key/value pairs instead of using Java), if that's
> possible with Go + Android. What do you think about this approach?
>
>
Sure.

 - elias

-- 
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: Go + Android NDK + Intel Processor

2017-05-01 Thread Elias Naur
I've updated the Wiki page. Go Mobile supports arm, arm64, 386 and amd64 
devices and emulators today.

 - elias

On Monday, May 1, 2017 at 6:10:30 PM UTC+2, Tomi Häsä wrote:
>
> Yet another newbie question, sorry.
>
> What does this part in the Gomobile wiki mean:
>
> "Note: Currently only ARM devices and ARM emulating AVDs are supported."
> https://github.com/golang/go/wiki/Mobile
>
> I found this page:
>
> "Android supports 3 different processor architectures: ARM, Intel and 
> MIPS."
>
>
> http://www.androidauthority.com/arm-vs-x86-key-differences-explained-568718/
>
> If I have an Android phone with an Intel processor, like this one:
>
> "Asus Zenfone 2"
> "64-bit Quad Core Intel® Atom™ Z3560/Z3580"
>
> http://www.androidauthority.com/asus-zenfone-2-review-600414/
>
>
> What happens to my app when using an Intel processor? Will it run? Am I 
> just worrying too much? ;)
>
>
>

-- 
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: golang tour - floating point numbers

2017-04-14 Thread Elias Naur
Your expression is (effectively) ((z*z-x)/2)*z. Use parentheses to group 
the 2*z term: (z*z-x)/(2*z).

  - elias

On Friday, April 14, 2017 at 2:30:33 PM UTC+2, ksam...@redhat.com wrote:
>
> Hello,
>
> Am a newbie to golang, and was trying myself with golang tour. 
>
>
> I was trying https://tour.golang.org/flowcontrol/8 and below is my code 
> snippet for the same 
>
> package main
>
> import (
> "fmt"
> "math"
> )
>
> func Sqrt(x float64) float64 {
> z := float64(1)
>
> for i := 0; i < 10; i++ {
> //z = z - (z*z-x)/2*z -- this does not work why ???
> z = z - (float64(z*z)-float64(x))/float64(2*z)
> }
> return float64(z)
> }
>
> func main() {
> fmt.Printf("Ans: %0.2f \n", Sqrt(4))
> fmt.Printf("math.Sqrt: %0.2f", math.Sqrt(4))
> }
>
>
> I assume that all data is handled as float64 only, if you see the 
> commented codes not seem to work especially for simple Sqrt(4) i get an 
> answer of 1.76 instead of 2 ;) .. but after i did the casting to 
> float64(..) it seem to work right.. 
>
> I am not able to understand why .. 
>
> any thoughts ?
>

-- 
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] Re: Go's Deprecation Policy + Android NDK

2017-03-30 Thread Elias Naur
On Thu, Mar 30, 2017 at 5:14 PM Tomi Häsä <tomi.h...@gmail.com> wrote:

> I have been pondering the minimum supported Android version also. First I
> thought of 4.0.3, which I recall is what Android Studio has been
> suggesting. On the other hand, Android 4.3 supports widgets "anywhere" on
> Android Home Screen and I might use widgets with some of my apps. Any
> thoughts on that? *(I don't have my notes with me about the correct
> version numbers regarding 4.0.3 and 4.3.)*
>
>
I'm not sure what you're asking. If you mean the minimum version that Go
could run on, I believe 4.0.3 is new enough to not pose any problems for
you.

If you mean what minimum version your app *should* support, that's a
different question. I use the Android Dashboard

https://developer.android.com/about/dashboards/index.html

to make an informed decision for my own projects. A minimum version of 4.1
or even 4.3 is not unreasonable, I think. In particular if you're just
starting development now.

 - elias



>
> On Thursday, March 30, 2017 at 4:49:52 PM UTC+3, Elias Naur wrote:
>
> Go has very few dependencies on its environment, so it should be able to
> run on quite old phones. I have a 4.1 device still running that I regularly
> test Go (with Go Mobile) on.
>
> I would recommend using the newest Go version for your projects. There are
> often important fixes in newer Go versions for mobile platforms that are
> not backported to older releases. This mostly applies to iOS, but is true
> for Android as well.
>
> Note that the mobile platforms (including Android) are not first-class
> platforms (https://github.com/golang/go/wiki/PortingPolicy), and
> breakages are therefore not release blockers. In practice, however, Go
> works very well on mobile.
>
> Finally, OS'es or architectures are very slowly deprecated; the Go team
> pays attention to its users. For example, the planned removal of armv5
> support was postponed because there were still users for it.
>
>  - elias
>
> On Thursday, March 30, 2017 at 3:35:59 PM UTC+2, Tomi Häsä wrote:
>
> I have been thinking of using Go in Android apps with Android NDK. How
> does the Go deprecation policy affect me in the long run? How old phones
> can I support? Should I use as old Go version as possible for maximum
> compatibility?
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/JYOrMxZVkhU/unsubscribe.
> To unsubscribe from this group and all its topics, 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.


[go-nuts] Re: Go's Deprecation Policy + Android NDK

2017-03-30 Thread Elias Naur
Go has very few dependencies on its environment, so it should be able to 
run on quite old phones. I have a 4.1 device still running that I regularly 
test Go (with Go Mobile) on.

I would recommend using the newest Go version for your projects. There are 
often important fixes in newer Go versions for mobile platforms that are 
not backported to older releases. This mostly applies to iOS, but is true 
for Android as well.

Note that the mobile platforms (including Android) are not first-class 
platforms (https://github.com/golang/go/wiki/PortingPolicy), and breakages 
are therefore not release blockers. In practice, however, Go works very 
well on mobile.

Finally, OS'es or architectures are very slowly deprecated; the Go team 
pays attention to its users. For example, the planned removal of armv5 
support was postponed because there were still users for it.

 - elias

On Thursday, March 30, 2017 at 3:35:59 PM UTC+2, Tomi Häsä wrote:
>
> I have been thinking of using Go in Android apps with Android NDK. How 
> does the Go deprecation policy affect me in the long run? How old phones 
> can I support? Should I use as old Go version as possible for maximum 
> compatibility?
>
>

-- 
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: [gomobile] Is it possible to call my own ObjC code from Go using reverse binding?

2017-01-13 Thread Elias Naur


On Friday, January 13, 2017 at 2:26:11 PM UTC+1, nik.ku...@gmail.com wrote:
>
> Hello, everyone! As I know gomobile now supports reverse binding for ObjC 
> (thanks @elisnaur). I'd like to know - is it working only for system 
> modules or I can use it to call my own ObjC code from go as well?
>

There's nothing special about the system modules as far as gomobile knows. 
However, the reverse generator only looks for ObjC frameworks in the SDK. 
For -target android, there's a -classpath flag to point the generators at 
your own Java code. Something similar should be added to -target ios.

If you'd like to take a stab at it, look for "importModule" in 
golang.org/x/mobile/internal/importers/objc/objc.go where the framework 
lookup is done. You can draw inspiration from how 
internal/importers/java/java.go handles -classpath. For a first attempt, 
I'd add my own framework to the system SDK path and see if it works. If so, 
it's just a matter of plumbing through the flag.

If you'd rather not touch gomobile, please create an issue (feel free to CC 
me) and describe your use case as thorough as possible, with simple ObjC 
code you'd like to reverse bind.

 - elias


-- 
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] Re: Gomobile: Getting errors when trying to build reverse example

2017-01-12 Thread Elias Naur
Every required change should be in now. Please try again.

On Friday, January 6, 2017 at 8:09:22 PM UTC+1, glenford williams wrote:
>
> thanks. any idea when this will merged?
>
> On Sunday, 1 January 2017 17:28:01 UTC-5, Elias Naur wrote:
>>
>> That was more difficult than expected. The CL series ending with
>>
>> https://go-review.googlesource.com/c/34777/
>>
>> should fix both problems. A backwards incompatible change had to be made 
>> to implicit "this" types. Instead of using a super class, you now use the 
>> wrapped type for the generated class. Refer to the "reverse" example to see 
>> an example of this.
>>
>>  - elias
>>
>>
>> On Monday, December 26, 2016 at 9:36:35 PM UTC+1, andrey mirtchovski 
>> wrote:
>>>
>>>
>>> I am attaching a simple reproduction of the package name crash (using 
>>> reverse.go). There is no need to modify the android manifest file for this 
>>> to trigger. The error I see is given below.
>>>
>>> I'm also attaching a proposed fix for the renaming clash which works for 
>>> my case. I can submit it as a CL or you can do it if you'd prefer as it 
>>> would be probably faster (I've signed the CLA in the past, no issue there). 
>>>
>>>
>>> without the proposed fix:
>>>
>>> /Users/aam/bin/gomobile: go build 
>>> -pkgdir=/Users/aam/pkg/gomobile/pkg_android_amd64 -tags="" -i 
>>> -buildmode=c-shared 
>>> -o=/var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/android/src/main/jniLibs/x86_64/libgojni.so
>>>  
>>> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/androidlib/main.go
>>>  
>>> failed: exit status 2
>>> # 
>>> _/var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/gomobile_bind
>>> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/gomobile_bind/go_reversemain.go:20:
>>>  
>>> app redeclared as imported package name
>>> previous declaration at 
>>> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/gomobile_bind/go_reversemain.go:17
>>> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/gomobile_bind/go_reversemain.go:96:
>>>  
>>> undefined: "Java/android/support/v7/app".Service
>>> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/gomobile_bind/go_reversemain.go:100:
>>>  
>>> undefined: "Java/android/support/v7/app".Service
>>> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/gomobile_bind/go_reversemain.go:144:
>>>  
>>> undefined: "Java/android/support/v7/app".Service
>>> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/gomobile_bind/go_reversemain.go:148:
>>>  
>>> undefined: "Java/android/support/v7/app".Service
>>>
>>>
>>> With the fix the project builds successfully (and, in my original code, 
>>> the service is started after correctly defining it in the manifest).
>>>
>>>

-- 
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] Re: Gomobile: Getting errors when trying to build reverse example

2017-01-01 Thread Elias Naur
That was more difficult than expected. The CL series ending with

https://go-review.googlesource.com/c/34777/

should fix both problems. A backwards incompatible change had to be made to 
implicit "this" types. Instead of using a super class, you now use the 
wrapped type for the generated class. Refer to the "reverse" example to see 
an example of this.

 - elias


On Monday, December 26, 2016 at 9:36:35 PM UTC+1, andrey mirtchovski wrote:
>
>
> I am attaching a simple reproduction of the package name crash (using 
> reverse.go). There is no need to modify the android manifest file for this 
> to trigger. The error I see is given below.
>
> I'm also attaching a proposed fix for the renaming clash which works for 
> my case. I can submit it as a CL or you can do it if you'd prefer as it 
> would be probably faster (I've signed the CLA in the past, no issue there). 
>
>
> without the proposed fix:
>
> /Users/aam/bin/gomobile: go build 
> -pkgdir=/Users/aam/pkg/gomobile/pkg_android_amd64 -tags="" -i 
> -buildmode=c-shared 
> -o=/var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/android/src/main/jniLibs/x86_64/libgojni.so
>  
> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/androidlib/main.go
>  
> failed: exit status 2
> # 
> _/var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/gomobile_bind
> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/gomobile_bind/go_reversemain.go:20:
>  
> app redeclared as imported package name
> previous declaration at 
> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/gomobile_bind/go_reversemain.go:17
> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/gomobile_bind/go_reversemain.go:96:
>  
> undefined: "Java/android/support/v7/app".Service
> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/gomobile_bind/go_reversemain.go:100:
>  
> undefined: "Java/android/support/v7/app".Service
> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/gomobile_bind/go_reversemain.go:144:
>  
> undefined: "Java/android/support/v7/app".Service
> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gomobile-work-174727778/gomobile_bind/go_reversemain.go:148:
>  
> undefined: "Java/android/support/v7/app".Service
>
>
> With the fix the project builds successfully (and, in my original code, 
> the service is started after correctly defining it in the manifest).
>
>

-- 
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] Anyone with a spare mac machine to setup new iOS builders?

2016-12-27 Thread Elias Naur
Hi,

The darwin/arm and darwin/arm64 (iOS) builders have been down most of the 
Go 1.8 development cycle, as discussed here:

https://groups.google.com/forum/#!topic/golang-dev/s0zT1uANSv8

That thread resulted in Josh offering me an iPhone with a broken display as 
a new iOS builder. I hadn't seriously thought about running the builders 
myself, but it seems like a sensible next step.

However, to run an iOS builder I would need a host macOS machine to drive 
the iPhone. If any of you happen to have a spare mac mini or similar that 
can run a recent version of macOS (and Xcode), I would appreciate it 
greatly if you donated it as builder. An old laptop might work, but I don't 
know if it can run 24x7 with its lid closed.

 - elias

-- 
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] Re: Gomobile: Getting errors when trying to build reverse example

2016-12-25 Thread Elias Naur
Hi,

Can I persuade you to send a complete example that demonstrates the package 
name clash problem and one that demonstrates the runtime JNI crash? Thanks.

 - elias

On Saturday, December 24, 2016 at 11:27:56 PM UTC+1, andrey mirtchovski 
wrote:
>
> Apologies for the digression.
>  
>
>> This suggests that you still have multiple `app` imports without each 
>> having a unique name. Double check your imports in all source files being 
>> compiled.
>>
>
> I have renamed both imports to something else and ensured there is nothing 
> importing or using "app", however gomobile generates a gomain_bind.go file 
> that doesn't take into account the renames:
>
> 
> // File is generated by gobind. Do not edit.
> package gomobile_bind
>
> /*
> #include 
> #include 
> #include "seq.h"
> #include "myapp.h"
>
> */
> import "C"
>
> import (
> "Java/android/app"
> "Java/android/content"
> "Java/android/os"
> "Java/android/support/v7/app"
> "myapp"
> _seq "golang.org/x/mobile/bind/seq"
> )
> 
>
> I think i'll poke around gomobile to try and make
>
>
>> > import "Java/android/app/Service"
>>
>> I'd imagine `Service` is not a package and not something you can import. 
>> You'd simply access it (whatever *it* is in the bindings) from the `app` 
>> import.
>>
>>
> I refer you to the section titled "Importing Java Classes and Interfaces 
> from Go" which describes the use of static methods and constants via the 
> aforementioned import of an inner class: 
> https://github.com/golang/go/issues/16876
>

-- 
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] Gomobile: Getting errors when trying to build reverse example

2016-12-24 Thread Elias Naur
It seems your gobind command is out of date. Update it and gomobile with 

go install golang.org/x/mobile/cmd/...

 - elias 

-- 
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: gomobile: support/v7/app vs app

2016-12-19 Thread Elias Naur
Use a package rename for one of the imports:

import sapp "android.support.v7.app.AppCompatActivity"

And then use "sapp" for the support library app Java package.

- Elias
man. 19. dec. 2016 kl. 06.59 skrev andrey mirtchovski :

> The main activity in the reverse example uses a
> support/v7/app.AppCompatActivity (as it should), however if I want to add
> an app.Service service to the android app gomobile encounters duplicate
> import errors:
>
>gomobile_bind/go_appmain.go:20: app redeclared as imported package name
>
> If I attempt to resolve this by renaming v7/app gomobile still complains:
>
>gomobile_bind/go_appmain.go:31: undefined:
> "Java/android/support/v7/app".Service
>
> (I suspect it doesn't propagate the rename, but I have not yet looked at
> the generated code).
>
> Essentially I have two files (activity.go and service.go) which each
> import something called "app", one from android.support.v7.app, the other
> from android.app... I can successfully refactor the service into a separate
> package but then I'm only allowed to use one package name in the manifest
> and I don't see how I can reference the second package by name.
>
> http://schemas.android.com/apk/res/android;
> package="go.app" >
>  android:label="MyApp"
>  android:name=".MainActivity">   
> 
>
> 
> 
> 
>

-- 
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: latest gomobile arm64-only?

2016-12-05 Thread Elias Naur

On Monday, December 5, 2016 at 7:44:23 AM UTC+1, andrey mirtchovski wrote:
>
> I'm having issues with the latest gomobile + reverse java bindings. I 
> have a piece of code that linked with a C library via CGO. Previously 
> (around 6 months ago) everything appeared file: cross compile library 
> with NDK toolchain (gcc), link against go code with cgo, run "gomobile 
> bind -target=android" and everything worked. 
>
> now it appears gomobile has switched to targeting arm64 with clang. I 
> tried compiling my code against 32-bit gcc, 32-bit clang, and 64-bit 
> clang. even though i can create a successful 32-bit arm binary with 
> the standard Go tools, I am unable to create one with gomobile. here's 
> an example of the 32-bit library I'm using (i've also compiled it 
> static): 
>
> /opt/arm-linux-androideabi/sysroot/usr/lib/mylibrary.so: ELF 32-bit 
> LSB shared object, ARM, version 1 (SYSV), dynamically linked (uses 
> shared libs), not stripped 
>
> gradle build however invokes gomobile bind thusly (major parts of the 
> classpaths stripped): 
>
>
> 8< 
> /.../gomobile bind -i -classpath 
> /.../android/android/build/intermediates/exploded-aar/com.android.support/appcompat-v7/24.2.1/jars/classes.jar:[...]:/.../android/android/build/intermediates/classes/debug
>  
>
> -o 
> /var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/gobind-2223404674934856774.aar
>  
>
> -target android -bootclasspath 
> /.../sdk/platforms/android-24/android.jar -x my/project 
>
> gomobile then issues this command and receives the following error: 
>
> /Users/aam/pkg/gomobile/android-ndk-r12b/arm64/bin/aarch64-linux-android-clang
>  
>
> -I . -fPIC -pthread -fno-caret-diagnostics -Qunused-arguments 
> -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build 
> -gno-record-gcc-switches -o $WORK/my/project/_obj/_cgo_.o ...-target 
> aarch64-none-linux-android --sysroot 
> /.../pkg/gomobile/android-ndk-r12b/arm64/sysroot 
> /opt/arm-linux-androideabi/sysroot/usr/lib/mylibrary.a  -lm -lz -pie 
>
> # my/project 
>
> /opt/arm-linux-androideabi/sysroot/usr/lib/mylibrary.a: error adding 
> symbols: File in wrong format 
>
> clang: error: linker command failed with exit code 1 (use -v to see 
> invocation) 
> 8< 
>
> again, this works when using GOOS=arm GOARCH=android CGO_ENABLED=1 go 
> build... also, the reverse example works fine with this setup, but 
> that doesn't attempt any cgo tomfoolery. 
>
> TL;DR: i'm unable to figure out a way to force 32-bit gomobile 
> compilation, especially while staring from outside the "gradle build" 
> wall. 
>


The gradle plugin supports the GOARCH settings which contains a list of the 
architectures you want to include. Use it in your gobind {...} section of 
your build.gradle, along with your "pkg" setting:

apply plugin: "org.golang.mobile.bind"

gobind {
pkg = "...golang.org/x/mobile/example/bind/hello"

GOARCH = "arm"
}


 - elias

-- 
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: gomobile - error building android library on osx

2016-11-02 Thread Elias Naur
Hi,

Please file a new issue with the reproduction steps and the source for a 
(minimal) Go package that demonstrates the problem. Feel free to CC me on 
the issue.

 - elias

On Tuesday, November 1, 2016 at 1:33:07 PM UTC+1, Danilo Luiz Rheinheimer 
Danilo wrote:
>
> Hi,
>
>   I have a gomobile library project. I can build it to android on my linux 
> machine.
>   On my macbook (osx) I am able to build the iOS version.
>   But I am not able to build the android version on OSX.
>
>   Gomobile version :
>
> Danilos-MacBook-Pro:mobileutildemo danilolr$ gomobile version
>
> gomobile version +27a7c7e Fri Oct 21 19:49:24 2016 + (android,ios); 
> androidSDK=/Users/danilolr/Library/Android/sdk/platforms/android-24
>
>
>   Go version :
>
>
> Danilos-MacBook-Pro:mobileutildemo danilolr$ go version
>
> go version go1.7.3 darwin/amd64
>
>
>   The error message is :
>
> go/mobileutildemo/Mobileutildemo.java:9: error: class MobileUtilDemo is 
> public, should be declared in a file named MobileUtilDemo.java
>
> public final class MobileUtilDemo implements Seq.Proxy {
>
>
>   The full gomobile bind --target android -v output is on :
>
>
>   http://pastebin.com/wz2hgveA
>
>
>   I think it can have relation as the case of the file names created by 
> gomobile but I do not know how to fix it.
>
>
> Danilo.
>

-- 
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] Re: gomobile: target=ios, getting incompatible pointer types assigning to 'GoUniverseerror *' from 'goSeqErrorWrapper *' [-Wincompatible-pointer-types]

2016-09-29 Thread Elias Naur
Is there a reason you're not using the gobind gradle plugin? If you need an 
example, the "bind" app from gomobile uses it to automatically generate the 
aar-file during builds.

 - elias

On Thursday, September 29, 2016 at 9:50:17 AM UTC+2, Joe Blue wrote:
>
> upgrading caused a new problem on the android side.
>
> ```
>
> Information:Gradle tasks [:app:generateDebugSources, 
> :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, 
> :app:prepareDebugUnitTestDependencies]
> Error:Execution failed for task ':app:prepareMd01CliUnspecifiedLibrary'.
> > Could not expand ZIP '/Users/apple/workspace/go/src/
> github.com/asdine/brazier/_android/md01/cli/cli.aar'.
> Information:BUILD FAILED
> Information:Total time: 3.155 secs
> Information:1 error
> Information:0 warnings
> Information:See complete output in console
>
> ```
>
> its nuts because when i rename the cli.aar to .zip, i can open it on my 
> osx laptop.
> but android studio seems to not think its NOT a zip.
>
> So i changed the gradle to to this:
>
> configurations.maybeCreate("default")
> artifacts.add("default", 
> file('/Users/apple/workspace/go/src/github.com/asdine/brazier/cli/cli.aar'))
>
> that fixed it.
>
> It seems that when you use Android Studio > New > New Module > Import .Jar / 
> -aar package it does not put the path in the gradle file above.
>
>
> little things i know..
>
>
>
>
>
>
>
>
> On Thu, Sep 29, 2016 at 9:21 AM Joe Blue <joeb...@gmail.com > 
> wrote:
>
>> i upgraded:
>> gomobile version +9640137 Tue Sep 27 16:37:51 2016 + (android,ios); 
>> androidSDK=/Users/apple/Library/Android/sdk/platforms/android-24
>>
>> It fixed all the errors:)
>>
>> thankyou
>>
>>
>>
>>
>> On Thu, Sep 29, 2016 at 9:13 AM Joe Blue <joeb...@gmail.com > 
>> wrote:
>>
>>> thank Elias. Nice
>>>
>>> I am on this version:
>>>
>>> x-MacBook-Pro:rpc apple$ gomobile version
>>>
>>> gomobile version +7573efa Wed Aug 24 22:21:38 2016 + (android,ios); 
>>> androidSDK=/Users/apple/Library/Android/sdk/platforms/android-24
>>>
>>> I will upgrade now and see if i get the same errors. thanks
>>>
>>>
>>>
>>> On Wed, Sep 28, 2016 at 5:06 PM Elias Naur <elias...@gmail.com 
>>> > wrote:
>>>
>>>> Hi,
>>>>
>>>> Use the -work flag to gomobile to output working directory and to 
>>>> preserve the generated files.
>>>>
>>>> What revision are your gomobile tool compiled at? CL 29052 should have 
>>>> fixed that error.
>>>>
>>>>  - elias
>>>>
>>>>
>>>> On Wednesday, September 28, 2016 at 2:14:30 PM UTC+2, Joe Blue wrote:
>>>>>
>>>>>
>>>>> Hey all,
>>>>>
>>>>> i am compiling code across to IOS & Android.
>>>>>
>>>>> On Android things are working ok it seems.
>>>>>
>>>>> But i get this on ios with: gomobile bind --target=ios -v
>>>>>
>>>>>
>>>>>
>>>>> _/var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind
>>>>>
>>>>> # 
>>>>> _/var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind
>>>>>
>>>>> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/GoCli.m:156:11:
>>>>>  
>>>>> warning: incompatible pointer types assigning to 'GoUniverseerror *' from 
>>>>> 'goSeqErrorWrapper *' [-Wincompatible-pointer-types]
>>>>>
>>>>> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/seq.h:32:1:
>>>>>  
>>>>> note: instance method 'initWithError:' is assumed to return an instance 
>>>>> of 
>>>>> its receiver type ('goSeqErrorWrapper *')
>>>>>
>>>>> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/GoCli.m:178:11:
>>>>>  
>>>>> warning: incompatible pointer types assigning to 'GoUniverseerror *' from 
>>>>> 'goSeqErrorWrapper *' [-Wincompatible-pointer-types]
>>>>>
>>>>> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/seq.h:32:1:
>>>>>  
>>>>> note: in

[go-nuts] Re: gomobile: target=ios, getting incompatible pointer types assigning to 'GoUniverseerror *' from 'goSeqErrorWrapper *' [-Wincompatible-pointer-types]

2016-09-28 Thread Elias Naur
Hi,

Use the -work flag to gomobile to output working directory and to preserve 
the generated files.

What revision are your gomobile tool compiled at? CL 29052 should have 
fixed that error.

 - elias

On Wednesday, September 28, 2016 at 2:14:30 PM UTC+2, Joe Blue wrote:
>
>
> Hey all,
>
> i am compiling code across to IOS & Android.
>
> On Android things are working ok it seems.
>
> But i get this on ios with: gomobile bind --target=ios -v
>
>
>
> _/var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind
>
> # 
> _/var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind
>
> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/GoCli.m:156:11:
>  
> warning: incompatible pointer types assigning to 'GoUniverseerror *' from 
> 'goSeqErrorWrapper *' [-Wincompatible-pointer-types]
>
> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/seq.h:32:1:
>  
> note: instance method 'initWithError:' is assumed to return an instance of 
> its receiver type ('goSeqErrorWrapper *')
>
> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/GoCli.m:178:11:
>  
> warning: incompatible pointer types assigning to 'GoUniverseerror *' from 
> 'goSeqErrorWrapper *' [-Wincompatible-pointer-types]
>
> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/seq.h:32:1:
>  
> note: instance method 'initWithError:' is assumed to return an instance of 
> its receiver type ('goSeqErrorWrapper *')
>
> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/GoCli.m:202:11:
>  
> warning: incompatible pointer types assigning to 'GoUniverseerror *' from 
> 'goSeqErrorWrapper *' [-Wincompatible-pointer-types]
>
> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/seq.h:32:1:
>  
> note: instance method 'initWithError:' is assumed to return an instance of 
> its receiver type ('goSeqErrorWrapper *')
>
> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/GoCli.m:228:11:
>  
> warning: incompatible pointer types assigning to 'GoUniverseerror *' from 
> 'goSeqErrorWrapper *' [-Wincompatible-pointer-types]
>
> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/seq.h:32:1:
>  
> note: instance method 'initWithError:' is assumed to return an instance of 
> its receiver type ('goSeqErrorWrapper *')
>
> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/GoCli.m:253:11:
>  
> warning: incompatible pointer types assigning to 'GoUniverseerror *' from 
> 'goSeqErrorWrapper *' [-Wincompatible-pointer-types]
>
> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/seq.h:32:1:
>  
> note: instance method 'initWithError:' is assumed to return an instance of 
> its receiver type ('goSeqErrorWrapper *')
>
> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/GoCli.m:279:11:
>  
> warning: incompatible pointer types assigning to 'GoUniverseerror *' from 
> 'goSeqErrorWrapper *' [-Wincompatible-pointer-types]
>
> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/T/gomobile-work-821936368/src/gomobile_bind/seq.h:32:1:
>  
> note: instance method 'initWithError:' is assumed to return an instance of 
> its receiver type ('goSeqErrorWrapper *')
>
> command-line-arguments
>
> write Cli.framework/Versions/A/Headers/GoCli.h
>
> write Cli.framework/Versions/A/Headers/GoUniverse.h
>
> write Cli.framework/Versions/A/Headers/Cli.h
>
> write Cli.framework/Versions/A/Modules/module.modulemap
>
>
>
> 1. Is there a way to tell the compiler to leave the files in the 
> /var/folders/wp/ff6sz9qs6g71jnm12nj2kbywgp/ 
> location so i can see them. At the moment it deletes them.
>
>
> Regards
>
>
> Joe
>

-- 
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] Mobile + camera

2016-09-23 Thread Elias Naur
Hi Glen,

The proposal for accessing Android APIs directly has landed: 
https://github.com/golang/go/issues/16876. In theory, that should be enough 
for accessing the camera from Go. In practice, the new features are very 
recent and you might encounter problems along the way. Feel free to report 
any issues you encounter and CC them to me :)

 - elias

On Friday, September 23, 2016 at 5:16:08 PM UTC+2, Glen Newton wrote:
>
> Are there any updates on this topic, i.e. can I use Go to talk to the 
> Android camera?
>
> Thanks,
> Glen
>

-- 
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: Request for advice: Developing for Android

2016-09-22 Thread Elias Naur


On Thursday, September 22, 2016 at 6:35:13 PM UTC+2, Peter Kleiweg wrote:
>
>
>
> Op donderdag 22 september 2016 18:28:43 UTC+2 schreef Peter Kleiweg:
>>
>> Op donderdag 22 september 2016 18:08:10 UTC+2 schreef Elias Naur:
>>>
>>>
>>>
>>> On Thursday, September 22, 2016 at 5:34:24 PM UTC+2, Peter Kleiweg wrote:
>>>>
>>>> I try the examples on  https://github.com/golang/go/wiki/Mobile
>>>>
>>>> Native applications -> Building and deploying to Android works fine.
>>>>
>>>> On "SDK applications and generating bindings" I get into problems.
>>>>
>>>> It says: 
>>>>
>>>> go get -d golang.org/x/mobile/example/bind/...
>>>>
>>>> I get:
>>>>
>>>> warning: "golang.org/x/mobile/example/bind/..." matched no packages
>>>> can't load package: package golang.org/x/mobile/example: no 
>>>> buildable Go source files in /home/peter/go/src/
>>>> golang.org/x/mobile/example
>>>>
>>>>
>>> That's odd, and it should definitely work. With Go 1.7.1 and after 
>>> removing my existing $GOPATH/golang.org directory out of the way, 
>>> running
>>>
>>> $ go get -d golang.org/x/mobile/example/bind/. 
>>> <http://golang.org/x/mobile/example/bind/>..
>>>
>>> outputs no error and downloads golang.org/x/mobile just fine. Which 
>>> version of Go are you using? Regardless of this issue, I recommend 1.7.1 
>>> because it contains fixes for several issues on mobiles, in particular iOS.
>>>
>>
>> (peter) ~ go version
>> go version go1.7.1 linux/amd64
>> (peter) ~ go env
>> GOARCH="amd64"
>> GOBIN=""
>> GOEXE=""
>> GOHOSTARCH="amd64"
>> GOHOSTOS="linux"
>> GOOS="linux"
>> GOPATH="/home/peter/go"
>> GORACE=""
>> GOROOT="/my/opt/go"
>> GOTOOLDIR="/my/opt/go/pkg/tool/linux_amd64"
>> CC="gcc"
>> GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 
>> -fdebug-prefix-map=/tmp/go-build429704933=/tmp/go-build 
>> -gno-record-gcc-switches"
>> CXX="g++"
>> CGO_ENABLED="1"
>> (peter) ~ go get -v -u -d golang.org/x/mobile/example/bind/...
>> Fetching https://golang.org/x/mobile/example/bind?go-get=1
>> Parsing meta tags from 
>> https://golang.org/x/mobile/example/bind?go-get=1 (status code 200)
>> get "golang.org/x/mobile/example/bind": found meta tag 
>> main.metaImport{Prefix:"golang.org/x/mobile", VCS:"git", RepoRoot:"
>> https://go.googlesource.com/mobile"} at 
>> https://golang.org/x/mobile/example/bind?go-get=1
>> get "golang.org/x/mobile/example/bind": verifying non-authoritative 
>> meta tag
>> Fetching https://golang.org/x/mobile?go-get=1
>> Parsing meta tags from https://golang.org/x/mobile?go-get=1 (status 
>> code 200)
>> golang.org/x/mobile (download)
>> warning: "golang.org/x/mobile/example/bind/..." matched no packages
>> can't load package: package .: no buildable Go source files in 
>> /home/peter
>>
>
> When I do this first, it works:
>
> rm -fr $GOPATH/src/golang.org/x/mobile
>
>  
>

Does subsequent go gets after rm -fr'ing once, or only if you rm -fr before 
go get every time? If it works from now on, you might have had some old 
crud in the existing directory. If you need rm -fr every time, here's the 
output from similar runs on my machine:
 
$ go version
go version go1.7.1 linux/amd64
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/elias/dev/go"
GORACE=""
GOROOT="/home/elias/dev/go-release"
GOTOOLDIR="/home/elias/dev/go-release/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 
-fdebug-prefix-map=/tmp/go-build347214193=/tmp/go-build 
-gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
$ go get -v -u -d golang.org/x/mobile/example/bind/...
Fetching https://golang.org/x/mobile/example/bind/hello?go-get=1
Parsing meta tags from 
https://golang.org/x/mobile/example/bind/hello?go-get=1 (status code 200)
get "golang.org/x/mobile/example/bind/hello": found meta tag 
main.metaImport{Prefix:"golang.org/x/mobile", VCS:"git", 
RepoRoot:"https://go.googlesource.com/mobile"} at 
https://golang.org/x/mobile/example/bind/hello?go-get=1
get "golang.org/x/mobile/example/bind/hello": verifying non-authoritative 
meta tag
Fetching https://golang.org/x/mobile?go-get=1
Parsing meta tags from https://golang.org/x/mobile?go-get=1 (status code 
200)
golang.org/x/mobile (download)
$

 - elias

-- 
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: Request for advice: Developing for Android

2016-09-22 Thread Elias Naur


On Thursday, September 22, 2016 at 5:34:24 PM UTC+2, Peter Kleiweg wrote:
>
> I try the examples on  https://github.com/golang/go/wiki/Mobile
>
> Native applications -> Building and deploying to Android works fine.
>
> On "SDK applications and generating bindings" I get into problems.
>
> It says: 
>
> go get -d golang.org/x/mobile/example/bind/...
>
> I get:
>
> warning: "golang.org/x/mobile/example/bind/..." matched no packages
> can't load package: package golang.org/x/mobile/example: no buildable 
> Go source files in /home/peter/go/src/golang.org/x/mobile/example
>
>
That's odd, and it should definitely work. With Go 1.7.1 and after removing 
my existing $GOPATH/golang.org directory out of the way, running

$ go get -d golang.org/x/mobile/example/bind/. 
..

outputs no error and downloads golang.org/x/mobile just fine. Which version 
of Go are you using? Regardless of this issue, I recommend 1.7.1 because it 
contains fixes for several issues on mobiles, in particular iOS.

 

> But this works:
>
> go get -d github.com/golang/mobile/example/bind/...
>
> But then building in Studio fails.
>
> I edit example/bind/android/hello/build.gradle to set GO and GOPATH, and I 
> change pkg from "golang.org/x/mobile/example/bind/hello" to "
> github.com/golang/mobile/example/bind/hello"
>
> When I do Build -> Make Project, I get:
>
> Executing tasks: [clean, :app:generateDebugSources, 
> :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, 
> :app:generateDebugAndroidTestSources, :app:compileDebugSources, 
> :app:compileDebugUnitTestSources, :app:compileDebugAndroidTestSources]
>
> Configuration on demand is an incubating feature.
> Incremental java compilation is an incubating feature.
> :app:clean
> :hello:clean UP-TO-DATE
> :app:preBuild UP-TO-DATE
> :app:preDebugBuild UP-TO-DATE
> :app:checkDebugManifest
> :app:preReleaseBuild UP-TO-DATE
> :hello:gobind
> :app:prepareAndroidHelloUnspecifiedLibrary
> :app:prepareComAndroidSupportAppcompatV72211Library
> :app:prepareComAndroidSupportSupportV42211Library
> :app:prepareDebugDependencies
> :app:compileDebugAidl
> :app:compileDebugRenderscript
> :app:generateDebugBuildConfig
> :app:generateDebugResValues
> :app:generateDebugResources
> :app:mergeDebugResources
> :app:processDebugManifest
> :app:processDebugResources
> :app:generateDebugSources
> :app:mockableAndroidJar UP-TO-DATE
> :app:preDebugUnitTestBuild UP-TO-DATE
> :app:prepareDebugUnitTestDependencies
> :app:preDebugAndroidTestBuild UP-TO-DATE
> :app:prepareDebugAndroidTestDependencies
> :app:compileDebugAndroidTestAidl
> :app:processDebugAndroidTestManifest
> :app:compileDebugAndroidTestRenderscript
> :app:generateDebugAndroidTestBuildConfig
> :app:generateDebugAndroidTestResValues
> :app:generateDebugAndroidTestResources
> :app:mergeDebugAndroidTestResources
> :app:processDebugAndroidTestResources
> :app:generateDebugAndroidTestSources
> :app:incrementalDebugJavaCompilationSafeguard
> :app:compileDebugJavaWithJavac
> :app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have 
> changed, no previous execution, etc.).
> 
> /home/peter/go/src/
> github.com/golang/mobile/example/bind/android/app/src/main/java/org/golang/example/bind/MainActivity.java:27:
>  
> error: cannot find symbol
> String greetings = Hello.Greetings("Android and Gopher");
> ^
>   symbol:   method Greetings(String)
>   location: class Hello
> 1 error
> 
> :app:compileDebugJavaWithJavac FAILED
>
>
>
>

Java methods names were recently changed to lowercase, but the examples 
weren't updated. That's unfortunate, but thank you for reporting. FWIW, 
I've mailed https://go-review.googlesource.com/c/29594/ to fix the two 
examples and to comment out the GO, GOMOBILE and GOPATH settings from the 
build.gradle file. They're more confusing than helpful.

  - elias

-- 
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: cgo, CString and C.free

2016-09-02 Thread Elias Naur
Hi,

Test() never actually dereference the C string (now dangling) pointer after 
C.free. And even if it did, it is unlikely that the C.free() resulted in 
the memory page your string resided on was unmapped. Segfaults only happen 
if you access unmapped memory.

 - elias

On Friday, September 2, 2016 at 10:43:49 AM UTC+2, kane@sendgrid.com 
wrote:
>
> Hello,
>
> I was expecting it to segfault after deallocating CString. How does it 
> work internally?
>
> func (m *Message) Test() string {
> s := C.CString("test")
> C.free(unsafe.Pointer(s))
> sh := reflect.StringHeader{(uintptr)(unsafe.Pointer(s)), 4}
> return *(*string)(unsafe.Pointer())
> }
>
>

-- 
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: java.lang.UnsatisfiedLinkError: Native method not found: go.Universe.init:()V

2016-07-07 Thread Elias Naur
Thanks for reporting this. It should be fixed 
with https://go-review.googlesource.com/#/c/24800/

 - elias

On Thursday, July 7, 2016 at 8:45:47 AM UTC+2, Lewis Deng wrote:
>
> bind/genjava.go
>
> if g.pkg == nil {
> g.Printf("clazz = (*env)->FindClass(env, %q);\n", "go/Universe$"+
> s.obj.Name())
> } else {
> g.Printf("clazz = (*env)->FindClass(env, %q);\n", 
> g.jniClassSigPrefix(s.obj.Pkg())+s.obj.Name())
> }
>
> this is a temporary measure, please fix it, thanks
>
>
> On Thursday, July 7, 2016 at 12:05:53 PM UTC+8, Lewis Deng wrote:
>>
>>
>>
>>1. 
>>
>>What version of Go are you using (go version)?
>>go version go1.6.2 linux/amd64
>>2. 
>>
>>What operating system and processor architecture are you using (go env
>>)?
>>GOARCH="amd64"
>>GOBIN=""
>>GOEXE=""
>>GOHOSTARCH="amd64"
>>GOHOSTOS="linux"
>>GOOS="linux"
>>GOPATH="/go/"
>>GORACE=""
>>GOROOT="/usr/local/go"
>>GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
>>GO15VENDOREXPERIMENT="1"
>>CC="gcc"
>>GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
>>CXX="g++"
>>CGO_ENABLED="1"
>>3. 
>>
>>What did you do?
>>build SDK applications for android
>>4. 
>>
>>What did you expect to see?
>>no error.
>>5. 
>>
>>What did you see instead?
>>java.lang.UnsatisfiedLinkError: Native method not found: 
>>go.Universe.init:()V
>>
>> I build a aar file for android app with multiple go package:
>> gomobile bind -v -o test.sdk.aar -javapkg test.sdk test.sdk/info 
>> test.sdk/db
>>
>> bind is ok, and I get a aar file, but run in andorid, I get the error:
>> java.lang.UnsatisfiedLinkError: Native method not found: 
>> go.Universe.init:()V
>>
>> If I REMOVE -javapkg test.sdk parameters, everything is OK.
>>
>> How can I use the special java package name? is possible?
>>
>>
>>
>> https://github.com/golang/go/issues/16262
>>
>

-- 
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: can't install gomobile

2016-07-02 Thread Elias Naur
This is my fault, sorry. Please try

https://go-review.googlesource.com/#/c/24720/

then reinstall the gomobile tool and see if that fixes the problem.

 - elias

On Saturday, July 2, 2016 at 4:56:58 AM UTC+2, JM wrote:
>
> windows pro on 64x.  Anyone know what's going on here? Im using the 
> following reference. https://github.com/golang/go/wiki/Mobile
>
> C:\WINDOWS\system32>go get golang.org/x/mobile/cmd/gomobile
>
> C:\WINDOWS\system32>gomobile init
> gomobile: rename 
> C:\GoPath\pkg\gomobile\work-399306583\android-ndk-r12\toolchains\llvm\prebuilt\windows-x86_64\bin\clang
>  
> C:\GoPath\pkg\gomobile\android-ndk-r12\llvm\bin\clang: The system cannot 
> find the file specified.
>
> C:\WINDOWS\system32>
>

-- 
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: x/mobile: How to generate a builtin error type binding by gobind command?

2016-06-27 Thread Elias Naur
You can't, at least not yet. The use of the builtin error type is an 
implementation detail of CL 24100 which is about how errors and exceptions 
are represented in the generated bindings. The CL does make the path toward 
exposing error to the native languages easier in the future.

 - elias

On Monday, June 27, 2016 at 4:16:40 PM UTC+2, tenntenn wrote:
>
> Hi, all.
>
> In order to understand how gomobile bind works, I tried to run commands 
> (gobind, go build and etc.) step by step.
> But I could not generate a builtin error type binding by gobind command.
> This change makes to be able to generate builtin error type bindings by 
> gomobile bind command.
> https://go-review.googlesource.com/#/c/24100/
>
> How can I generate a builtin error type binding by gobind command?
> I think that gobind command also should be fixed to accept nil package 
> (universe scope).
>
> 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.