Skip to content
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

cmd/go: 'go build' ignores *.m files #6536

Closed
hajimehoshi opened this issue Oct 5, 2013 · 12 comments
Closed

cmd/go: 'go build' ignores *.m files #6536

hajimehoshi opened this issue Oct 5, 2013 · 12 comments

Comments

@hajimehoshi
Copy link
Member

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Create foo.m file including some C functions which is used at the other go files,
expecting cgo is used.
2. Run 'go build'

What is the expected output?
Compiling succeeded.

What do you see instead?
Compiling failed with the symbol-undefined errors as if foo.m is ignored.

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Mac OS X

Which version are you using?  (run 'go version')
go version devel +f4d1cb8d9a91 Thu Sep 19 22:34:33 2013 +1000 darwin/amd64

Please provide any additional information below.
*.mm might also be ignored.
@hajimehoshi
Copy link
Member Author

Comment 1:

Compiling Objective-C by cgo succeeded: https://gist.github.com/hajimehoshi/6829595 and
I tried separating the Objective-C source to another *.m file.

@davecheney
Copy link
Contributor

Comment 2:

The go tool only knows how to compile the following file types, by extension.
http://golang.org/pkg/go/build/#Package
objective-c is not one of those.

@hajimehoshi
Copy link
Member Author

Comment 3:

Thank you for your reply. Are C++ files (*.cc or *.cpp) supported officially? They seem
to work well.

@hajimehoshi
Copy link
Member Author

Comment 4:

https://code.google.com/p/go/source/browse/src/pkg/go/build/build.go#341 Apparently, the
latest version suppots them.  OK, thanks.

@minux
Copy link
Member

minux commented Oct 5, 2013

Comment 5:

at least for Go 1.2, this is WAI.

Status changed to WorkingAsIntended.

@ianlancetaylor
Copy link
Contributor

Comment 6:

I agree this is not going to happen for 1.2, but reopening in case we want to do it at
some point in the future.
It would help to know how many people are really interested in linking Objective C code
into Go binaries.  I assume that Objective C can present a C interface, so that calling
Objective C code via cgo is possible in principle.

Labels changed: added priority-later, removed priority-triage.

Status changed to Thinking.

@adg
Copy link
Contributor

adg commented Oct 14, 2013

Comment 7:

Yep, I've just watched a lightning talk at GoCon Tokyo by the reporter of this issue
where he demoed a hybrid Go/Objective C application that uses Cocoa to display a native
OS X window. We should support this. I imagine it will become particularly useful when
we can support darwin/arm.

Status changed to Accepted.

@hajimehoshi
Copy link
Member Author

Comment 8:

Thank you, Andrew!

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 9:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 11:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 12:

Labels changed: added repo-main.

@ianlancetaylor
Copy link
Contributor

Comment 13:

This issue was closed by revision 7861cd6.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants