How to compile executables for Ubuntu?

im installing a VM with Ubuntu… i follow the instruction to compile… it generate /bin folder with some folders… and mattermost and mmctl files…

in my live server… i replace the mattermost ( and apply roles permissions)

but cant run

sudo systemctl start mattermost.service
-- A start job for unit mattermost.service has begun execution.
-- 
-- The job identifier is 8139.
Apr 17 02:27:45 MatterMostFull systemd[21780]: mattermost.service: Failed to execute command: Exec format error
Apr 17 02:27:45 MatterMostFull systemd[21780]: mattermost.service: Failed at step EXEC spawning /opt/mattermost/bin/mattermost: Exec format error
-- Subject: Process /opt/mattermost/bin/mattermost could not be executed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The process /opt/mattermost/bin/mattermost could not be executed and failed.
-- 
-- The error number returned by this process is ERRNO.
Apr 17 02:27:45 MatterMostFull systemd[1]: mattermost.service: Main process exited, code=exited, status=203/EXEC
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit mattermost.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 203.
Apr 17 02:27:45 MatterMostFull systemd[1]: mattermost.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit mattermost.service has entered the 'failed' state with result 'exit-code'.
Apr 17 02:27:45 MatterMostFull systemd[1]: Failed to start Mattermost.
-- Subject: A start job for unit mattermost.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mattermost.service has finished with a failure.
-- 
-- The job identifier is 8139 and the job result is failed.

i rename this to mattermost2 and the older mattermost_old rename to mattermost and it work.

i try with /server/bin mattermost file and with /server/bin/linux_arm64 too… and nothing

@KatiaSishost what are you compiling, and how? What architecture is your hardware? “Exec format error” can occur if you compile on one arch and attempt to execute on another. What does uname -i say? And, do you have a specific reason to compile your own vs. just download the tarball? https://docs.mattermost.com/install/install-tar.html

Hello, I was able to solve it, the problem was the dependencies that I had to update to Ubuntu 22.04 and it works perfectly…

The only drawback is that only the Team version is compiled when I actually need the Enterprise to make some add-ons for that version since we are going to have the license…

So I’m still looking at what to do with that issue.