ibm-messaging / mq-golang

Calling IBM MQ from Go applications
Apache License 2.0
168 stars 60 forks source link

Trying to go install / compile for AIX 7.2 #143

Closed leondelange6969 closed 4 years ago

leondelange6969 commented 4 years ago

Please include the following information in your ticket.

$ dspmqver Name: IBM MQ Version: 9.1.3.0 Level: p913-L190628 BuildType: IKAP - (Production) Platform: IBM MQ for AIX Mode: 64-bit O/S: AIX 7.2 InstName: Installation1 InstDesc: Primary: No InstPath: /usr/mqm DataPath: /var/mqm MaxCmdLevel: 913 LicenseType: Production

$ go version go version go1.13.4 aix/ppc64 $

Hi Mark,

I was wondering if this would work for AIX 7.2. I have compiled with success on LINUX and WINDOWS but we also have MQ on AIX so it would be nice to have the exporter run on the local server on AIX7.2.

The go installl is giving me the following return...

$ go install ./src/github.com/ibm-messaging/mq-golang/ibmmq

runtime/cgo

ld: 0706-012 The -p flag is not recognized. ld: 0706-012 The -a flag is not recognized. ld: 0706-012 The -t flag is not recognized. ld: 0706-012 The -h flag is not recognized. collect2: error: ld returned 255 exit status

ibmmqmet commented 4 years ago

AIX support only arrived in Go at 1.13 so it's rather new. I've not got a suitable system to try it out (my AIX hardware is too old) but you could try the latest version that I pushed yesterday - branch "modules", version 5.0.0-beta. That has a guess at what the flags in mqi.go might need to be, based on a standard installation into /usr/mqm (though you can add further compile directives via environment variables in the same way as other platforms) as well as including the AIX-specific version of the constants definition.

leondelange6969 commented 4 years ago

Thanks Mark..... I'll try and let you know how I got on....

leondelange6969 commented 4 years ago

Ok.. I have tried loads of things and got this far... Only the last bit to go now...

cd /var/mqm/go/src/github.com/ibm-messaging/mq-golang/ibmmq $ go install go: downloading github.com/ibm-messaging/mq-golang v3.0.0+incompatible go: extracting github.com/ibm-messaging/mq-golang v3.0.0+incompatible $ ls -l total 3216 -rwxrwxrwx 1 abll524 staff 225888 May 19 01:03 cmqc_aix.go -rwxrwxrwx 1 abll524 mqm 225870 May 19 01:03 cmqc_darwin.go -rwxrwxrwx 1 abll524 mqm 225877 May 19 01:03 cmqc_linux_amd64.go -rwxrwxrwx 1 abll524 mqm 225880 May 19 01:03 cmqc_linux_ppc64le.go -rwxrwxrwx 1 abll524 mqm 225876 May 19 01:03 cmqc_linux_s390x.go -rwxrwxrwx 1 abll524 mqm 225875 May 19 01:03 cmqc_windows.go -rwxrwxrwx 1 abll524 mqm 8936 May 19 01:03 ibmmq_test.go -rwxrwxrwx 1 abll524 mqm 32484 May 19 01:03 mqi.go -rwxrwxrwx 1 abll524 mqm 1162 May 19 01:03 mqiBO.go -rwxrwxrwx 1 abll524 mqm 1973 May 19 01:03 mqiCBC.go -rwxrwxrwx 1 abll524 mqm 1975 May 19 01:03 mqiCBD.go -rwxrwxrwx 1 abll524 mqm 1515 May 19 01:03 mqiCTLO.go -rwxrwxrwx 1 abll524 mqm 3912 May 19 01:03 mqiDLH.go -rwxrwxrwx 1 abll524 mqm 1923 May 19 01:03 mqiMHO.go -rwxrwxrwx 1 abll524 mqm 3542 May 19 01:03 mqiMPO.go -rwxrwxrwx 1 abll524 mqm 7943 May 19 01:03 mqiMQCD.go -rwxrwxrwx 1 abll524 mqm 6816 May 19 01:03 mqiMQCNO.go -rwxrwxrwx 1 abll524 mqm 4162 May 19 01:03 mqiMQGMO.go -rwxrwxrwx 1 abll524 mqm 7086 May 19 01:03 mqiMQMD.go -rwxrwxrwx 1 abll524 mqm 6824 May 19 01:03 mqiMQOD.go -rwxrwxrwx 1 abll524 mqm 4302 May 19 01:03 mqiMQPMO.go -rwxrwxrwx 1 abll524 mqm 2671 May 19 01:03 mqiMQSCO.go -rwxrwxrwx 1 abll524 mqm 7207 May 19 01:03 mqiMQSD.go -rwxrwxrwx 1 abll524 mqm 8939 May 19 01:03 mqiPCF.go -rwxrwxrwx 1 abll524 mqm 1340 May 19 01:03 mqiSRO.go -rwxrwxrwx 1 abll524 mqm 4499 May 19 01:03 mqiSTS.go -rwxrwxrwx 1 abll524 mqm 4360 May 19 01:03 mqiattrs.go -rwxrwxrwx 1 abll524 mqm 8572 May 19 01:03 mqicb.go -rwxrwxrwx 1 abll524 mqm 1284 May 19 01:03 mqicb_c.go -rwxrwxrwx 1 abll524 mqm 84608 May 19 01:03 mqistr.go $ cd /var/mqm/go/src/github.com/ibm-messaging/mq-golang/mqmetric $ ls -l total 312 -rwxrwxrwx 1 abll524 mqm 18970 May 19 01:03 channel.go -rwxrwxrwx 1 abll524 mqm 40666 May 19 01:03 discover.go -rwxrwxrwx 1 abll524 mqm 1552 May 19 01:03 log.go -rwxrwxrwx 1 abll524 mqm 10084 May 19 01:03 mqif.go -rwxrwxrwx 1 abll524 mqm 8876 May 19 01:03 mqmetric_test.go -rwxrwxrwx 1 abll524 mqm 7963 May 19 01:03 qmgr.go -rwxrwxrwx 1 abll524 mqm 16330 May 19 01:03 queue.go -rwxrwxrwx 1 abll524 mqm 9156 May 19 01:03 status.go -rwxrwxrwx 1 abll524 mqm 6601 May 19 01:03 sub.go -rwxrwxrwx 1 abll524 mqm 9656 May 19 01:03 topic.go -rwxrwxrwx 1 abll524 mqm 8514 May 19 01:03 usage.go $ go install $ cd /var/mqm/go/src/github.com/ibm-messaging/mq-golang/samples/mqitest $ go build -o bin/mq-prometheus-sample .go $ cd /var/mqm/go/src/github.com/ibm-messaging/mq-golang/mq-prometheus $ go build -o bin/mq-prometheus-aix .go go: downloading github.com/ibm-messaging/mq-metric-samples v4.1.3+incompatible go: downloading github.com/prometheus/client_golang v1.6.0 go: downloading github.com/sirupsen/logrus v1.6.0 go: extracting github.com/sirupsen/logrus v1.6.0 go: extracting github.com/prometheus/client_golang v1.6.0 go: downloading golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f go: extracting github.com/ibm-messaging/mq-metric-samples v4.1.3+incompatible go: downloading github.com/golang/protobuf v1.4.0 go: downloading github.com/prometheus/client_model v0.2.0 go: downloading github.com/cespare/xxhash/v2 v2.1.1 go: downloading github.com/prometheus/common v0.9.1 go: downloading github.com/beorn7/perks v1.0.1 go: downloading github.com/prometheus/procfs v0.0.11 go: extracting golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f go: extracting github.com/golang/protobuf v1.4.0 go: downloading google.golang.org/protobuf v1.21.0 go: extracting github.com/prometheus/common v0.9.1 go: extracting github.com/cespare/xxhash/v2 v2.1.1 go: extracting github.com/prometheus/procfs v0.0.11 go: extracting github.com/prometheus/client_model v0.2.0 go: extracting github.com/beorn7/perks v1.0.1 go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1 go: extracting github.com/matttproud/golang_protobuf_extensions v1.0.1 go: extracting google.golang.org/protobuf v1.21.0 go: finding github.com/ibm-messaging/mq-golang v3.0.0+incompatible go: finding github.com/ibm-messaging/mq-metric-samples v4.1.3+incompatible go: finding github.com/sirupsen/logrus v1.6.0 go: finding golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f go: finding github.com/prometheus/client_golang v1.6.0 go: finding github.com/beorn7/perks v1.0.1 go: finding github.com/cespare/xxhash/v2 v2.1.1 go: finding github.com/golang/protobuf v1.4.0 go: finding google.golang.org/protobuf v1.21.0 go: finding github.com/prometheus/client_model v0.2.0 go: finding github.com/prometheus/common v0.9.1 go: finding github.com/matttproud/golang_protobuf_extensions v1.0.1 go: finding github.com/prometheus/procfs v0.0.11

