dbry / adpcm-xq

Xtreme Quality IMA-ADPCM Encoder / Decoder
BSD 3-Clause "New" or "Revised" License
213 stars 46 forks source link

[OpenSUSE Tumbleweed] Linking error: undefined reference to `log10' #23

Closed 38github closed 1 month ago

38github commented 1 month ago
$ make
[ 20%] Building C object CMakeFiles/adpcm-xq.dir/adpcm-xq.c.o
[ 40%] Linking C static library libadpcm-xq.a
[ 40%] Built target adpcm-xq
[ 60%] Building C object CMakeFiles/adpcm-xq-exe.dir/adpcm-lib.c.o
[ 80%] Building C object CMakeFiles/adpcm-xq-exe.dir/adpcm-xq.c.o
[100%] Linking C executable adpcm-xq
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/adpcm-xq-exe.dir/adpcm-lib.c.o: in function `adpcm_set_shaping_weight':
adpcm-lib.c:(.text+0x1bb): undefined reference to `floor'
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/adpcm-xq-exe.dir/adpcm-lib.c.o: in function `adpcm_encode_block_ex':
adpcm-lib.c:(.text+0x2162): undefined reference to `generate_dns_values'
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/adpcm-xq-exe.dir/adpcm-xq.c.o: in function `adpcm_encode_data':
adpcm-xq.c:(.text+0x254b): undefined reference to `log10'
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: adpcm-xq.c:(.text+0x2570): undefined reference to `log10'
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: adpcm-xq.c:(.text+0x25bc): undefined reference to `log10'
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: adpcm-xq.c:(.text+0x25e1): undefined reference to `log10'
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: adpcm-xq.c:(.text+0x26b5): undefined reference to `log10'
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/adpcm-xq-exe.dir/adpcm-xq.c.o:adpcm-xq.c:(.text+0x26f5): more undefined references to `log10' follow
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/adpcm-xq-exe.dir/build.make:113: adpcm-xq] Error 1
make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/adpcm-xq-exe.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
38github commented 1 month ago

It works when adding -lm to the parameters:

$ gcc -O2 -lm *.c -o adpcm-xq
$ ./adpcm-xq

 ADPCM-XQ   Xtreme Quality IMA-ADPCM WAV Encoder / Decoder   Version 0.5
 Copyright (c) 2024 David Bryant. All Rights Reserved.

 Usage:     ADPCM-XQ [-options] infile.wav outfile.wav

 Operation: conversion is performed based on the type of the infile
          (either encode 16-bit PCM to 4-bit IMA-ADPCM or decode back)

 Options:  -[0-16]= encode lookahead samples (default = 3, max = 16)
           -b<n>  = override auto block size, 2^n bytes (n = 8-15)
           -d     = decode only (fail on WAV file already PCM)
           -e     = encode only (fail on WAV file already ADPCM)
           -f     = encode flat noise (no noise shaping, aka -s0.0)
           -h     = display this help message
           -n     = measure and report quantization noise
           -q     = quiet mode (display errors only)
           -r     = raw output (little-endian, no WAV header written)
           -s<n>  = override default noise shaping, (-1.0 < n <= 1.0)
           -v     = verbose (display lots of info)
           -w<n>  = override default 4-bit ADPCM width (2 <= n <= 5)
           -x     = exhaustive search (old behavior, very slow at depth)
           -y     = overwrite outfile if it exists

 Web:       Visit www.github.com/dbry/adpcm-xq for latest version and info

Undefined reference to log10 - math.h - AVRFREAKS.NET

dbry commented 1 month ago

Thanks for reminding me of this!

Yeah, the README needs several updates (all the new features!) and I was planing to upgrade to Markdown.

dbry commented 1 month ago

Updated README to Markdown and fixed build instructions.