Building on Linux works but not on windows

Hey, I am back :confused:

I am trying to build a project on windows (go build go-client.go LogStorage.go) which was successful on linux. Taking the exact same files, it does not work on windows with some error such as:

I was wondering if someone had the same problem once? Does anyone know how to fix it? The file LogStorage.go is a smart contract generated from solidity (solc and abigen).

Thanks a lot! Best regards,

Foocil

The reason is that Go is a compiled language. Meaning that you can’t take the Compile.exe file, which you make using go build, and expect it to run on other operating systems. You should create multiple Compiled files for each operating system or run the code directly “Go run” and let Go compile the file according to the current OS (Which will take extra time for Go to execute the code as it needs to compile it)

I think there was a solution for this like encoding utf-8 or something but I can’t really remember it, sorry :frowning:

1 Like

Thanks a lot for your answer!

I could fix my issue by fixing the error manually (the file with problem is an autogenerated code) on windows. So it s fine now.

Best regards,

1 Like

Happy you fixed it

Based on the error message, it’s best you raise a bug issue ticket on their GVCS (e.g. Github) to address the issue. Please remember to read their contributing guidelines.

The error log is very specific to data type mismatch which is source code problem.

This “monkey patching” only works if you’re in development phase where you are exploring and developing something. The error you found is not feasible for deploying into production. Hence, address the issues to the maintainers will be the strategic step.

You are right about the Go “cross-OS” deployment. However, it’s not the UTF-8 encoding that blocks it. :joy:

Every OS has their own specific ABI (abstracted binary interface). Hence, this is the reason why you need to compile your program for each OS.

I raised this issue in AppImage forum before (https://discourse.appimage.org/t/question-can-we-make-a-single-appimage-to-work-on-all-cpu-same-os/1841/3). Apparently, fatELF was considered but got neglected half way. Last research was that it works on paper (theory) but not in practical especially when you start considering business model in it.

2 Likes

Great! I will open a ticket on github as soon as I have some time for that!

Thanks a lot for your help and your time.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.