github.com/ibm-messaging/mq-golang/ibmmq

collect2: fatal error: library libmqm_r not found compilation terminated.

leondelange6969 commented 4 years ago

export LIBPATH=/opt/freeware/lib:/usr/lib:/opt/freeware/lib/golang/bin:$LIBPATH export PATH=/usr/lib:/opt/freeware/lib:/usr/lib:/opt/freeware/lib/golang/bin:/usr/mqm/inc:$PATH export GOROOT=/var/mqm/go/ export GOROOT=/opt/freeware/lib/golang/bin export GOROOT= export GOPATH=/var/mqm/go/src export http_proxy=http://22.240.20.129:8080 export https_proxy=http://22.240.20.129:8080 export CGO_CFLAGS="-I$MQ_INSTALLATION_PATH/inc" export MQ_INSTALLATION_PATH=/usr/mqm export MQ_INSTALLATION_PATH=/var/mqm export CGO_LDFLAGS_ALLOW="-Wl,-rpath.*"

cd /var/mqm/go/src/github.com/ibm-messaging/mq-golang/mq-prometheus go build -o bin/mq-prometheus-aix *.go

Aornn commented 4 years ago

Simple question, do you work with module or vendor ?

leondelange6969 commented 4 years ago

Hi Aornn.,

I'm assuming you want to know if I'm the person compiling and so on... Yes I am. I don't work for a vendor.... I work for a big bank in South Africa. I'm trying to get this working on AIX 7.2 so if you have a compiled copy I'd be more than happy to try that...

I'm working with the module....

Thanks Leon

leondelange6969 commented 4 years ago

@Aornn you never answered... Why were you asking the question ?

ibmmqmet commented 4 years ago

Having the "downloading 3.0.0" messages is bad because that's a really really old level. so I don't really know what you've got here. But this week I released v5.0.0 for this repo to have module compatibility so hopefully a "go install" will get that instead or you can refer to v5 in a go.mod file.

The key thing for knowing if AIX works is to just see if one of the samples from this repo works - maybe doing a "git clone" rather than "go install" would be a starting point.

The "vendor" question earlier was about how prereqs might be embedded in the repo not about your job but there's no need for a vendor directory in this one. I use vendoring for the mq-metric-samples repo.

leondelange6969 commented 4 years ago

Good morning..... Happy to report that all is now working... So we are running a local prometheus exporter on AIX 7.2 and its working as designed.

Really happy with this result.

Thanks for all your help Mark...

ibmmqmet commented 4 years ago

Thanks for letting me know.