# Error using a Linux built Go server module on macOS

**URL:** <https://forum.heroiclabs.com/t/error-using-a-linux-built-go-server-module-on-macos/1676>\
**Category:** Runtime Framework\
**Tags:** server-framework, golang\
**Created:** [May 28, 2021, 7:48am UTC](https://forum.heroiclabs.com/t/error-using-a-linux-built-go-server-module-on-macos/1676 "2021-05-28T07:48:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![CtrlShiftN](https://avatars.discourse-cdn.com/v4/letter/c/e68b1a/32.png) [@CtrlShiftN](https://forum.heroiclabs.com/u/CtrlShiftN)\
**Post date:** [May 28, 2021, 7:48am UTC](https://forum.heroiclabs.com/t/error-using-a-linux-built-go-server-module-on-macos/1676/1 "2021-05-28T07:48:27Z")

</div>

Hello, I am a newbie. I have a question:  
I wrote nakama module in Golang (I use macos), then build to “.so” by command “go build -buildmode=plugin -o ./plugin.so”. I tested by writting golang file which have

```auto
err := plugins.Open({plugin_path})
if err != nil {
   panic(err)
}

```

I had not any error.  
But when I delpoyed it (file plugin.so) into nakama/modules on ubuntu 18.0 → run nakama. I got an error “invalid ELF header”.  
How can fix it?  
Thanks, sorry, my english so bad

---

<div class="post-metadata">

**Author:** ![lugehorsam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/lugehorsam/32/314_2.png) [@lugehorsam](https://forum.heroiclabs.com/u/lugehorsam)\
**Post date:** [June 2, 2021, 1:56am UTC](https://forum.heroiclabs.com/t/error-using-a-linux-built-go-server-module-on-macos/1676/2 "2021-06-02T01:56:21Z")

</div>

Hey @CtrlShiftN it sounds like you are trying to run a binary built on Mac inside Linux. This won’t work because the two operating systems use different binary formats.

What happens if you compile the plugin in Ubuntu 18.0?

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [June 2, 2021, 10:04pm UTC](https://forum.heroiclabs.com/t/error-using-a-linux-built-go-server-module-on-macos/1676/3 "2021-06-02T22:04:14Z")

</div>

@CtrlShiftN To add to what @lugehorsam mentioned I think you should use the Docker workflow we recommend with your Go code. This way you don’t have to worry about native cross-compilation especially on Windows. Have a look at our Docker quickstart docs: [Docker compose - Nakama Server](https://heroiclabs.com/docs/install-docker-quickstart/)

---

<div class="post-metadata">

**Author:** ![CtrlShiftN](https://avatars.discourse-cdn.com/v4/letter/c/e68b1a/32.png) [@CtrlShiftN](https://forum.heroiclabs.com/u/CtrlShiftN)\
**Post date:** [June 3, 2021, 4:43am UTC](https://forum.heroiclabs.com/t/error-using-a-linux-built-go-server-module-on-macos/1676/4 "2021-06-03T04:43:13Z")

</div>

HI @lugehorsam, thanks for your help,  
But I put my plugin module into nakama source code, then run nakama. And It worked.

---

<div class="post-metadata">

**Author:** ![CtrlShiftN](https://avatars.discourse-cdn.com/v4/letter/c/e68b1a/32.png) [@CtrlShiftN](https://forum.heroiclabs.com/u/CtrlShiftN)\
**Post date:** [June 3, 2021, 4:44am UTC](https://forum.heroiclabs.com/t/error-using-a-linux-built-go-server-module-on-macos/1676/5 "2021-06-03T04:44:49Z")

</div>

@novabyte: thank you  
I just put my plugin code into nakama source code. And It seem to be worked  
I will use docker if It have error. Thank you  
Sorry, my English is bad

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [June 3, 2021, 9:49am UTC](https://forum.heroiclabs.com/t/error-using-a-linux-built-go-server-module-on-macos/1676/6 "2021-06-03T09:49:19Z")

</div>

@CtrlShiftN You should avoid developing your server code within the Nakama server codebase itself. The server is specifically designed to not require custom modification for you to be able to create your own server cloud code logic that can be loaded by the server.

I recommend you have a look at the Nakama project template for the workflow you can use with your Go code development: [GitHub - heroiclabs/nakama-project-template: An example project on how to set up and write custom server code in Nakama server.](https://github.com/heroiclabs/nakama-project-template)

---

<div class="post-metadata">

**Author:** ![CtrlShiftN](https://avatars.discourse-cdn.com/v4/letter/c/e68b1a/32.png) [@CtrlShiftN](https://forum.heroiclabs.com/u/CtrlShiftN)\
**Post date:** [June 3, 2021, 4:07pm UTC](https://forum.heroiclabs.com/t/error-using-a-linux-built-go-server-module-on-macos/1676/7 "2021-06-03T16:07:11Z")

</div>

thanks so much, I’ll try.  
But I have a question, can I debug my plugin (by Goland or VSCode…). I think that I can’t debug shared object

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [June 4, 2021, 5:32am UTC](https://forum.heroiclabs.com/t/error-using-a-linux-built-go-server-module-on-macos/1676/8 "2021-06-04T05:32:45Z")

</div>

@CtrlShiftN You can debug Go code even compiled as a shared object with the Delve debugger. You must use a [build of the server with debug symbols enabled](https://hub.docker.com/r/heroiclabs/nakama-dsym) and also make sure that your Go code is compiled with debug symbols.

---

<div class="post-metadata">

**Author:** ![CtrlShiftN](https://avatars.discourse-cdn.com/v4/letter/c/e68b1a/32.png) [@CtrlShiftN](https://forum.heroiclabs.com/u/CtrlShiftN)\
**Post date:** [June 4, 2021, 7:07am UTC](https://forum.heroiclabs.com/t/error-using-a-linux-built-go-server-module-on-macos/1676/9 "2021-06-04T07:07:41Z")

</div>

@novabyte thank you so much
