Skip to content
This repository was archived by the owner on Apr 25, 2026. It is now read-only.

Commit b801dda

Browse files
author
bauratynov
committed
build: link -lm for lrintf/sqrtf on Linux (MinGW links it implicitly)
1 parent 5610f81 commit b801dda

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- name: Build libfastface consumer test (compile only)
5555
run: |
5656
gcc-13 -O2 -march=x86-64-v3 -mavxvnni -fopenmp -I. \
57-
test_libfastface.c libfastface.a -o test_libfastface
57+
test_libfastface.c libfastface.a -o test_libfastface -lm
5858
5959
- name: Go build (compile only)
6060
working-directory: go/fastface

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ AR := ar
3131
# ARM NEON port (future): override with "-march=armv8.2-a+dotprod" etc.
3232
CFLAGS_ARCH ?= -march=native -mavx2 -mfma -mavxvnni
3333
CFLAGS = -O3 $(CFLAGS_ARCH) -fopenmp $(CFLAGS_EXTRA)
34+
# Link libraries: -lm is needed on Linux/POSIX for lrintf/sqrtf/etc.
35+
# MinGW on Windows links libm implicitly so this is a no-op there.
36+
LDLIBS = -lm
3437
DEFS = -DFFW2_NOMAIN
3538
PYTHON ?= python
3639

@@ -55,10 +58,10 @@ exes: $(BIN_MAIN) $(BIN_BATCHED)
5558
lib: libfastface.a
5659

5760
$(BIN_MAIN): arcface_forward_int8.c $(KERNEL_SRCS)
58-
$(CC) $(CFLAGS) $(DEFS) $^ -o $@
61+
$(CC) $(CFLAGS) $(DEFS) $^ -o $@ $(LDLIBS)
5962

6063
$(BIN_BATCHED): arcface_forward_int8_batched.c $(KERNEL_SRCS)
61-
$(CC) $(CFLAGS) $(DEFS) $^ -o $@
64+
$(CC) $(CFLAGS) $(DEFS) $^ -o $@ $(LDLIBS)
6265

6366
%.o: %.c
6467
$(CC) $(CFLAGS) $(DEFS) -c $< -o $@
@@ -67,7 +70,7 @@ libfastface.a: libfastface.o $(KERNEL_OBJS)
6770
$(AR) rcs $@ $^
6871

6972
$(BIN_TESTLIB): test_libfastface.c libfastface.a fastface.h
70-
$(CC) -O2 -fopenmp -I. test_libfastface.c libfastface.a -o $@
73+
$(CC) -O2 -fopenmp -I. test_libfastface.c libfastface.a -o $@ $(LDLIBS)
7174

7275
test: $(BIN_MAIN) tests/golden_input.bin tests/golden_int8_emb.bin
7376
$(PYTHON) tests/run_regression.py

0 commit comments

Comments
 (0)