Open greenm01 opened 8 months ago
The problem you have here is wanting to use Odin without Administration privileges.
Using the Mingw tooling is a "possible" approach to this but we do not want to support the Mingw toolchain (officially). It is incompatible with the MSVC toolchain, of which many many projects use. Mingw also has loads of problems with Windows in general which make it not really developing for Windows.
Odin does work with the Clang toolchain by appending the -lld
flag. This will use the lld-link.exe
linker instead. You should be able to install clang/llvm without administration privileges on Windows.
However if you are doing any kind of development, it is usually preferrable if you can have a machine with administration privileges in order to do development.
Thank you for the quick response and thoughtful reply.
Yes, admin rights on this laptop would be ideal..... but, I work a boring corporate job and like to code on the sly when I'm not busy.... I could code on a VPS via SSH, but I'd like to do some OpenGL stuff.
I have llvm installed via scoop, and lld-link.exe is on my system. However, when I try this the compiler still compains that Windows SDK is not found:
odin build .\hellope.odin -file -lld
Or do I need to build Odin from source on my system with lld-link? If so, how do I do that?
He meant to build Odin with that additional argument. You can either use git to clone the repo or just go to the main github page, click the green "Code" button, and click "Download ZIP." I just did this out of my own curiosity without any scripts. I was able to successfully build with this:
clang++ src\main.cpp src\libtommath.cpp -Isrc -Wno-switch -Wno-macro-redefined -Wno-unused-value -DGIT_SHA=\"7a7b5f98\" -DODIN_VERSION_RAW=\"dev-2023-10\" -std=c++14 -fno-exceptions -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -L"C:/Program Files/LLVM/lib" -lLLVM-C -lkernel32 -lSynchronization -o odin.exe
I stole the -DGIT_SHA...
by echoing from the build.bat
script. Please be warned, I am not a Windows developer by any stretch of the imagination, so this may not be correct. It was able to build the demo though. Good luck =]
Thanks for this. I installed the LLVM-mingw toolchain via scoop and started compiling, although I'm getting posix_memalogn errors:
src/common_memory.cpp:497:9: error: use of undeclared identifier 'posix_memalign' 497 | err = posix_memalign(&ptr, alignment, size);
This was quite an afternoon attempting to compile Odin on Windowz without admin rights.
Time to move on to something else more productive....
Would it be possible to compile Odin with Zig? That would be a nice option.
I believe Zig compiles C++ via clang, so you would be adding steps in that case.
In my example, I actually compiled Odin with native Windows LLVM which you do not need administrative rights to install. You can download the installer exe here. Don't run it. Just extract it with an archive program. I used 7-zip to extract it to C:\llvm
, but you can use any directory you want. I was again able to compile odin with the following command (from within the odin source):
C:\llvm\bin\clang++ src\main.cpp src\libtommath.cpp -Isrc -Wno-switch -Wno-macro-redefined -Wno-unused-value -DGIT_SHA=\"7a7b5f98\" -DODIN_VERSION_RAW=\"dev-2023-10\" -std=c++14 -fno-exceptions -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -L"C:\llvm\lib" -lLLVM-C -lkernel32 -lSynchronization -o odin.exe
You would be surprised what you can do without administrator privileges. In general, the keyword you will want to search for is "portable" applications. Essentially, these are applications that can be extracted and run in place.
You would be surprised what you can do without administrator privileges. In general, the keyword you will want to search for is "portable" applications. Essentially, these are applications that can be extracted and run in place.
Do you already have the MSCV compiler installed on your system?
Browsing through the Odin code, there are quite a few preprocessor directives that test for GB_COMPILER_MSV. I don't believe one can compile Odin on a Windows system without it installed, even with the Clang++toolchain and mingw64 windows headers.
As an open source project, one should be able to compile Odin on any platform without depending on a proprietary compiler toolchain, including Windows. This has negative consequences, including for my specific case where I only have permission to make changes to local userland.
Windows system without it installed
Using a binary release is doable. I tested it out today on my work PC and Odin wouldn't let you use itself without MSVC installed even if you use -lld
flag (linker should be its only dependency?)
I'm curious about the feasibility of using the Odin compiler portably. It seems you can compile Odin portably, but you still need MSVC to use Odin?
I'd like to bundle it with my game to allow for on the fly mod compilation without requiring someone to install MSVC.
Please support Mingw-w64 on Windows. I lack admin access on my Windows laptop and cannot install MSVC build tools under my local user profile.
As it stands, I can install all the MINGW tooling I need via Scoop:
https://scoop.sh/
Both Nim and Zig support this feature on Windows, and it's the only issue holding me back from jumping into Odin head first.