header not found even though `PKG_CONFIG_PATH` is set correctly

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite
2












I've installed a library to ~/.local. The environment variables are set as shown below:



$ echo $LD_LIBRARY_PATH
/home/saga//.local/lib
$ echo $PKG_CONFIG_PATH
/home/saga//.local/lib/pkgconfig


There's an re2.pc file in /home/saga//.local/lib/pkgconfig whose contents are:



prefix=/home/saga//.local
exec_prefix=/home/saga//.local
includedir=/home/saga//.local/include
libdir=/home/saga//.local/lib

Name: re2
Description: RE2 is a fast, safe, thread-friendly regular expression engine.
Version: 0.0.0
Cflags: -std=c++11 -pthread -I$includedir
Libs: -pthread -L$libdir -lre2


There's an re2 directory in /home/saga//.local/include which contains re2.h. But when I try to compile a program which includes re2.h, I get the following error:



$ g++ tst.cpp
tst.cpp:1:9: fatal error: re2/re2.h: No such file or directory
#include<re2/re2.h>
^~~~~~~~~~~
compilation terminated.


and



$ g++ tst2.cpp
tst.cpp:1:9: fatal error: re2.h: No such file or directory
#include<re2.h>
^~~~~~~
compilation terminated.


The output of pkg-config --libs re2 is -L/home/saga//.local/lib -pthread -lre2



How can I fix this?







share|improve this question






















  • Did you try querying pkgconfig so you can find out where the header is located?
    – Ignacio Vazquez-Abrams
    Nov 10 '17 at 17:34










  • @Ignacio Vazquez-Abramshow do I do that?
    – saga
    Nov 10 '17 at 17:35











  • @IgnacioVazquez-Abrams The output of pkg-config --libs re2 is -L/home/saga//.local/lib -pthread -lre2
    – saga
    Nov 10 '17 at 17:44










  • Okay. Did you try telling that to g++?
    – Ignacio Vazquez-Abrams
    Nov 10 '17 at 17:44










  • Tried the solution offered below, getting the same error.
    – saga
    Nov 10 '17 at 17:50














up vote
0
down vote

favorite
2












I've installed a library to ~/.local. The environment variables are set as shown below:



$ echo $LD_LIBRARY_PATH
/home/saga//.local/lib
$ echo $PKG_CONFIG_PATH
/home/saga//.local/lib/pkgconfig


There's an re2.pc file in /home/saga//.local/lib/pkgconfig whose contents are:



prefix=/home/saga//.local
exec_prefix=/home/saga//.local
includedir=/home/saga//.local/include
libdir=/home/saga//.local/lib

Name: re2
Description: RE2 is a fast, safe, thread-friendly regular expression engine.
Version: 0.0.0
Cflags: -std=c++11 -pthread -I$includedir
Libs: -pthread -L$libdir -lre2


There's an re2 directory in /home/saga//.local/include which contains re2.h. But when I try to compile a program which includes re2.h, I get the following error:



$ g++ tst.cpp
tst.cpp:1:9: fatal error: re2/re2.h: No such file or directory
#include<re2/re2.h>
^~~~~~~~~~~
compilation terminated.


and



$ g++ tst2.cpp
tst.cpp:1:9: fatal error: re2.h: No such file or directory
#include<re2.h>
^~~~~~~
compilation terminated.


The output of pkg-config --libs re2 is -L/home/saga//.local/lib -pthread -lre2



How can I fix this?







share|improve this question






















  • Did you try querying pkgconfig so you can find out where the header is located?
    – Ignacio Vazquez-Abrams
    Nov 10 '17 at 17:34










  • @Ignacio Vazquez-Abramshow do I do that?
    – saga
    Nov 10 '17 at 17:35











  • @IgnacioVazquez-Abrams The output of pkg-config --libs re2 is -L/home/saga//.local/lib -pthread -lre2
    – saga
    Nov 10 '17 at 17:44










  • Okay. Did you try telling that to g++?
    – Ignacio Vazquez-Abrams
    Nov 10 '17 at 17:44










  • Tried the solution offered below, getting the same error.
    – saga
    Nov 10 '17 at 17:50












up vote
0
down vote

favorite
2









up vote
0
down vote

favorite
2






2





I've installed a library to ~/.local. The environment variables are set as shown below:



$ echo $LD_LIBRARY_PATH
/home/saga//.local/lib
$ echo $PKG_CONFIG_PATH
/home/saga//.local/lib/pkgconfig


There's an re2.pc file in /home/saga//.local/lib/pkgconfig whose contents are:



prefix=/home/saga//.local
exec_prefix=/home/saga//.local
includedir=/home/saga//.local/include
libdir=/home/saga//.local/lib

Name: re2
Description: RE2 is a fast, safe, thread-friendly regular expression engine.
Version: 0.0.0
Cflags: -std=c++11 -pthread -I$includedir
Libs: -pthread -L$libdir -lre2


There's an re2 directory in /home/saga//.local/include which contains re2.h. But when I try to compile a program which includes re2.h, I get the following error:



$ g++ tst.cpp
tst.cpp:1:9: fatal error: re2/re2.h: No such file or directory
#include<re2/re2.h>
^~~~~~~~~~~
compilation terminated.


and



$ g++ tst2.cpp
tst.cpp:1:9: fatal error: re2.h: No such file or directory
#include<re2.h>
^~~~~~~
compilation terminated.


The output of pkg-config --libs re2 is -L/home/saga//.local/lib -pthread -lre2



How can I fix this?







share|improve this question














I've installed a library to ~/.local. The environment variables are set as shown below:



$ echo $LD_LIBRARY_PATH
/home/saga//.local/lib
$ echo $PKG_CONFIG_PATH
/home/saga//.local/lib/pkgconfig


There's an re2.pc file in /home/saga//.local/lib/pkgconfig whose contents are:



prefix=/home/saga//.local
exec_prefix=/home/saga//.local
includedir=/home/saga//.local/include
libdir=/home/saga//.local/lib

Name: re2
Description: RE2 is a fast, safe, thread-friendly regular expression engine.
Version: 0.0.0
Cflags: -std=c++11 -pthread -I$includedir
Libs: -pthread -L$libdir -lre2


There's an re2 directory in /home/saga//.local/include which contains re2.h. But when I try to compile a program which includes re2.h, I get the following error:



$ g++ tst.cpp
tst.cpp:1:9: fatal error: re2/re2.h: No such file or directory
#include<re2/re2.h>
^~~~~~~~~~~
compilation terminated.


and



$ g++ tst2.cpp
tst.cpp:1:9: fatal error: re2.h: No such file or directory
#include<re2.h>
^~~~~~~
compilation terminated.


The output of pkg-config --libs re2 is -L/home/saga//.local/lib -pthread -lre2



How can I fix this?









share|improve this question













share|improve this question




share|improve this question








edited Nov 10 '17 at 17:45

























asked Nov 10 '17 at 17:31









saga

874219




874219











  • Did you try querying pkgconfig so you can find out where the header is located?
    – Ignacio Vazquez-Abrams
    Nov 10 '17 at 17:34










  • @Ignacio Vazquez-Abramshow do I do that?
    – saga
    Nov 10 '17 at 17:35











  • @IgnacioVazquez-Abrams The output of pkg-config --libs re2 is -L/home/saga//.local/lib -pthread -lre2
    – saga
    Nov 10 '17 at 17:44










  • Okay. Did you try telling that to g++?
    – Ignacio Vazquez-Abrams
    Nov 10 '17 at 17:44










  • Tried the solution offered below, getting the same error.
    – saga
    Nov 10 '17 at 17:50
















  • Did you try querying pkgconfig so you can find out where the header is located?
    – Ignacio Vazquez-Abrams
    Nov 10 '17 at 17:34










  • @Ignacio Vazquez-Abramshow do I do that?
    – saga
    Nov 10 '17 at 17:35











  • @IgnacioVazquez-Abrams The output of pkg-config --libs re2 is -L/home/saga//.local/lib -pthread -lre2
    – saga
    Nov 10 '17 at 17:44










  • Okay. Did you try telling that to g++?
    – Ignacio Vazquez-Abrams
    Nov 10 '17 at 17:44










  • Tried the solution offered below, getting the same error.
    – saga
    Nov 10 '17 at 17:50















Did you try querying pkgconfig so you can find out where the header is located?
– Ignacio Vazquez-Abrams
Nov 10 '17 at 17:34




Did you try querying pkgconfig so you can find out where the header is located?
– Ignacio Vazquez-Abrams
Nov 10 '17 at 17:34












@Ignacio Vazquez-Abramshow do I do that?
– saga
Nov 10 '17 at 17:35





@Ignacio Vazquez-Abramshow do I do that?
– saga
Nov 10 '17 at 17:35













@IgnacioVazquez-Abrams The output of pkg-config --libs re2 is -L/home/saga//.local/lib -pthread -lre2
– saga
Nov 10 '17 at 17:44




@IgnacioVazquez-Abrams The output of pkg-config --libs re2 is -L/home/saga//.local/lib -pthread -lre2
– saga
Nov 10 '17 at 17:44












Okay. Did you try telling that to g++?
– Ignacio Vazquez-Abrams
Nov 10 '17 at 17:44




Okay. Did you try telling that to g++?
– Ignacio Vazquez-Abrams
Nov 10 '17 at 17:44












Tried the solution offered below, getting the same error.
– saga
Nov 10 '17 at 17:50




Tried the solution offered below, getting the same error.
– saga
Nov 10 '17 at 17:50










2 Answers
2






active

oldest

votes

















up vote
0
down vote













You're not actually using pkg-config...



$ g++ $(pkg-config --cflags re2) tst.cpp





share|improve this answer






















  • Just tried it, I'm getting the same error.
    – saga
    Nov 10 '17 at 17:42










  • "There's an re2 directory in /home/saga//.local/include which contains re2.h."
    – Ignacio Vazquez-Abrams
    Nov 10 '17 at 17:42










  • @saga I first misread the question. Sorted now.
    – Kusalananda
    Nov 10 '17 at 17:47










  • Still getting the same error. The output of pkg-config --cflags re2 is -std=c++11 -pthreads
    – saga
    Nov 10 '17 at 17:48










  • Shouldn't there be an -I/ there as well.
    – saga
    Nov 10 '17 at 17:49

















up vote
0
down vote













You can try running pkg-config in debug mode with:



$ pkg-config --cflags-only-I re2 --debug


It should print something like this:



< cut >
Looking for package 're2'
Looking for package 're2-uninstalled'
Reading 're2' from file '/home/saga/.local/lib/pkgconfig/re2.pc'
Parsing package file '/home/saga/.local/lib/pkgconfig/re2.pc'
line>prefix=/home/saga//.local
Variable declaration, 'prefix' has value '/home/saga//local'
line>exec_prefix=/home/saga//.local
Variable declaration, 'exec_prefix' has value '/home/saga//local'
line>includedir=/home/saga//.local/include
Variable declaration, 'includedir' has value '/home/saga//.local/include'
line>libdir=/home/saga//.local/lib
Variable declaration, 'libdir' has value '/home/saga//.local/lib'
line>
line>Name: re2
line>Description: RE2 is a fast, safe, thread-friendly regular expression engine.
line>Version: 0.0.0
line>Cflags: -std=c++11 -pthread -I$includedir
line>Libs: -pthread -L$libdir -lre2
Path position of 're2' is 1
Adding 're2' to list of known packages
pre-remove: re2
post-remove: re2
original: re2
sorted: re2
adding CFLAGS_I string "-I/home/saga//.local/include "
returning flags string "-I/home/saga//.local/include "
-I/home/saga//.local/include


You can see that the last line is what you're currently missing.






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f403792%2fheader-not-found-even-though-pkg-config-path-is-set-correctly%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    You're not actually using pkg-config...



    $ g++ $(pkg-config --cflags re2) tst.cpp





    share|improve this answer






















    • Just tried it, I'm getting the same error.
      – saga
      Nov 10 '17 at 17:42










    • "There's an re2 directory in /home/saga//.local/include which contains re2.h."
      – Ignacio Vazquez-Abrams
      Nov 10 '17 at 17:42










    • @saga I first misread the question. Sorted now.
      – Kusalananda
      Nov 10 '17 at 17:47










    • Still getting the same error. The output of pkg-config --cflags re2 is -std=c++11 -pthreads
      – saga
      Nov 10 '17 at 17:48










    • Shouldn't there be an -I/ there as well.
      – saga
      Nov 10 '17 at 17:49














    up vote
    0
    down vote













    You're not actually using pkg-config...



    $ g++ $(pkg-config --cflags re2) tst.cpp





    share|improve this answer






















    • Just tried it, I'm getting the same error.
      – saga
      Nov 10 '17 at 17:42










    • "There's an re2 directory in /home/saga//.local/include which contains re2.h."
      – Ignacio Vazquez-Abrams
      Nov 10 '17 at 17:42










    • @saga I first misread the question. Sorted now.
      – Kusalananda
      Nov 10 '17 at 17:47










    • Still getting the same error. The output of pkg-config --cflags re2 is -std=c++11 -pthreads
      – saga
      Nov 10 '17 at 17:48










    • Shouldn't there be an -I/ there as well.
      – saga
      Nov 10 '17 at 17:49












    up vote
    0
    down vote










    up vote
    0
    down vote









    You're not actually using pkg-config...



    $ g++ $(pkg-config --cflags re2) tst.cpp





    share|improve this answer














    You're not actually using pkg-config...



    $ g++ $(pkg-config --cflags re2) tst.cpp






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 10 '17 at 17:43

























    answered Nov 10 '17 at 17:39









    Kusalananda

    105k14207325




    105k14207325











    • Just tried it, I'm getting the same error.
      – saga
      Nov 10 '17 at 17:42










    • "There's an re2 directory in /home/saga//.local/include which contains re2.h."
      – Ignacio Vazquez-Abrams
      Nov 10 '17 at 17:42










    • @saga I first misread the question. Sorted now.
      – Kusalananda
      Nov 10 '17 at 17:47










    • Still getting the same error. The output of pkg-config --cflags re2 is -std=c++11 -pthreads
      – saga
      Nov 10 '17 at 17:48










    • Shouldn't there be an -I/ there as well.
      – saga
      Nov 10 '17 at 17:49
















    • Just tried it, I'm getting the same error.
      – saga
      Nov 10 '17 at 17:42










    • "There's an re2 directory in /home/saga//.local/include which contains re2.h."
      – Ignacio Vazquez-Abrams
      Nov 10 '17 at 17:42










    • @saga I first misread the question. Sorted now.
      – Kusalananda
      Nov 10 '17 at 17:47










    • Still getting the same error. The output of pkg-config --cflags re2 is -std=c++11 -pthreads
      – saga
      Nov 10 '17 at 17:48










    • Shouldn't there be an -I/ there as well.
      – saga
      Nov 10 '17 at 17:49















    Just tried it, I'm getting the same error.
    – saga
    Nov 10 '17 at 17:42




    Just tried it, I'm getting the same error.
    – saga
    Nov 10 '17 at 17:42












    "There's an re2 directory in /home/saga//.local/include which contains re2.h."
    – Ignacio Vazquez-Abrams
    Nov 10 '17 at 17:42




    "There's an re2 directory in /home/saga//.local/include which contains re2.h."
    – Ignacio Vazquez-Abrams
    Nov 10 '17 at 17:42












    @saga I first misread the question. Sorted now.
    – Kusalananda
    Nov 10 '17 at 17:47




    @saga I first misread the question. Sorted now.
    – Kusalananda
    Nov 10 '17 at 17:47












    Still getting the same error. The output of pkg-config --cflags re2 is -std=c++11 -pthreads
    – saga
    Nov 10 '17 at 17:48




    Still getting the same error. The output of pkg-config --cflags re2 is -std=c++11 -pthreads
    – saga
    Nov 10 '17 at 17:48












    Shouldn't there be an -I/ there as well.
    – saga
    Nov 10 '17 at 17:49




    Shouldn't there be an -I/ there as well.
    – saga
    Nov 10 '17 at 17:49












    up vote
    0
    down vote













    You can try running pkg-config in debug mode with:



    $ pkg-config --cflags-only-I re2 --debug


    It should print something like this:



    < cut >
    Looking for package 're2'
    Looking for package 're2-uninstalled'
    Reading 're2' from file '/home/saga/.local/lib/pkgconfig/re2.pc'
    Parsing package file '/home/saga/.local/lib/pkgconfig/re2.pc'
    line>prefix=/home/saga//.local
    Variable declaration, 'prefix' has value '/home/saga//local'
    line>exec_prefix=/home/saga//.local
    Variable declaration, 'exec_prefix' has value '/home/saga//local'
    line>includedir=/home/saga//.local/include
    Variable declaration, 'includedir' has value '/home/saga//.local/include'
    line>libdir=/home/saga//.local/lib
    Variable declaration, 'libdir' has value '/home/saga//.local/lib'
    line>
    line>Name: re2
    line>Description: RE2 is a fast, safe, thread-friendly regular expression engine.
    line>Version: 0.0.0
    line>Cflags: -std=c++11 -pthread -I$includedir
    line>Libs: -pthread -L$libdir -lre2
    Path position of 're2' is 1
    Adding 're2' to list of known packages
    pre-remove: re2
    post-remove: re2
    original: re2
    sorted: re2
    adding CFLAGS_I string "-I/home/saga//.local/include "
    returning flags string "-I/home/saga//.local/include "
    -I/home/saga//.local/include


    You can see that the last line is what you're currently missing.






    share|improve this answer
























      up vote
      0
      down vote













      You can try running pkg-config in debug mode with:



      $ pkg-config --cflags-only-I re2 --debug


      It should print something like this:



      < cut >
      Looking for package 're2'
      Looking for package 're2-uninstalled'
      Reading 're2' from file '/home/saga/.local/lib/pkgconfig/re2.pc'
      Parsing package file '/home/saga/.local/lib/pkgconfig/re2.pc'
      line>prefix=/home/saga//.local
      Variable declaration, 'prefix' has value '/home/saga//local'
      line>exec_prefix=/home/saga//.local
      Variable declaration, 'exec_prefix' has value '/home/saga//local'
      line>includedir=/home/saga//.local/include
      Variable declaration, 'includedir' has value '/home/saga//.local/include'
      line>libdir=/home/saga//.local/lib
      Variable declaration, 'libdir' has value '/home/saga//.local/lib'
      line>
      line>Name: re2
      line>Description: RE2 is a fast, safe, thread-friendly regular expression engine.
      line>Version: 0.0.0
      line>Cflags: -std=c++11 -pthread -I$includedir
      line>Libs: -pthread -L$libdir -lre2
      Path position of 're2' is 1
      Adding 're2' to list of known packages
      pre-remove: re2
      post-remove: re2
      original: re2
      sorted: re2
      adding CFLAGS_I string "-I/home/saga//.local/include "
      returning flags string "-I/home/saga//.local/include "
      -I/home/saga//.local/include


      You can see that the last line is what you're currently missing.






      share|improve this answer






















        up vote
        0
        down vote










        up vote
        0
        down vote









        You can try running pkg-config in debug mode with:



        $ pkg-config --cflags-only-I re2 --debug


        It should print something like this:



        < cut >
        Looking for package 're2'
        Looking for package 're2-uninstalled'
        Reading 're2' from file '/home/saga/.local/lib/pkgconfig/re2.pc'
        Parsing package file '/home/saga/.local/lib/pkgconfig/re2.pc'
        line>prefix=/home/saga//.local
        Variable declaration, 'prefix' has value '/home/saga//local'
        line>exec_prefix=/home/saga//.local
        Variable declaration, 'exec_prefix' has value '/home/saga//local'
        line>includedir=/home/saga//.local/include
        Variable declaration, 'includedir' has value '/home/saga//.local/include'
        line>libdir=/home/saga//.local/lib
        Variable declaration, 'libdir' has value '/home/saga//.local/lib'
        line>
        line>Name: re2
        line>Description: RE2 is a fast, safe, thread-friendly regular expression engine.
        line>Version: 0.0.0
        line>Cflags: -std=c++11 -pthread -I$includedir
        line>Libs: -pthread -L$libdir -lre2
        Path position of 're2' is 1
        Adding 're2' to list of known packages
        pre-remove: re2
        post-remove: re2
        original: re2
        sorted: re2
        adding CFLAGS_I string "-I/home/saga//.local/include "
        returning flags string "-I/home/saga//.local/include "
        -I/home/saga//.local/include


        You can see that the last line is what you're currently missing.






        share|improve this answer












        You can try running pkg-config in debug mode with:



        $ pkg-config --cflags-only-I re2 --debug


        It should print something like this:



        < cut >
        Looking for package 're2'
        Looking for package 're2-uninstalled'
        Reading 're2' from file '/home/saga/.local/lib/pkgconfig/re2.pc'
        Parsing package file '/home/saga/.local/lib/pkgconfig/re2.pc'
        line>prefix=/home/saga//.local
        Variable declaration, 'prefix' has value '/home/saga//local'
        line>exec_prefix=/home/saga//.local
        Variable declaration, 'exec_prefix' has value '/home/saga//local'
        line>includedir=/home/saga//.local/include
        Variable declaration, 'includedir' has value '/home/saga//.local/include'
        line>libdir=/home/saga//.local/lib
        Variable declaration, 'libdir' has value '/home/saga//.local/lib'
        line>
        line>Name: re2
        line>Description: RE2 is a fast, safe, thread-friendly regular expression engine.
        line>Version: 0.0.0
        line>Cflags: -std=c++11 -pthread -I$includedir
        line>Libs: -pthread -L$libdir -lre2
        Path position of 're2' is 1
        Adding 're2' to list of known packages
        pre-remove: re2
        post-remove: re2
        original: re2
        sorted: re2
        adding CFLAGS_I string "-I/home/saga//.local/include "
        returning flags string "-I/home/saga//.local/include "
        -I/home/saga//.local/include


        You can see that the last line is what you're currently missing.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 '17 at 9:02









        virtualdj

        113




        113



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f403792%2fheader-not-found-even-though-pkg-config-path-is-set-correctly%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay