-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
path/filepath: Walk walks through the same dir over and over again on build with gomobile iOS #35866
Comments
Thank you for this report @blockcodemagic and welcome to the Go project! Interesting, and you say it works alright with |
It wasn't clear to me: does the program fail only on iOS or on macOS as well (given Go 1.13.4)? Please supply a short program and steps to reproduce. |
I tried it only on MacOS and it fails. I will create a test program and share it. |
I created a sample go library and MacOS testapp https://github.com/blockcodemagic/filepathwalk.git Sample app tries to use walk function for users Download dir. Please let me know if you need more information. NOTE: It works on iOS |
@blockcodemagic did you mean to close this issue or was that a mistake? |
Oops sorry. Thanks it was a mistake |
Thank you.
I'm still confused. You say that the program does work on iOS but yet the instructions refer to gomobile bind. Can you provide the exact steps to reproduce the error, given the repository? |
What I mean is, if I create an iOS project in Xcode and link the ".framework" created by gomobile with "-target ios" it works as expected. However, if I create MacOS project in Xcode and use same ".framework", then it goes into a recursive call to the same dir over and over again. You can clone "https://github.com/blockcodemagic/filepathwalk.git" and run the project [clone dir]/testfilepath/testfilepath.xcodeproj on Xcode to see the issue. You can modify the go file https://github.com/blockcodemagic/filepathwalk/blob/master/filepathwalk.go and create ".framework" using "gomobile bind -target ios -o filepathwalk.framework github.com/blockcodemagic/filepathwalk" Please, let me know if you need more information. |
I can reproduce the infinite loop, but can't explain the difference. If you're saying that the program works if you build a Go program using the library, then a way to minimize the reproducer is to cut out gomobile: First, export a function with Cgo:
Then, build your library in c-archive mode:
And then see if you can get the Xcode project to link See https://golang.org/cmd/cgo/#hdr-C_references_to_Go for more details on exporting Go functions to C. |
After building the library, I am having trouble linking with Xcode project. Can anybody help? |
Please elaborate. What are the errors you see? What steps are you trying? |
I created the library as you mentioned. But don't know how to import and use it Xcode MacOs project. Also, I didn't see _cgo_export.h created as mentioned https://golang.org/cmd/cgo/#hdr-C_references_to_Go. |
You don't need the header file, just declare
somewhere in your code. As to the generated .a archive file, I believe you can drag-n-drop it into Xcode and it will include the archive in the build. |
This issue is a possible duplicate of #35767. |
I can still reproduce the error with the fix for #35767, so this issue does not seem to be a duplicate. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Created a go library that uses filepath.Walk(). Works as expected with go application build using this library. The same library created using "gomobile bind -target=ios", with a Mac app, walks through the same dir over and over again and application crashes due to too much heap usage.
What did you expect to see?
Mac app hould work similar to go application.
What did you see instead?
Recursive call and application crash. I works well with gomobile 1.12.7
The text was updated successfully, but these errors were encountered: