Skip to content

Linking errors on Windows with msys2 #1

@moneylobster

Description

@moneylobster

After doing some replacements to adapt some parts of the repo to Windows (changing the foreign-library name in shared-object.lisp from libbmas.so to libbmas.dll and doing the same for make.sh) I got some errors during the linking stage with Windows 10 with msys2 on UCRT64.

Compilation Output

$ ./make.sh
In file included from simd/x86_64.h:11,
                 from bmas.c:11:
simd/x86_64/avx2.h: In function 'BMAS_vector_i64hindex':
simd/x86_64/avx2.h:1128:21: warning: left shift count >= width of type [-Wshift-count-overflow]
 1128 |   case 'a': m = 1UL << 63;  break;
      |                     ^~
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccjCZ5xB.o:bmas.c:(.text+0x1ade7): undefined reference to `_ZGVdN8v_sinf'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccjCZ5xB.o:bmas.c:(.text+0x1aff9): undefined reference to `_ZGVdN8v_sinf'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccjCZ5xB.o:bmas.c:(.text+0x1b19f): undefined reference to `_ZGVdN8v_sinf'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccjCZ5xB.o:bmas.c:(.text+0x1b27b): undefined reference to `_ZGVdN8v_sinf'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccjCZ5xB.o:bmas.c:(.text+0x1b397): undefined reference to `_ZGVdN8v_cosf'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccjCZ5xB.o:bmas.c:(.text+0x1b5a9): undefined reference to `_ZGVdN8v_cosf'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccjCZ5xB.o:bmas.c:(.text+0x1b74f): undefined reference to `_ZGVdN8v_cosf'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccjCZ5xB.o:bmas.c:(.text+0x1b82b): undefined reference to `_ZGVdN8v_cosf'
collect2.exe: error: ld returned 1 exit status

The errors seem to have to do with the sinf and cosf functions, and indeed trying to compile with these lines commented out works:

bmas/bmas.c

Lines 186 to 187 in bf68699

one_arg_fn_body(ssin, SIMD_SINGLE_STRIDE, float, BMAS_svec, float, BMAS_svec);
one_arg_fn_body(scos, SIMD_SINGLE_STRIDE, float, BMAS_svec, float, BMAS_svec);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions