External go libraries

86 views
Skip to first unread message

phil.se...@gmail.com

unread,
Jan 16, 2017, 6:11:48 PM1/16/17
to llgo-dev
Hi all,

First off all correct me if I'm wrong. I'm relatively new to llgo and golang.

I ran into a problem using external libraries for go and compiling them with llgo. It's showing me the error that it couldn't import the lib because it couldn't find the export data. I figured out that .gox files contains the export data.

So the standard libs are currently on a file format, I only saw on one page:

"FILE.gox, when used, will typically contain nothing but export data. This can be generated from FILE.o via

objcopy -j .go_export FILE.o FILE.gox" (https://golang.org/doc/install/gccgo#Imports)


So I was thinking about two possibilities to access external libs via llgo:

1. Maybe I can put my library somewhere in the llgo folder for having them builded like the standard libs. Is that possible with the current (or a modified) build process? Does the build process of llgo even create these files itself or are they just downloaded somewhere from the internet?

2. Can I compile my external library somehow so I can get the .o-file / the .gox-file?

Thanks in advance.

Cheers,
Phil

Andrew Wilkins

unread,
Jan 16, 2017, 6:50:21 PM1/16/17
to llgo...@googlegroups.com
On Tue, 17 Jan 2017 at 07:11 <phil.se...@gmail.com> wrote:
Hi all,

Hi Phil,
 
First off all correct me if I'm wrong. I'm relatively new to llgo and golang.

I ran into a problem using external libraries for go and compiling them with llgo. It's showing me the error that it couldn't import the lib because it couldn't find the export data. I figured out that .gox files contains the export data.

So the standard libs are currently on a file format, I only saw on one page:

"FILE.gox, when used, will typically contain nothing but export data. This can be generated from FILE.o via

objcopy -j .go_export FILE.o FILE.gox" (https://golang.org/doc/install/gccgo#Imports)


So I was thinking about two possibilities to access external libs via llgo:

1. Maybe I can put my library somewhere in the llgo folder for having them builded like the standard libs. Is that possible with the current (or a modified) build process? Does the build process of llgo even create these files itself or are they just downloaded somewhere from the internet?

How are you building your library? If you use the "llgo-go" command (e.g. "llgo-go install <foo>"), which wraps the standard "go" command so that it invokes llgo, it will install things into the appropriate location.

2. Can I compile my external library somehow so I can get the .o-file / the .gox-file?

The .gox file isn't strictly required (I think it was at one time, but not now at least). If the .gox file isn't there, then gccgo/llgo will pick up the .a file and look for the ".go_export" section in the first object of the archive.

Anyway, if you just use llgo-go then things should work.

Cheers,
Andrew

Thanks in advance.

Cheers,
Phil

--
You received this message because you are subscribed to the Google Groups "llgo-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to llgo-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

phil.se...@gmail.com

unread,
Jan 19, 2017, 10:59:51 AM1/19/17
to llgo-dev
You saved me a lot of time with your hint/explanation about the .a file.

Thanks Andrew!

Reply all
Reply to author
Forward
0 new messages