Menu

#263 .pc -I flags inconsistent with *.h includes

1.12.0
closed
None
5
2015-02-06
2014-12-14
No

glew.pc publishes -I${prefix}/include/GL, the specific directory where the *.h are installed. That means my source would have:

#include <glew.h>

or

#include <glxew.h>

But GL/glxew.h has in it:

#include <GL/glew.h>

which means it needs the -I flag for ${prefix}/include (without the GL subdir compontent). If I install glew in a place that is not in my compiler's search paths, #include <glxew.h> is a compile-time error because GL/glew.h cannot be located.

Three possible solutions:

  1. Change glxew.h to include <glew.h> so that everything is consistently relative to the -I the .pc publishes. That contradicts many of the example code fragments in doc/*.html

  2. Change the .pc to also publish the higher-level -I flag so that either #include <GL gl*.h=""> or <gl*.h> will work.

  3. Change the .pc to only publish the higher-level -I flag so that everyone would always and only use #include <gl*.h>. That probably breaks third-party code that might have read the .pc and followed what -I said.

Discussion

  • Daniel Macks

    Daniel Macks - 2014-12-14

    Sorry for the mess, still getting used to the new SF tracker formatting. Those three bold items should read respectively:

    #include <glew.h>
    
    #include <glxew.h>
    
    #include <GL/glew.h>
    
     
  • Nigel Stewart

    Nigel Stewart - 2014-12-15

    At first glance, I think the .pc file is simply wrong.
    It should be

    #include <GL/glew.h>
    

    in source code, as far as I recall.
    (I'll go check...)

    • Nigel
     

    Last edit: Nigel Stewart 2014-12-15
  • Nigel Stewart

    Nigel Stewart - 2014-12-15
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,14 +1,14 @@
     glew.pc publishes -I${prefix}/include/GL, the specific directory where the *.h are installed. That means my source would have:
    
    -#include <glew.h>
    +    #include <glew.h>
    
     or
    
    -#include <glxew.h>
    +    #include <glxew.h>
    
     But GL/glxew.h has in it:
    
    -#include <GL/glew.h>
    +    #include <GL/glew.h>
    
     which means it needs the -I flag for ${prefix}/include (without the GL subdir compontent). If I install glew in a place that is not in my compiler's search paths, #include <glxew.h> is a compile-time error because GL/glew.h cannot be located.
    
     
  • Nigel Stewart

    Nigel Stewart - 2015-01-24
    • status: open --> pending
    • assigned_to: Nigel Stewart
    • Priority: 1 --> 5
     
  • Nigel Stewart

    Nigel Stewart - 2015-01-24

    Fixed in git, thanks.

     
  • Nigel Stewart

    Nigel Stewart - 2015-02-06
    • Status: pending --> closed