# Does Mojo support cross-compilation for GPU targets on non-GPU platforms?

**URL:** <https://forum.modular.com/t/does-mojo-support-cross-compilation-for-gpu-targets-on-non-gpu-platforms/3465>\
**Category:** Mojo\
**Tags:** discussion, mojo-compiler\
**Created:** [September 4, 2026, 3:29am UTC](https://forum.modular.com/t/does-mojo-support-cross-compilation-for-gpu-targets-on-non-gpu-platforms/3465 "2026-09-04T03:29:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yinghao](https://avatars.discourse-cdn.com/v4/letter/y/67e7ee/32.png) [@yinghao](https://forum.modular.com/u/yinghao)\
**Post date:** [September 4, 2026, 3:29am UTC](https://forum.modular.com/t/does-mojo-support-cross-compilation-for-gpu-targets-on-non-gpu-platforms/3465/1 "2026-09-04T03:29:54Z")

</div>

My current local machine doesn’t meet Mojo’s GPU runtime requirements, and I’m currently unable to compile on it. Given that most modern programming languages and compilers support cross-compilation, I was wondering: does the Mojo compiler currently support this feature? If not, is it on the roadmap for the future?

Right now, I’m relying on cloud GPUs to learn Mojo. However, keeping a cloud instance running continuously is quite expensive, and having to repeatedly spin up and reconfigure the environment from scratch every time. If I could compile the executable locally and only use the cloud instance for execution, it would significantly improve the workflow and save costs.

---

<div class="post-metadata">

**Author:** ![billyzhu](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/billyzhu/32/447_2.png) [@billyzhu](https://forum.modular.com/u/billyzhu)\
**Post date:** [September 4, 2026, 6:40pm UTC](https://forum.modular.com/t/does-mojo-support-cross-compilation-for-gpu-targets-on-non-gpu-platforms/3465/2 "2026-09-04T18:40:46Z")

</div>

Hey! Yes there are flags for specifying the target you’re building for. Hopefully this page helps: [Compilation targets | Mojo](https://mojolang.org/docs/tools/compilation/#cross-compilation-in-practice)

---

<div class="post-metadata">

**Author:** ![yinghao](https://avatars.discourse-cdn.com/v4/letter/y/67e7ee/32.png) [@yinghao](https://forum.modular.com/u/yinghao)\
**Post date:** [September 7, 2026, 2:17pm UTC](https://forum.modular.com/t/does-mojo-support-cross-compilation-for-gpu-targets-on-non-gpu-platforms/3465/3 "2026-09-07T14:17:53Z")

</div>

thx! I will try it!!!

---

<div class="post-metadata">

**Author:** ![yinghao](https://avatars.discourse-cdn.com/v4/letter/y/67e7ee/32.png) [@yinghao](https://forum.modular.com/u/yinghao)\
**Post date:** [September 7, 2026, 2:56pm UTC](https://forum.modular.com/t/does-mojo-support-cross-compilation-for-gpu-targets-on-non-gpu-platforms/3465/4 "2026-09-07T14:56:13Z")

</div>

Yes, it is very useful! I can really compile the mojo file on my computer. But when I scp the executable to the remote GPU target and run it, it will complain about `can't load shared libraries: libKGENCompilerRTShared.so`. I guess I need to compile locally by using `-Xlinker -static`, but I don’t have static libraries like `libKGENCompilerRTShare.a`.

So the question has changed interestingly. How to statically link a mojo executable?

---

<div class="post-metadata">

**Author:** ![yinghao](https://avatars.discourse-cdn.com/v4/letter/y/67e7ee/32.png) [@yinghao](https://forum.modular.com/u/yinghao)\
**Post date:** [September 7, 2026, 3:12pm UTC](https://forum.modular.com/t/does-mojo-support-cross-compilation-for-gpu-targets-on-non-gpu-platforms/3465/5 "2026-09-07T15:12:54Z")

</div>

I can run it by **copying** all needed shared libraries to the remote GPU target, and **exporting** `LD_LIBRARY_PATH` before running it.

---

<div class="post-metadata">

**Author:** ![billyzhu](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/billyzhu/32/447_2.png) [@billyzhu](https://forum.modular.com/u/billyzhu)\
**Post date:** [September 8, 2026, 10:15pm UTC](https://forum.modular.com/t/does-mojo-support-cross-compilation-for-gpu-targets-on-non-gpu-platforms/3465/6 "2026-09-08T22:15:09Z")

</div>

If you had mojo or max installed on your remote machine you should also have a copy of the library there too? But glad to see you got it working.
