Skip to contentSkip to conversation

package/pifmrds: always link with -lm

PATCH New Fabrice Fontaine 3 participants 4 messages May 25, 2021 – May 26, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/pifmrds: always link with -lm

Commit 888546e5273d77d49bec564a515e85d7acee6bdd wrongly removed linking with -lm resulting in the following build failure:

/home/buildroot/autobuild/run/instance-3/output-1/host/bin/arm-linux-gnueabihf-gcc -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o -L/home/buildroot/autobuild/run/instance-3/output-1/host/bin/../arm-buildroot-linux-gnueabihf/sysroot/usr/lib -lsndfile /home/buildroot/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-linux-gnueabihf/7.3.1/../../../../arm-linux-gnueabihf/bin/ld: fm_mpx.o: undefined reference to symbol 'cos@@GLIBC_2.4' /home/buildroot/autobuild/run/instance-3/output-1/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libm.so.6: error adding symbols: DSO missing from command line

Fixes:
- http://autobuild.buildroot.org/results/b2a6e6fd77bf9071ce9f75fed1811be9ffe5366d

---
 package/pifmrds/0003-Makefile-fix-static-link.patch | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/pifmrds/0003-Makefile-fix-static-link.patch +2 -2
index 3bd91c981f..3832b77d59 100644
@@ -15,11 +15,11 @@ diff -purN pifmrds-0bf57f9ce0d954365a38d8af8e7be6f28521c3f2.orig/src/Makefile pi
  
  app: rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o
 -	$(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o -lm -lsndfile
-+	$(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o $(SNDFILE_LIBS)
++	$(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o $(SNDFILE_LIBS) -lm
  
  rds_wav: rds.o waveforms.o rds_wav.o fm_mpx.o
 -	$(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o -lm -lsndfile
-+	$(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o $(SNDFILE_LIBS)
++	$(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o $(SNDFILE_LIBS) -lm
  
  rds.o: rds.c waveforms.h
  	$(CC) $(CFLAGS) rds.c
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/1 package/pifmrds: always link with -lm

Quoted 6 lines · Fabrice Fontaine

Commit 888546e5273d77d49bec564a515e85d7acee6bdd wrongly removed linking with -lm resulting in the following build failure:

/home/buildroot/autobuild/run/instance-3/output-1/host/bin/arm-linux-gnueabihf-gcc -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o -L/home/buildroot/autobuild/run/instance-3/output-1/host/bin/../arm-buildroot-linux-gnueabihf/sysroot/usr/lib -lsndfile /home/buildroot/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-linux-gnueabihf/7.3.1/../../../../arm-linux-gnueabihf/bin/ld: fm_mpx.o: undefined reference to symbol 'cos@@GLIBC_2.4' /home/buildroot/autobuild/run/instance-3/output-1/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libm.so.6: error adding symbols: DSO missing from command line

Although the only undefined reference here was for a symbol referenced from
pifmrds itself, the original patch was actually for libsndfile (it uses pow and frexp, possibly others as well). So I would actually expect libsndfile to add it to its libs in the pc file.

That said, since pifmrds uses math functions directly, this fix is still
correct, so applied to master, thanks.

Regards,
Arnout

Quoted 28 lines

Fixes:
- http://autobuild.buildroot.org/results/b2a6e6fd77bf9071ce9f75fed1811be9ffe5366d

---
 package/pifmrds/0003-Makefile-fix-static-link.patch | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/pifmrds/0003-Makefile-fix-static-link.patch +2 -2
index 3bd91c981f..3832b77d59 100644
@@ -15,11 +15,11 @@ diff -purN pifmrds-0bf57f9ce0d954365a38d8af8e7be6f28521c3f2.orig/src/Makefile pi
 
  app: rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o
 -	$(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o -lm -lsndfile
-+	$(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o $(SNDFILE_LIBS)
++	$(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o $(SNDFILE_LIBS) -lm
 
  rds_wav: rds.o waveforms.o rds_wav.o fm_mpx.o
 -	$(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o -lm -lsndfile
-+	$(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o $(SNDFILE_LIBS)
++	$(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o $(SNDFILE_LIBS) -lm
 
  rds.o: rds.c waveforms.h
  	$(CC) $(CFLAGS) rds.c
#2 lore raw

PATCH 1/1 package/pifmrds: always link with -lm

Arnout, All,

On 2021-05-25 21:59 +0200, Arnout Vandecappelle spake thusly:

Quoted 12 lines · Fabrice Fontaine
Quoted 6 lines

Commit 888546e5273d77d49bec564a515e85d7acee6bdd wrongly removed linking with -lm resulting in the following build failure:

/home/buildroot/autobuild/run/instance-3/output-1/host/bin/arm-linux-gnueabihf-gcc -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o -L/home/buildroot/autobuild/run/instance-3/output-1/host/bin/../arm-buildroot-linux-gnueabihf/sysroot/usr/lib -lsndfile /home/buildroot/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-linux-gnueabihf/7.3.1/../../../../arm-linux-gnueabihf/bin/ld: fm_mpx.o: undefined reference to symbol 'cos@@GLIBC_2.4' /home/buildroot/autobuild/run/instance-3/output-1/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libm.so.6: error adding symbols: DSO missing from command line

Although the only undefined reference here was for a symbol referenced from
pifmrds itself, the original patch was actually for libsndfile (it uses pow and frexp, possibly others as well). So I would actually expect libsndfile to add it to its libs in the pc file.

That's what I assumed...

Quoted 2 lines

That said, since pifmrds uses math functions directly, this fix is still
correct, so applied to master, thanks.

But then, we should change the commit log of that patch, to state that -lm is need for pifmrds itself, otherwise this is going to stay confusing when we update to a libsndfile that properly add -lm to its .pc file, no?

Regards,
Yann E. MORIN.

Quoted 35 lines

Regards,
Arnout

Quoted 18 lines

Fixes:
- http://autobuild.buildroot.org/results/b2a6e6fd77bf9071ce9f75fed1811be9ffe5366d

---
 package/pifmrds/0003-Makefile-fix-static-link.patch | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/pifmrds/0003-Makefile-fix-static-link.patch +0 -0
index 3bd91c981f..3832b77d59 100644
@@ -15,11 +15,11 @@ diff -purN pifmrds-0bf57f9ce0d954365a38d8af8e7be6f28521c3f2.orig/src/Makefile pi
 
  app: rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o
 -	$(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o -lm -lsndfile

package/pifmrds/0003-Makefile-fix-static-link.patch diff -purN pifmrds-0bf57f9ce0d954365a38d8af8e7be6f28521c3f2.orig/src/Makefile pi · line 25

Quoted 10 lines
package/pifmrds/0003-Makefile-fix-static-link.patch +2 -2
-+	$(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o $(SNDFILE_LIBS)
++	$(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o $(SNDFILE_LIBS) -lm
 
  rds_wav: rds.o waveforms.o rds_wav.o fm_mpx.o
 -	$(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o -lm -lsndfile
-+	$(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o $(SNDFILE_LIBS)
++	$(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o $(SNDFILE_LIBS) -lm
 
  rds.o: rds.c waveforms.h
  	$(CC) $(CFLAGS) rds.c

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/1 package/pifmrds: always link with -lm

Quoted 18 lines · Yann E. MORIN

Arnout, All,

On 2021-05-25 21:59 +0200, Arnout Vandecappelle spake thusly:

Quoted 12 lines · Fabrice Fontaine
Quoted 6 lines

Commit 888546e5273d77d49bec564a515e85d7acee6bdd wrongly removed linking with -lm resulting in the following build failure:

/home/buildroot/autobuild/run/instance-3/output-1/host/bin/arm-linux-gnueabihf-gcc -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o -L/home/buildroot/autobuild/run/instance-3/output-1/host/bin/../arm-buildroot-linux-gnueabihf/sysroot/usr/lib -lsndfile /home/buildroot/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-linux-gnueabihf/7.3.1/../../../../arm-linux-gnueabihf/bin/ld: fm_mpx.o: undefined reference to symbol 'cos@@GLIBC_2.4' /home/buildroot/autobuild/run/instance-3/output-1/host/arm-buildroot-linux-gnueabihf/sysroot/lib/libm.so.6: error adding symbols: DSO missing from command line

Although the only undefined reference here was for a symbol referenced from
pifmrds itself, the original patch was actually for libsndfile (it uses pow and frexp, possibly others as well). So I would actually expect libsndfile to add it to its libs in the pc file.

That's what I assumed...

Quoted 7 lines
Quoted 2 lines

That said, since pifmrds uses math functions directly, this fix is still
correct, so applied to master, thanks.

But then, we should change the commit log of that patch, to state that -lm is need for pifmrds itself, otherwise this is going to stay confusing when we update to a libsndfile that properly add -lm to its .pc file, no?

No, the patch is there because the original code does "-lm -lsndfile". Since
sndfile *also* uses symbols from libm.a, and they will be in different sections if libc is built with -ffunction-sections, the linker will fail to pick up the functions required by libsndfile.

[snip]

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

- $(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o -lm -lsndfile
-+ $(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o $(SNDFILE_LIBS)
++ $(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o $(SNDFILE_LIBS) -lm

If the pc file from libsndfile would be correct, we could indeed change the
patch to

++ $(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o
control_pipe.o -lm $(SNDFILE_LIBS)

and *then* we could update the commit message.

Regards,
Arnout

Quoted 14 lines
Quoted 13 lines
Quoted 9 lines

rds_wav: rds.o waveforms.o rds_wav.o fm_mpx.o
- $(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o -lm -lsndfile
-+ $(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o $(SNDFILE_LIBS)
++ $(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o $(SNDFILE_LIBS) -lm

  rds.o: rds.c waveforms.h
  	$(CC) $(CFLAGS) rds.c

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot