Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Make #67

Open
ranmeng-china opened this issue Oct 19, 2023 · 6 comments
Open

Cannot Make #67

ranmeng-china opened this issue Oct 19, 2023 · 6 comments

Comments

@ranmeng-china
Copy link

ranmeng-china commented Oct 19, 2023

ademco_contactid.c:452:51: error: initializer element is not a compile-time constant static const float detection_threshold = goertzel_threshold_dbm0(GOERTZEL_SAMPLES_PER_BLOCK, -42.0f); ./spandsp/tone_detect.h:66:49: note: expanded from macro 'goertzel_threshold_dbm0' #define goertzel_threshold_dbm0(len,thresh) (float) ((len*len*32768.0*32768.0/2.0)*pow(10.0, (thresh - DBM0_MAX_SINE_POWER)/10.0)) ademco_contactid.c:453:77: error: initializer element is not a compile-time constant static const float tone_to_total_energy = GOERTZEL_SAMPLES_PER_BLOCK*db_to_power_ratio(-0.85f);

@ROBERT-MCDOWELL
Copy link

you should provide the OS gcc version etc...

@jan-ekholm
Copy link

This happens at least on macOS Sonoma (14.x) with Xcode 15.

> make
Making all in src
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.  -I..  -I/libtiff -DNDEBUG -Wunused-but-set-variable -D_XOPEN_SOURCE=700 -std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes  -I/opt/homebrew/include  -MT ademco_contactid.lo -MD -MP -MF .deps/ademco_contactid.Tpo -c -o ademco_contactid.lo ademco_contactid.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/libtiff -DNDEBUG -Wunused-but-set-variable -D_XOPEN_SOURCE=700 -std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -I/opt/homebrew/include -MT ademco_contactid.lo -MD -MP -MF .deps/ademco_contactid.Tpo -c ademco_contactid.c  -fno-common -DPIC -o .libs/ademco_contactid.o
ademco_contactid.c:452:51: error: initializer element is not a compile-time constant
static const float detection_threshold          = goertzel_threshold_dbm0(GOERTZEL_SAMPLES_PER_BLOCK, -42.0f);
                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./spandsp/tone_detect.h:66:49: note: expanded from macro 'goertzel_threshold_dbm0'
#define goertzel_threshold_dbm0(len,thresh)     (float) ((len*len*32768.0*32768.0/2.0)*pow(10.0, (thresh - DBM0_MAX_SINE_POWER)/10.0))
                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ademco_contactid.c:453:77: error: initializer element is not a compile-time constant
static const float tone_to_total_energy         = GOERTZEL_SAMPLES_PER_BLOCK*db_to_power_ratio(-0.85f);
                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
make[2]: *** [ademco_contactid.lo] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

@jan-ekholm
Copy link

Seems to be a GCC extension to allow this.

@iamtsm
Copy link

iamtsm commented Dec 2, 2023

I have also encountered this problem recently. Is there any way to solve it?

OS : Apple M1 Pro. macos sonoma 14.1

`
$ make
Making all in src
/Library/Developer/CommandLineTools/usr/bin/make all-am
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I/opt/homebrew/Cellar/libtiff/4.6.0/include -I/opt/homebrew/opt/jpeg/include -DNDEBUG -Wunused-but-set-variable -D_XOPEN_SOURCE=700 -std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -MT ademco_contactid.lo -MD -MP -MF .deps/ademco_contactid.Tpo -c -o ademco_contactid.lo ademco_contactid.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I/opt/homebrew/Cellar/libtiff/4.6.0/include -I/opt/homebrew/opt/jpeg/include -DNDEBUG -Wunused-but-set-variable -D_XOPEN_SOURCE=700 -std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -MT ademco_contactid.lo -MD -MP -MF .deps/ademco_contactid.Tpo -c ademco_contactid.c -fno-common -DPIC -o .libs/ademco_contactid.o
ademco_contactid.c:452:51: error: initializer element is not a compile-time constant
static const float detection_threshold = goertzel_threshold_dbm0(GOERTZEL_SAMPLES_PER_BLOCK, -42.0f);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./spandsp/tone_detect.h:66:49: note: expanded from macro 'goertzel_threshold_dbm0'
#define goertzel_threshold_dbm0(len,thresh) (float) ((lenlen32768.0*32768.0/2.0)pow(10.0, (thresh - DBM0_MAX_SINE_POWER)/10.0))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ademco_contactid.c:453:77: error: initializer element is not a compile-time constant
static const float tone_to_total_energy = GOERTZEL_SAMPLES_PER_BLOCK
db_to_power_ratio(-0.85f);
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
make[2]: *** [ademco_contactid.lo] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

$ uname -a
Darwin iamtsm.local 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 arm64
`

@jan-ekholm
Copy link

I have also encountered this problem recently. Is there any way to solve it?

I went back to a really old version from 2016 or so that I had used before and which worked well for my simple needs. Back then it still compiled ok on other compilers.

@jo-so
Copy link

jo-so commented Mar 16, 2024

The commit in question is 5394b2c. It replaced literals by expressions for initialization of some values. Gcc includes builtin functions for pow10f and the like, but Clang does not—unfortunately.

Could you rename the issue to »Fails to build with CLang«?

Maybe it's possible to move all these initialization values to a file that can be generated with a little tool. Possibly with a configure option --with-rebuild-init-values. But this file should be fixed and included in git.

shr-project referenced this issue Mar 16, 2024
V.150.1 has moved forward, but is still a work in progress.
The various modules using Goertzel filters were not using a harmonised
approach to setting thresholds and measuring power levels. This has
been improved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants