Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Empty deb #44

Closed
mperham opened this issue Jun 19, 2014 · 5 comments
Closed

Empty deb #44

mperham opened this issue Jun 19, 2014 · 5 comments

Comments

@mperham
Copy link

mperham commented Jun 19, 2014

I'm trying to build a DEB for a really simple executable. Notice the .deb is 420 bytes, not many KB as I would expect. I am running on OSX 10.9.

~/src/inspeqtor (master=)$ goxc
[goxc] 2014/06/19 13:27:53 Working directory: '/Users/mikep/src/inspeqtor', Config name: 'default'
[goxc] 2014/06/19 13:27:53 Using Go root: /usr/local/Cellar/go/1.3/libexec
[goxc] 2014/06/19 13:27:53 Warning: could not find any main dirs: <nil>
[goxc] 2014/06/19 13:27:53 Running tasks: [go-vet go-test go-install xc codesign copy-resources archive-zip archive-tar-gz pkg-build rmbin downloads-page]
[goxc:go-vet] 2014/06/19 13:27:53 invoking '/usr/local/Cellar/go/1.3/libexec/bin/go vet ./...' from '/Users/mikep/src/inspeqtor'
[goxc:go-vet] 2014/06/19 13:27:53 Task go-vet succeeded
[goxc:go-test] 2014/06/19 13:27:53 invoking '/usr/local/Cellar/go/1.3/libexec/bin/go test ./...' from '/Users/mikep/src/inspeqtor'
?       inspeqtor   [no test files]
[goxc:go-test] 2014/06/19 13:27:54 Task go-test succeeded
[goxc:go-install] 2014/06/19 13:27:54 Task go-install succeeded
[goxc:xc] 2014/06/19 13:27:54 Parallelizing xc for 1 platforms, using max 3 of 4 processors
[goxc:xc] 2014/06/19 13:27:54 mainDirs : []
[goxc:xc] 2014/06/19 13:27:54 Task xc succeeded
[goxc:codesign] 2014/06/19 13:27:54 Task codesign succeeded
[goxc:copy-resources] 2014/06/19 13:27:54 resources: []
[goxc:copy-resources] 2014/06/19 13:27:54 Task copy-resources succeeded
[goxc:archive-zip] 2014/06/19 13:27:54 Task archive-zip succeeded
[goxc:archive-tar-gz] 2014/06/19 13:27:54 Parallelizing archive-tar-gz for 1 platforms, using max 3 of 4 processors
[goxc:archive-tar-gz] 2014/06/19 13:27:54 Artifact(s) archived to /Users/mikep/src/inspeqtor/output/1.0.0/inspeqtor_1.0.0_linux_amd64.tar.gz
[goxc:archive-tar-gz] 2014/06/19 13:27:54 Task archive-tar-gz succeeded
[goxc:pkg-build] 2014/06/19 13:27:54 Task pkg-build succeeded
[goxc:rmbin] 2014/06/19 13:27:54 Task rmbin succeeded
[goxc:downloads-page] 2014/06/19 13:27:54 Task downloads-page succeeded
~/src/inspeqtor (master=)$ ls -l output/1.0.0/
total 24
-rw-------  1 mikep  staff  249 Jun 19 13:27 downloads.md
-rw-r--r--  1 mikep  staff  420 Jun 19 13:27 inspeqtor_1.0.0_amd64.deb
-rw-r--r--  1 mikep  staff   32 Jun 19 13:27 inspeqtor_1.0.0_linux_amd64.tar.gz
~/src/inspeqtor (master=)$ ls
conf.d        inspeqtor.go  inspeqtor.yml monitrun.txt  output
~/src/inspeqtor (master=)$ ls -l
total 136
drwxr-xr-x  5 mikep  staff    170 Jun 17 20:32 conf.d
-rw-r--r--  1 mikep  staff   1446 Jun 17 19:59 inspeqtor.go
-rw-r--r--  1 mikep  staff     32 Jun 16 13:12 inspeqtor.yml
-rw-r--r--  1 mikep  staff  61206 Jun 17 20:34 monitrun.txt
drwxr-xr-x  3 mikep  staff    102 Jun 19 13:15 output
~/src/inspeqtor (master=)$ more .goxc.json 
{
        "ArtifactsDest": "output",
        "Arch": "amd64",
        "Os": "linux",
        "PackageVersion": "1.0.0",
        "ConfigVersion": "0.9"
}
@laher
Copy link
Owner

laher commented Jun 21, 2014

Hi, thanks for the detailed report.

It looks like it hasn't found any go sources with a 'main' package, so the 'xc' task isn't even generating an executable. The .tar.gz looks pretty much empty aswell.

