Conversation
|
Got it to compile on windows without specifying Windows MSVC using .version = "2.16.1-4", and zig "0.15.0-dev.77+aa8aa6625"; I actually had to include "nasmlib/ilog2.c", again, and rewrite two macros in include\nasmint.h These Flags I have set to 1, else is null or the default / linux thing (from ._XOPEN_SOURCE onwards) |
|
Nice. Do the code changes required not break Linux/mac? |
I used your build system, removed the windows depended usage of nasm/ilog2.c, removed the msvc dependence check and changed the config.h flags as told above. Well, compiling without errors might just mean the compilation didn't encounter known errors, not that the build programm actually works. But I had no problems compiling with : zig build -Dtarget=x86_64-linux -Doptimize=ReleaseSafe What bugs me is that I had to make changes to a nasm-native file: include/nasmint.h zig cc -dM -E - < NUL (on my windows machine tells me that on my zig x86-64 windows) clang has for example predefined: #define LLONG_WIDTH 64 #define INT64_C(x) x ## i64 which clang cannot expand. So I with my limited compiler knowledge have no idea why that macro-branch is used instead of the other which define. #define INT64_C(x) x ## L |
|
oh and I have no idea what a yalm or .ci file is used for: Good old manual browser download boy, no fancy git |
https://github.com/Banacial/Files_I_Need/blob/main/build_nasm.zig |
Yeah bugs me too. Seems that it thinks MSVC is active even though |
|
ziglang/zig#9536 |
|
Okay I think what happened was: namsint.h checks It now compiles :) |
One thing that I'm not so sure about is if maybe some of the compilation flags may affect NASM output. Since there are no test cases in this repo there is no way to know for sure if there are any regressions. Maybe we could run the test suite in CI. It seems though we'd need to check in the "golden" files which are required to run the test cases against. I'm not even sure how to get those for Windows (probably by grabbing the NASM official binary). |
|
Note that this PR also unlocks Windows and macOS support for the ffmpeg package :) |
When running with -fsanitize=leak enabled nasm prints this error:
==19965==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 360 byte(s) in 90 object(s) allocated from:
#0 0x7faee9396867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x5645d39a401c in nasm_malloc nasmlib/alloc.c:55
#2 0x5645d3a41f9d in string_transform asm/strfunc.c:356
#3 0x5645d3a37d40 in eval_strfunc asm/eval.c:761
#4 0x5645d3a37d40 in expr6 asm/eval.c:906
#5 0x5645d3a3968d in expr5 asm/eval.c:627
#6 0x5645d3a39aca in expr4 asm/eval.c:602
#7 0x5645d3a39b72 in expr3 asm/eval.c:563
#8 0x5645d3a39db8 in expr2 asm/eval.c:537
#9 0x5645d3a39f38 in expr1 asm/eval.c:511
#10 0x5645d3a3a0b8 in expr0 asm/eval.c:485
netwide-assembler#11 0x5645d3a3a242 in rexp3 asm/eval.c:422
netwide-assembler#12 0x5645d3a3a508 in rexp2 asm/eval.c:396
netwide-assembler#13 0x5645d3a3a6a8 in rexp1 asm/eval.c:369
netwide-assembler#14 0x5645d3a3a838 in rexp0 asm/eval.c:342
netwide-assembler#15 0x5645d3a3a838 in cexpr asm/eval.c:305
netwide-assembler#16 0x5645d3a3ad08 in bexpr asm/eval.c:298
netwide-assembler#17 0x5645d3a3ad08 in evaluate asm/eval.c:1032
netwide-assembler#18 0x5645d39e4f20 in parse_line asm/parser.c:959
netwide-assembler#19 0x5645d399e243 in assemble_file asm/nasm.c:1735
netwide-assembler#20 0x5645d3998801 in main asm/nasm.c:719
netwide-assembler#21 0x7faee8aaed8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
netwide-assembler#22 0x7faee8aaee3f in __libc_start_main_impl ../csu/libc-start.c:392
netwide-assembler#23 0x5645d399acd4 in _start (/home/ivan/d/nasm/nasm+0x2e5cd4)
SUMMARY: AddressSanitizer: 360 byte(s) leaked in 90 allocation(s).
This problem is reproducible on test utf.asm.
The problem was caused by the fact that eval_strfunc doesn't free the string
allocated by string_transform.
Signed-off-by: Ivan Sorokin <vanyacpp@gmail.com>
Note that the MSVC ABI is NOT supported for Windows. Just the default mingw included ABI