Giter Club home page Giter Club logo

Comments (7)

iegomez avatar iegomez commented on August 22, 2024

Hi!

What version of Go are you running? And did you run makeor just tried go build -buildmode=c-shared -o go-auth.soon its own?

from mosquitto-go-auth.

vincems avatar vincems commented on August 22, 2024

Thanks for getting back iegomez ...

go version
go version go1.10.2 linux/amd64

Using the make directly from git resulted in:
make

go build -buildmode=c-archive go-auth.go
go build -buildmode=c-shared -o go-auth.so
flag needs an argument: -o
usage: build [-o output] [-i] [build flags] [packages]
Run 'go help build' for details.
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 2

I have also tried manually running each command from the Make file - with the same result.

Tweaking the position of the -o argument results in a clean compile - but then the resultant .so won't load.

Cheers
Vince.

from mosquitto-go-auth.

iegomez avatar iegomez commented on August 22, 2024

Well, that's kind of baffling. This week I built the plugin on an Azure VM running Ubuntu 17.10, on a Linode VM running Ubuntu 16.04, on my work machine running Debian 9 and a couple of hours ago on OS X 10.12, and all worked fine just executing make.

I'll see if I can reproduce it at work on monday, but I think moving the flag position shouldn't matter and it's odd that it behaves differently . My first guess was that there's a specific bug in Go 1.10.2 regarding cgo or something of the sort, but I just downloaded 1.10.2 to test it and it builds fine here. For what is worth, I started the plugin with 1.9.2, did the last changes on 1.10 and built it this week with the latest stable version, 1.10.3. Could you try with the newest version?

My second guess is that you have some weird or custom C compiler in place that doesn't play well with Go. I'm not sure which are in use on the different setups I mentioned, but they are probably the latest stable gcc version. I'm on a Mac right now and the gcc version throws this: Apple LLVM version 9.0.0 (clang-900.0.39.2).

I'll let you know if I find or can think of anything leading to this issue.

from mosquitto-go-auth.

vincems avatar vincems commented on August 22, 2024

ok - not quite sure what I did yet - but I managed to get it to compile properly.
If I move the -o to before the build-mode argument it generates an ELF binary executable not a shared object. I'll experiment more tomorrow and try to narrow down what changed. I did upgrade to golang 1.10.3 - so maybe that was it ... will confirm.

from mosquitto-go-auth.

iegomez avatar iegomez commented on August 22, 2024

Did you have any luck? I haven't been able to reproduce it in any of my setups, so it sounds specific to yours. You could write some basic go file that exports functions using cgo and see if that compiles using the same schema from the Makefile. If it doesn't, then there's definitely something going on at your setup.

from mosquitto-go-auth.

vincems avatar vincems commented on August 22, 2024

Hi - after upgrading to 1.10.3 and testing my latest compile - which definitely generated a SO rather than an executable - things started working :) Not sure why - I'll experiment further once I have my project back on track - for now it's awesome to get a 'Not authorized' message :)

Thanks for your help.

from mosquitto-go-auth.

iegomez avatar iegomez commented on August 22, 2024

Great!

I'll be closing this for now, but let me know if you run into any other issue.

Cheers!

from mosquitto-go-auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.