... Up to this point I haven't used goxc for compiling non-main packages, and I guess goxc should really be compiling a '.a' file for these packages. But, is that actually what you're trying to do? (I don't really know the value of a .deb containing a .a file, and I wouldn't know where the deb should install it either). Can you shed some light on what you're trying to achieve please?

Have I interpreted it right? What is inside inspeqtor.go? Is it meant to be a library as I guessed, or is it actually meant to be a 'main' package? What happens when you enter go run inspeqtor.go

Cheers

@mperham
Copy link
Author

mperham commented Jun 21, 2014

I'm new to Go and trying to figure out what I'm doing too. :-). Thanks for the pointer.

On Jun 21, 2014, at 0:23, Am Laher notifications@github.com wrote:

Hi, thanks for the detailed report.

It looks like it hasn't found any go sources with a 'main' package, so the 'xc' task isn't even generating an executable. The .tar.gz looks pretty much empty aswell.

... Up to this point I haven't used goxc for compiling non-main packages, and I guess goxc should really be compiling a '.a' file for these packages. But, is that actually what you're trying to do? (I don't really know the value of a .deb containing a .a file, and I wouldn't know where the deb should install it either). Can you shed some light on what you're trying to achieve please?

Have I interpreted it right? What is inside inspeqtor.go? Is it meant to be a library as I guessed, or is it actually meant to be a 'main' package? What happens when you enter go run inspeqtor.go

Cheers


Reply to this email directly or view it on GitHub.

@mperham
Copy link
Author

mperham commented Jun 21, 2014

Got further, now go build is failing but runs fine when I run it manually:

$ goxc
[goxc] 2014/06/21 14:35:24 Working directory: '/Users/mikep/src/inspeqtor', Config name: 'default'
[goxc] 2014/06/21 14:35:24 Using Go root: /usr/local/Cellar/go/1.3/libexec
[goxc] 2014/06/21 14:35:24 Found 'main package' dirs (len 1): [/Users/mikep/src/inspeqtor]
[goxc] 2014/06/21 14:35:24 Running tasks: [go-vet go-test go-install xc codesign copy-resources archive-zip archive-tar-gz pkg-build rmbin downloads-page]
[goxc:go-vet] 2014/06/21 14:35:24 invoking '/usr/local/Cellar/go/1.3/libexec/bin/go vet ./...' from '/Users/mikep/src/inspeqtor'
[goxc:go-vet] 2014/06/21 14:35:25 Task go-vet succeeded
[goxc:go-test] 2014/06/21 14:35:25 invoking '/usr/local/Cellar/go/1.3/libexec/bin/go test ./...' from '/Users/mikep/src/inspeqtor'
?       inspeqtor   [no test files]
[goxc:go-test] 2014/06/21 14:35:25 Task go-test succeeded
[goxc:go-install] 2014/06/21 14:35:25 invoking '/usr/local/Cellar/go/1.3/libexec/bin/go install -ldflags " -X main.BUILD_DATE '2014-06-21T14:35:25-07:00' -X main.VERSION '1.0.0' "' from '/Users/mikep/src/inspeqtor'
[goxc:go-install] 2014/06/21 14:35:26 Task go-install succeeded
[goxc:xc] 2014/06/21 14:35:26 Parallelizing xc for 1 platforms, using max 3 of 4 processors
[goxc:xc] 2014/06/21 14:35:26 mainDirs : [/Users/mikep/src/inspeqtor]
[goxc:xc] 2014/06/21 14:35:26 building inspeqtor for platform {linux amd64}.
[goxc:xc] 2014/06/21 14:35:26 specified env vars for 'go': [GOOS=linux GOARCH=amd64]
[goxc:xc] 2014/06/21 14:35:26 invoking '/usr/local/Cellar/go/1.3/libexec/bin/go build -ldflags " -X main.BUILD_DATE '2014-06-21T14:35:26-07:00' -X main.VERSION '1.0.0' " -o /Users/mikep/src/inspeqtor/output/1.0.0/linux_amd64/inspeqtor .' from '/Users/mikep/src/inspeqtor'
# github.com/blackjack/syslog
../github.com/blackjack/syslog/logmask.go:19: undefined: Priority
../github.com/blackjack/syslog/logmask.go:27: undefined: Priority
../github.com/blackjack/syslog/writer.go:5: undefined: Priority
[goxc:xc] 2014/06/21 14:35:26 'go' returned error: exit status 2
[goxc:xc] 2014/06/21 14:35:26 Error: exit status 2
[goxc:xc] 2014/06/21 14:35:26 Have you run `goxc -t` for this platform (amd64,linux)???
[goxc:xc] 2014/06/21 14:35:26 Multiple errors (returning first one): [exit status 2]
[goxc:xc] 2014/06/21 14:35:26 Stopping after 'xc' failed with error 'exit status 2'
[goxc] 2014/06/21 14:35:26 RunTasks returned error exit status 2

