FindPostgreSQL.cmake将不能在ubuntu上工作 [英] FindPostgreSQL.cmake won't work on ubuntu

查看:972
本文介绍了FindPostgreSQL.cmake将不能在ubuntu上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • Ubuntu 12.04

  • CMake 2.8.9

  • Postgresql 9.2.2

  • c / c / c / c / c / c / c / c / c / c / c / c / c / postgresql / libpq-fe.h 。



    这是我在 CMakeLists.txt 中所拥有的:

      find_package(PostgreSQL REQUIRED)

    我得到:

      CMake错误在/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97(MESSAGE): 
    无法找到PostgreSQL(缺少:PostgreSQL_TYPE_INCLUDE_DIR)(找到
    版本9.2.2)
    调用堆栈(最近调用)
    / usr / share / 2.8 / Modules / FindPackageHandleStandardArgs.cmake:288(_FPHSA_FAILURE_MESSAGE)
    /usr/share/cmake-2.8/Modules/FindPostgreSQL.cmake:155(find_package_handle_standard_args)
    CMakeLists.txt:7(find_package)

    我在调用 find_package 之前添加了以下行,但它didn

     设置(PostgreSQL_ADDITIONAL_VERSIONS9.2.2)
    设置(PostgreSQL_ADDITIONAL_SEARCH_PATHS $ { PostgreSQL_ADDITIONAL_SEARCH_PATHS}/ usr / include / postgresql)



    我还尝试了 PostgreSQL_TYPE_INCLUDE_DIR ,但没有找到任何东西。我还可以尝试什么?

    解决方案

    经过一些更多的调试后,我发现它正在卡住试图找到 pg_type.h



    此文件位于 /usr/include/postgresql/catalog/pg_types.h ,但模块希望在 /usr/include/postgresql/server/catalog/pg_types.h

      find_path(PostgreSQL_TYPE_INCLUDE_DIR 
    NAMES catalog / pg_type.h
    PATHS
    #查看其他地方
    $ {PostgreSQL_ROOT_DIRECTORIES}
    PATH_SUFFIXES
    pgsql / server
    postgresql / server
    include / server
    #帮助用户找到它如果我们不能
    DOC $ {PostgreSQL_INCLUDE_DIR_MESSAGE}



    如果我添加 postgresql PATH_SUFFIXES

      find_path PostgreSQL_TYPE_INCLUDE_DIR 
    NAMES目录/ pg_type.h
    PATHS
    #查看其他地方
    $ {PostgreSQL_ROOT_DIRECTORIES}
    PATH_SUFFIXES
    postgresql
    pgsql / server
    postgresql / server
    include / server
    #帮助用户找到它,如果我们不能。
    DOCThe $ {PostgreSQL_INCLUDE_DIR_MESSAGE}


    • Ubuntu 12.04
    • CMake 2.8.9
    • Postgresql 9.2.2

    I'm trying to get the FindPostgreSQL module to find /usr/include/postgresql/libpq-fe.h.

    Here's what I have in my CMakeLists.txt:

    find_package(PostgreSQL REQUIRED)
    

    This is the error I get:

    CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (MESSAGE):
      Could NOT find PostgreSQL (missing: PostgreSQL_TYPE_INCLUDE_DIR) (found
      version "9.2.2")
    Call Stack (most recent call first):
      /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:288 (_FPHSA_FAILURE_MESSAGE)
      /usr/share/cmake-2.8/Modules/FindPostgreSQL.cmake:155 (find_package_handle_standard_args)
      CMakeLists.txt:7 (find_package)
    

    I added the following lines before calling find_package but it didn't seem to have any effect.

    set(PostgreSQL_ADDITIONAL_VERSIONS "9.2.2")
    set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} "/usr/include/postgresql")
    

    I also tried googling for PostgreSQL_TYPE_INCLUDE_DIR but didn't find anything. What else can I try?

    解决方案

    After a bit more debugging I figured out that it's getting stuck trying to find pg_type.h

    This file is located in /usr/include/postgresql/catalog/pg_types.h but the module is expecting to find it in /usr/include/postgresql/server/catalog/pg_types.h

    find_path(PostgreSQL_TYPE_INCLUDE_DIR
      NAMES catalog/pg_type.h
      PATHS
       # Look in other places.
       ${PostgreSQL_ROOT_DIRECTORIES}
      PATH_SUFFIXES
        pgsql/server
        postgresql/server
        include/server
      # Help the user find it if we cannot.
      DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
    )
    

    It works if I add postgresql to the PATH_SUFFIXES

    find_path(PostgreSQL_TYPE_INCLUDE_DIR
      NAMES catalog/pg_type.h
      PATHS
       # Look in other places.
       ${PostgreSQL_ROOT_DIRECTORIES}
      PATH_SUFFIXES
        postgresql
        pgsql/server
        postgresql/server
        include/server
      # Help the user find it if we cannot.
      DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
    )
    

    这篇关于FindPostgreSQL.cmake将不能在ubuntu上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