🎄 Happy Holidays! 🥳
Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.
Happy Holidays!
Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.
Facing issue in Building SolacePubSub in Go Project in different Environment
We have tried to implement solace in Go App. And we are facing some critical issue. I am having Windows Laptop with Intel i5 processor, I can build the project (via Debian in Windows WSL) and can run in Docker using the debian:buster image. But when one other Developer (his laptop is Windows with AMD Processor) tried to build the same project (via Debian in Windows WSL) he is getting the following exception. Other Developer who is using Mac with M2 chip is also facing the same issue. I browsed through the Community and I got only one suitable answer is https://solace.community/discussion/1423/golang-based-solace-client-in-docker which states that Go dependency wont work in some of the processors (M1) and in some OS (Linux Alpine). I am not sure if Solace PubSub can support only Intel processors? Or is there is anything am I missing here. Can you help me on this?
# solace.dev/go/messaging/pkg/solace/subcode ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/pkg/solace/subcode/subcode.go:41:15: undefined: ccsmp.SolClientSubCodeToString ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/pkg/solace/subcode/subcode.go:41:46: undefined: ccsmp.SolClientSubCode # solace.dev/go/messaging/internal/impl/constants ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/internal/impl/constants/default_properties.go:35:8: undefined: ccsmp.SolClientSessionPropTopicDispatch ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/internal/impl/constants/default_properties.go:36:8: undefined: ccsmp.SolClientSessionPropSendBlocking ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/internal/impl/constants/default_properties.go:37:8: undefined: ccsmp.SolClientSessionPropReapplySubscriptions ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/internal/impl/constants/default_properties.go:38:8: undefined: ccsmp.SolClientSessionPropIgnoreDupSubscriptionError ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/internal/impl/constants/default_properties.go:39:8: undefined: ccsmp.SolClientSessionPropReconnectRetries ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/internal/impl/constants/default_properties.go:40:8: undefined: ccsmp.SolClientSessionPropGuaranteedWithWebTransport ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/internal/impl/constants/default_properties.go:41:8: undefined: ccsmp.SolClientSessionPropPubWindowSize make: *** [server_build] Error 2
We tried to build it via Docker in all environment (Windows + Intel, Windows + AMD, Mac + M2) using the debian:buster image, build is successful only in Windows + Intel. We tried to change GOOS and GOARCH into several configurations in Mac and still build was not successful and most time facing the above issue else facing the below issues
Answers
-
Hi @mohanprasathsj, we do not yet have support for Apple Silicon in the Go API, so that explains one build environment. We also don't have support for ARM yet. Both of these are coming soon, so stay tuned! Looks like your builds are failing due to trying to build for different platforms, i.e. "cross compile". Unfortunately that will not work very well with Cgo libraries, at least not out of the box. The failures in the attached images are due to:
- We do not yet support ARM linux and the compilation target is ARM
- The issue seems unrelated to Solace. Are you cross compiling on Mac to Linux by any chance? That will not work with Cgo out of the box. See https://github.com/golang/go/issues/54695
- You are cross compiling to AMD64 on an ARM machine, but have ARM binaries that are being linked against (OpenSSL). Its possible that pointing the build to x86 versions of OpenSSL would work, however this is not something we have tested. This can be done with
CGO_LDFLAGS="-L/path/to/x86/openssl@1.1/lib"
Hope that helps!
0 -
Hi Mcardy,
I understand that there is no support for the M2 chip in Apple, but can you please explain in detail about the Windows + AMD processor?
In the Windows + AMD Processor, I tried building the Go Project in Windows with WSL2 (Installed Debian OS) and while building the project, I am facing the same issue that I get while I build in Windows.
Also, I tried to build the Application via Docker Desktop using debian-buster image and still the same issue occurs. I am not getting any error (in Both WSL and Docker) if I am using Windows + Intel processer laptop
# solace.dev/go/messaging/pkg/solace/subcode ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/pkg/solace/subcode/subcode.go:41:15: undefined: ccsmp.SolClientSubCodeToString ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/pkg/solace/subcode/subcode.go:41:46: undefined: ccsmp.SolClientSubCode # solace.dev/go/messaging/internal/impl/constants ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/internal/impl/constants/default_properties.go:35:8: undefined: ccsmp.SolClientSessionPropTopicDispatch ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/internal/impl/constants/default_properties.go:36:8: undefined: ccsmp.SolClientSessionPropSendBlocking ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/internal/impl/constants/default_properties.go:37:8: undefined: ccsmp.SolClientSessionPropReapplySubscriptions ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/internal/impl/constants/default_properties.go:38:8: undefined: ccsmp.SolClientSessionPropIgnoreDupSubscriptionError ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/internal/impl/constants/default_properties.go:39:8: undefined: ccsmp.SolClientSessionPropReconnectRetries ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/internal/impl/constants/default_properties.go:40:8: undefined: ccsmp.SolClientSessionPropGuaranteedWithWebTransport ../../../../pkg/mod/solace.dev/go/messaging@v1.2.0/internal/impl/constants/default_properties.go:41:8: undefined: ccsmp.SolClientSessionPropPubWindowSize make: *** [server_build] Error 2
Can you please clarify one thing, Does the processor will have any impact on the Solace Build?, as in the above case, I am getting the issue only for AMD processor and is working fine with Intel i5 processor
0 -
Hi Mcardy,
I find the solution for Windows, the issue is solved when I set the CGO_ENABLED=1 in our Debian WSL and installed the necessary packages. But I am facing the following issue when I run the App in Docker running in Mac OS.
I have added the Docker file to the Solace examples and tested in Mac with M2 processor (but ran the application via Docker using Debian Image).
I am getting the following issue (Please take the pull and run the Docker file in Mac you will get the below exception),
0 -
Glad you figured out the windows problems!
The Mac problem is due to the fact that we do not have support for ARM on either Mac or Linux yet, however support is coming soon. The issue with the above is it is trying to run an x86 binary on arm. Note that docker images are platform specific.
/usr/local/go/pkg/tool/linux_arm64/link
looks like it is trying to compile for arm.0 -
Hi @mohanprasathsj, just to add on to everything Mcardy has said; support for ARM (Mac and Linux) should be released within the month of April. Keep an eye out on the community front page as I will be posting a general notice for awareness as we have had a lot of demand for ARM support in our APIs.
0 -
The setting of the flag `CGO_ENABLED=1` alone doesn't help.
We have to follow few more steps to do it(Something on below lines):
- brew tap SergioBenitez/osxct
- brew install x86_64-unknown-linux-gnu
- CC=x86_64-unknown-linux-gnu-gcc CGO_ENABLED=1 GOARCH=amd64 GOOS=linux go build main.go
These steps are not convenient on a CI/CD pipeline. Please do simplify the process
0