Do I need to manually build imported packages?

@laher
Copy link
Owner

laher commented Jun 21, 2014

Hi there Mike, that syslog package imports C codem and it's only possible
to cross-compile pure Go code. This is a limitation of the go compiler.
Please read up on this in Dave Cheney's article:
http://dave.cheney.net/2013/07/09/an-introduction-to-cross-compilation-with-go-1-1
Ideally goxc should detect this issue and print a warning message, but it
doesn't at this stage.

So, if you want to cross-compile, you'll need to remove the syslog package.
Rgds

On Sun, Jun 22, 2014 at 9:39 AM, Mike Perham notifications@github.com
wrote:

Got further, now go build is failing but runs fine when I run it manually:

$ goxc
[goxc] 2014/06/21 14:35:24 Working directory: '/Users/mikep/src/inspeqtor', Config name: 'default'
[goxc] 2014/06/21 14:35:24 Using Go root: /usr/local/Cellar/go/1.3/libexec
[goxc] 2014/06/21 14:35:24 Found 'main package' dirs (len 1): [/Users/mikep/src/inspeqtor]
[goxc] 2014/06/21 14:35:24 Running tasks: [go-vet go-test go-install xc codesign copy-resources archive-zip archive-tar-gz pkg-build rmbin downloads-page]
[goxc:go-vet] 2014/06/21 14:35:24 invoking '/usr/local/Cellar/go/1.3/libexec/bin/go vet ./...' from '/Users/mikep/src/inspeqtor'
[goxc:go-vet] 2014/06/21 14:35:25 Task go-vet succeeded
[goxc:go-test] 2014/06/21 14:35:25 invoking '/usr/local/Cellar/go/1.3/libexec/bin/go test ./...' from '/Users/mikep/src/inspeqtor'
? inspeqtor [no test files]
[goxc:go-test] 2014/06/21 14:35:25 Task go-test succeeded
[goxc:go-install] 2014/06/21 14:35:25 invoking '/usr/local/Cellar/go/1.3/libexec/bin/go install -ldflags " -X main.BUILD_DATE '2014-06-21T14:35:25-07:00' -X main.VERSION '1.0.0' "' from '/Users/mikep/src/inspeqtor'
[goxc:go-install] 2014/06/21 14:35:26 Task go-install succeeded
[goxc:xc] 2014/06/21 14:35:26 Parallelizing xc for 1 platforms, using max 3 of 4 processors
[goxc:xc] 2014/06/21 14:35:26 mainDirs : [/Users/mikep/src/inspeqtor]
[goxc:xc] 2014/06/21 14:35:26 building inspeqtor for platform {linux amd64}.
[goxc:xc] 2014/06/21 14:35:26 specified env vars for 'go': [GOOS=linux GOARCH=amd64]
[goxc:xc] 2014/06/21 14:35:26 invoking '/usr/local/Cellar/go/1.3/libexec/bin/go build -ldflags " -X main.BUILD_DATE '2014-06-21T14:35:26-07:00' -X main.VERSION '1.0.0' " -o /Users/mikep/src/inspeqtor/output/1.0.0/linux_amd64/inspeqtor .' from '/Users/mikep/src/inspeqtor'

github.com/blackjack/syslog

../github.com/blackjack/syslog/logmask.go:19: undefined: Priority
../github.com/blackjack/syslog/logmask.go:27: undefined: Priority
../github.com/blackjack/syslog/writer.go:5: undefined: Priority
[goxc:xc] 2014/06/21 14:35:26 'go' returned error: exit status 2
[goxc:xc] 2014/06/21 14:35:26 Error: exit status 2
[goxc:xc] 2014/06/21 14:35:26 Have you run goxc -t for this platform (amd64,linux)???
[goxc:xc] 2014/06/21 14:35:26 Multiple errors (returning first one): [exit status 2]
[goxc:xc] 2014/06/21 14:35:26 Stopping after 'xc' failed with error 'exit status 2'
[goxc] 2014/06/21 14:35:26 RunTasks returned error exit status 2

Do I need to manually build imported packages?


Reply to this email directly or view it on GitHub
#44 (comment).

@mperham
Copy link
Author

mperham commented Jun 21, 2014

got it, thanks for helping this Go n00b!

@mperham mperham closed this as completed Jun 21, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants