Bug #129

audacious-plugins can't be compiled without compiler optimizations (-O1 / -O2)

Added by Thomas Lange over 4 years ago. Updated over 4 years ago.

Status:Closed Start date:June 16, 2012
Priority:Major Due date:
Assignee:- % Done:

100%

Category:-
Target version:3.3
Affects version:3.3

Description

I've noticed today that various audacious plugins fail to compile
because NULL is undeclared.
Strangely this is only the case if you disable compiler optimizations.

An example is this error message:

voice_removal.c:58:1: error: 'NULL' undeclared here (not in a function)
Failed to compile voice_removal.c (plugin)!
make5: * [voice_removal.plugin.o] Error 1
make4:
[all] Error 2
make3:
[subdirs] Error 2
make2:
[all] Error 2
make1:
[subdirs] Error 2
make: *
[all] Error 2

Is it better to include <stddef.h> for every failing plugin
or is it possible to define NULL in config.h?

stddef.patch Magnifier (1.7 kB) Thomas Lange, June 16, 2012 02:01

Associated revisions

Revision 3e4850dd
Added by John Lindgren over 4 years ago

Make sure NULL is defined. Closes: #129.

Revision 19190ba6
Added by John Lindgren over 4 years ago

Make sure NULL is defined. Closes: #129.

History

#1 Updated by Thomas Lange over 4 years ago

3.2.3 also fails to compile without -O2:

sndstretch.plugin.o: In function `ringcopy':
sndstretch.c:(.text+0x272): undefined reference to `ringpos'
sndstretch.c:(.text+0x287): undefined reference to `ringpos'
sndstretch.plugin.o: In function `ringload_IIR_1_div_e_echo_d':
sndstretch.c:(.text+0x2cc): undefined reference to `ringpos'
sndstretch.plugin.o: In function `ringload_IIR_1_div_e_echo_i':
sndstretch.c:(.text+0x3ac): undefined reference to `ringpos'
sndstretch.plugin.o: In function `ringload_IIR_1_div_e_echo_i_vc':
sndstretch.c:(.text+0x47c): undefined reference to `ringpos'
sndstretch.plugin.o:sndstretch.c:(.text+0x679): more undefined references to `ringpos' follow
collect2: error: ld returned 1 exit status
Failed to link sndstretch.so!
make5: * [sndstretch.so] Error 1
make4:
[all] Error 2
make3:
[subdirs] Error 1
make2:
[all] Error 2
make1:
[subdirs] Error 1
make: *
[all] Error 2

#2 Updated by Thomas Lange over 4 years ago

This patch solves the problem with 3.3.

#3 Updated by John Lindgren over 4 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

These are two separate issues, so they really should have been given separate reports.

I've defined NULL in libaudcore/core.h, where we also define some values like TRUE and FALSE:
https://github.com/audacious-media-player/audacious/commit/3e4850dd91ff2236a444649e9e6aa583bf2b3768

The sndstretch error turns out to be a violation of a fine point in the C99 standard, which I've also fixed:
https://github.com/audacious-media-player/audacious-plugins/commit/448248b86ff79fec7ae5771cd9462dbc23d4fa7f

Also available in: Atom PDF