0

I'm currently trying to instrument part of the SPEC OMP 2012 benchmark suite using the Score-P profiling tool, and I'm getting an error. Specifically:

/XXX/imagick/src/magick_magick.c: In function ‘SetMagickSignalHandler’:
/XXX/imagick/src/magick_magick.c:1137:20: error: storage size of ‘action’ isn’t known
    struct sigaction action, previous_action;

Based on information I found here, the problem is that when I compile with -std=c99 (using gcc 6.2.1), the compiler doesn't recognize sigaction as it's not in the C99 spec.

Interestingly, when I compile without Score-P, I don't have this problem at all. But that's another story.

All of that being said, I still need to instrument this program. I don't care about portability either. And I'm aware of the fact that you should not directly include <bits/sigaction.h>. With that in mind, I'd still like to know:

  1. How do I ignore the #error that gets thrown as soon as I try to compile>

  2. Why does this error exist?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
tonysdg
  • 1,335
  • 11
  • 32
  • 1
    Why don't you simply compile without `-std=c99` then? – melpomene Jan 06 '17 at 17:33
  • @melpomene: ...you know how sometimes the answer is really obvious, and you don't see it until someone smacks you across the face? Yeah, I'll do that lol. Thanks! Would still appreciate an answer to the question for my own curiosity though :) – tonysdg Jan 06 '17 at 17:35
  • I think the answers are 1) you don't and 2) because you're not supposed to directly include ``. :-) – melpomene Jan 06 '17 at 17:38
  • 1
    I've had a look at [the `sigaction` man page](http://man7.org/linux/man-pages/man2/rt_sigaction.2.html) and it seems you can `#define _POSIX_C_SOURCE 1` before including `` to get the declaration even in C99 mode. Alternatively you can use `-std=gnu99` to get C99 mode + all GNU extensions. – melpomene Jan 06 '17 at 17:40
  • @melpomene: I didn't see that on the man page -- thanks!! WRT to (2), surely there's a better reason than that... is it a portability issue? Are they using weird macros or something? Or is it just a matter of they want to hide the implementation because it's good software engineering practice? – tonysdg Jan 06 '17 at 17:48

0 Answers0