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

Unable to build on ubuntu Vivid #22

Closed
mmacedoeu opened this issue Oct 19, 2015 · 1 comment
Closed

Unable to build on ubuntu Vivid #22

mmacedoeu opened this issue Oct 19, 2015 · 1 comment

Comments

@mmacedoeu
Copy link

Package libhdf5-dev installed, edited cgoflags.go to look as:

package hdf5

// #cgo LDFLAGS: -lhdf5 -lhdf5_hl
// #cgo darwin CFLAGS: -I/usr/include/hdf5/serial/
// #cgo darwin LDFLAGS: -L/usr/lib/x86_64-linux-gnu/hdf5/serial/
// #include "hdf5.h"
import "C"

build it with:

go build github.com/sbinet/go-hdf5

output:

github.com/sbinet/go-hdf5

w/go/src/github.com/sbinet/go-hdf5/cgoflags.go:6:19: fatal error: hdf5.h: No such file or directory
// #include "hdf5.h"
^
compilation terminated.

@sbinet
Copy link
Owner

sbinet commented Oct 20, 2015

this should read:

package hdf5

// #cgo LDFLAGS: -lhdf5 -lhdf5_hl
// #cgo linux CFLAGS: -I/usr/include/hdf5/serial/
// #cgo linux LDFLAGS: -L/usr/lib/x86_64-linux-gnu/hdf5/serial/
// #cgo darwin CFLAGS: -I/usr/local/include
// #cgo darwin LDFLAGS: -L/usr/local/lib
// #include "hdf5.h"
import "C"

or, alternatively, if you have installed pkg-config:

package hdf5

// #cgo pkg-config: hdf5
// #cgo LDFLAGS: -lhdf5 -lhdf5_hl
// #cgo darwin CFLAGS: -I/usr/local/include
// #cgo darwin LDFLAGS: -L/usr/local/lib
// #include "hdf5.h"
import "C"

not all linux distributions have a pkg-config file for hdf5... (I know mine doesn't, hence my mild reluctance to use the admittedly easier pkg-config way to configure the cgoflags...)

[feel free to reopen if you're still stuck]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants