Skip to contentSkip to conversation

devlink: Fix link errors on some systems

PATCH In review Roi Dayan 1 participant 2 messages Jun 22, 2021

Subsystems (2)
lore
Share & tools
lore

Roi Dayan

author
#0 lore raw

PATCH 1/1 devlink: Fix link errors on some systems

On some systems we fail to link because of missing math lib. add -lm to devlink.

LINK devlink
../lib/libutil.a(utils_math.o): In function `get_rate':
utils_math.c:(.text+0xcc): undefined reference to floor' ../lib/libutil.a(utils_math.o): In function get_size':
utils_math.c:(.text+0x384): undefined reference to `floor'
collect2: error: ld returned 1 exit status make[1]: *** [Makefile:16: devlink] Error 1
make: *** [Makefile:64: all] Error 2

Fixes 6c70aca76ef2 ("devlink: Add port func rate support")
---
 devlink/Makefile | 1 +
 1 file changed, 1 insertion(+)
devlink/Makefile +1 -0
index d540feb3c012..d37a4b4d0241 100644
@@ -7,6 +7,7 @@ ifeq ($(HAVE_MNL),y)
 
 DEVLINKOBJ = devlink.o mnlg.o
 TARGETS += devlink
+LDLIBS += -lm
 
 endif
 
Signature · 1 line
2.8.0
author
#1 lore raw

+jiri

Quoted 31 lines · Roi Dayan

On some systems we fail to link because of missing math lib. add -lm to devlink.

LINK devlink
../lib/libutil.a(utils_math.o): In function `get_rate':
utils_math.c:(.text+0xcc): undefined reference to floor' ../lib/libutil.a(utils_math.o): In function get_size':
utils_math.c:(.text+0x384): undefined reference to `floor'
collect2: error: ld returned 1 exit status make[1]: *** [Makefile:16: devlink] Error 1
make: *** [Makefile:64: all] Error 2

Fixes 6c70aca76ef2 ("devlink: Add port func rate support")
---
  devlink/Makefile | 1 +
  1 file changed, 1 insertion(+)
devlink/Makefile +1 -0
index d540feb3c012..d37a4b4d0241 100644
@@ -7,6 +7,7 @@ ifeq ($(HAVE_MNL),y)
 
  DEVLINKOBJ = devlink.o mnlg.o
  TARGETS += devlink
+LDLIBS += -lm
 
  endif