Pulsar: go build faild with go mod

Created on 13 Apr 2019  ·  3Comments  ·  Source: apache/pulsar

When I compiled the code in go-client/samples using go-mod mode, I got some error messages.

I checked the history of the relevant issue, is it because cpp-client is not compiled? But from the error message, I think it seems that there are fewer documents.

Also, can I help write a go-client that doesn't depend on cgo ?

My work-dir :

.
├── data
├── go.mod
├── go.sum
├── pulsar_pub.go
├── pulsar_sub.go
└── pulsar_sub_channel.go

When go build pulsar_pub.go ,the error message:

` github.com/apache/pulsar/pulsar-client-go/pulsar
In file included from ../../go/pkg/mod/github.com/apache/pulsar/[email protected]/pulsar/c_client.go:24:
./c_go_pulsar.h:22:10: fatal error: 'pulsar/c/client.h' file not found

include

     ^~~~~~~~~~~~~~~~~~~

1 error generated.`

typbug

Most helpful comment

To anyone else landing here, this is how I resolved this error on a Mac:

brew install libpulsar

All 3 comments

hello, this problem seems to be that you have not successfully built pulsar-cpp-client, you can exec:

# cd apache/pulsar/pulsar-client-cpp
# cmake .
# make
# make install
# go get -u "github.com/apache/pulsar/pulsar-client-go/pulsar"

Also, can I help write a go-client that doesn't depend on cgo ?

welcome. now, we also have the same idea. Under the https://github.com/wolfstudy/pulsar-client-go project, we have already started some work. If you are interested, you are welcome to join us.

Of course, if the pulsar official has the same idea, we can try to contribute the relevant code to them together.

@wolfstudy Thanks!

To anyone else landing here, this is how I resolved this error on a Mac:

brew install libpulsar
Was this page helpful?
0 / 5 - 0 ratings