flat assembler
Message board for the users of flat assembler.

Index > Main > [fasmg] Wrong "include" env variable used in MSYS2 terminal

Author
Thread Post new topic Reply to topic
therektafire



Joined: 06 Dec 2023
Posts: 7
therektafire 05 Jul 2026, 22:27
Hi, so I'm wanting to use fasmg from msys2 mingw64, I looked at the `fasm2.cmd` file to see how I could make .sh equivalents for my build scripts, but I ran into a bit of an issue. I also have open watcom installed and it expects its include folders to be listed under an "INCLUDE" environment variable (all uppercase) while I assume fasm2 expects them in "include" all lowercase. If I echo either of them they show the correct path. But when I try to add `-iInclude('fasm2.inc')` to my build.sh script I get this error:

Code:
Error: source file 'C:/programming/gamedev/_engines/dosbox/dos/opwatcom/h/fasm2.inc' not found    


It seems like fasmg is using my "INCLUDE" variable and not "include" like the fasm2.cmd would imply it expects. I don't think it's a case insensitivity problem on the part of the terminal since I can echo both of them and get the appropriate paths back for each one, it seems more like a "bug" in fasmg since I'm exporting my fasm include variable AFTER the open watcom one in my .bash_profile so there shouldn't be any way the open watcom one is overriding the fasm one. Is it a windows limitation and msys2 just isn't effected by it?
Post 05 Jul 2026, 22:27
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4535
Location: vpcmpistri
bitRAKE 06 Jul 2026, 01:43
The fasmg "-i" switch includes text -- in this instance that text is "Include('fasm2.inc')"; but in general it could be any text. and is not related to the include environment variable. I am not familiar with that environment. Both setting the include environment and using the command line option are needed.
Code:
#!/usr/bin/env bash

# 1. Get the absolute directory of the current script (equivalent to %~dp0)
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"

# 2. Convert the POSIX path to a Windows mixed path (e.g., C:/path/to/script)
# This is required if fasmg is a native Windows binary that doesn't understand /c/ paths.
WIN_DIR="$(cygpath -m "$DIR")"

# 3. Prepend the include directory to the 'include' environment variable.
# Use ';' because Windows native tools expect semicolons as path separators.
export include="${WIN_DIR}/include;${include}"

# 4. Execute fasmg
# Double quotes around the -i argument prevent Bash from misinterpreting the parentheses.
# "$@" passes all command-line arguments (equivalent to %*) while preserving whitespace.
"${DIR}/fasmg" "-iInclude('fasm2.inc')" "$@"    
Post 06 Jul 2026, 01:43
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8543
Location: Kraków, Poland
Tomasz Grysztar 06 Jul 2026, 10:28
therektafire wrote:
It seems like fasmg is using my "INCLUDE" variable and not "include" like the fasm2.cmd would imply it expects.
The variable used by fasmg is the uppercase "INCLUDE". The Bash script "fasm2" defines it in the uppercase. As for the "fasm2.cmd", it uses lowercase because environment variables in Windows are case-insensitive and it doesn't matter there. It was therefore an unfortunate choice to take the "fasm2.cmd" as a reference.
Post 06 Jul 2026, 10:28
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.