首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用OpenEXR和Bazel?

用OpenEXR和Bazel?
EN

Stack Overflow用户
提问于 2020-09-27 14:41:19
回答 1查看 199关注 0票数 0

我想在Bazel项目中使用OpenEXR

我的WORKSPACE.bazel看起来是这样的:

代码语言:javascript
复制
# OpenEXR
http_archive(
    name = "openexr",
    build_file = "//third_party:openexr.BUILD",
    sha256 = "53126a6a0d29f37336382f4d41afa8cc78b1958628e5e586469503c41af73f1d",
    strip_prefix = "openexr-2.2.0",
    urls = ["https://github.com/openexr/openexr/archive/v2.2.0.zip"],
)

我正在使用seurat提供的openexr.BUILD文件

在我的BUILD.bazel文件中,我创建一个测试目标:

代码语言:javascript
复制
cc_test(
    name = "TestOpenEXR",
    timeout = "short",
    srcs = [
        "test_openexr.cpp",
    ],
    deps = [
        "@googletest//:gtest_main",
        "@openexr//:half",
        "@openexr//:iex",
        "@openexr//:ilm_imf",
        "@openexr//:imath",
    ],
)

当我试图使用Ubuntu18.04和gcc 7.5.0使用Bazel (3.5.0) (bazel build)构建这个目标时,我得到以下错误:

代码语言:javascript
复制
BUILD.bazel:241:11: C++ compilation of rule '@openexr//:imath' failed (Exit 1) gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 49 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
In file included from external/openexr/IlmBase/Imath/ImathBox.h:65:0,
                 from external/openexr/IlmBase/Imath/ImathBox.cpp:35:
external/openexr/IlmBase/Imath/ImathVec.h:228:34: error: ISO C++1z does not allow dynamic exception specifications
     const Vec2 & normalizeExc () throw (IEX_NAMESPACE::MathExc);
                                  ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:232:37: error: ISO C++1z does not allow dynamic exception specifications
     Vec2<T>  normalizedExc () const throw (IEX_NAMESPACE::MathExc);
                                     ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:440:34: error: ISO C++1z does not allow dynamic exception specifications
     const Vec3 & normalizeExc () throw (IEX_NAMESPACE::MathExc);
                                  ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:444:37: error: ISO C++1z does not allow dynamic exception specifications
     Vec3<T>  normalizedExc () const throw (IEX_NAMESPACE::MathExc);
                                     ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:622:37: error: ISO C++1z does not allow dynamic exception specifications
     const Vec4 &    normalizeExc () throw (IEX_NAMESPACE::MathExc);
                                     ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:626:44: error: ISO C++1z does not allow dynamic exception specifications
     Vec4<T>         normalizedExc () const throw (IEX_NAMESPACE::MathExc);
                                            ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:714:30: error: ISO C++1z does not allow dynamic exception specifications
 Vec2<short>::normalizeExc () throw (IEX_NAMESPACE::MathExc);
                              ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:723:37: error: ISO C++1z does not allow dynamic exception specifications
 Vec2<short>::normalizedExc () const throw (IEX_NAMESPACE::MathExc);
                                     ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:738:28: error: ISO C++1z does not allow dynamic exception specifications
 Vec2<int>::normalizeExc () throw (IEX_NAMESPACE::MathExc);
                            ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:747:35: error: ISO C++1z does not allow dynamic exception specifications
 Vec2<int>::normalizedExc () const throw (IEX_NAMESPACE::MathExc);
                                   ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:762:30: error: ISO C++1z does not allow dynamic exception specifications
 Vec3<short>::normalizeExc () throw (IEX_NAMESPACE::MathExc);
                              ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:771:37: error: ISO C++1z does not allow dynamic exception specifications
 Vec3<short>::normalizedExc () const throw (IEX_NAMESPACE::MathExc);
                                     ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:786:28: error: ISO C++1z does not allow dynamic exception specifications
 Vec3<int>::normalizeExc () throw (IEX_NAMESPACE::MathExc);
                            ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:795:35: error: ISO C++1z does not allow dynamic exception specifications
 Vec3<int>::normalizedExc () const throw (IEX_NAMESPACE::MathExc);
                                   ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:809:30: error: ISO C++1z does not allow dynamic exception specifications
 Vec4<short>::normalizeExc () throw (IEX_NAMESPACE::MathExc);
                              ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:818:37: error: ISO C++1z does not allow dynamic exception specifications
 Vec4<short>::normalizedExc () const throw (IEX_NAMESPACE::MathExc);
                                     ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:833:28: error: ISO C++1z does not allow dynamic exception specifications
 Vec4<int>::normalizeExc () throw (IEX_NAMESPACE::MathExc);
                            ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:842:35: error: ISO C++1z does not allow dynamic exception specifications
 Vec4<int>::normalizedExc () const throw (IEX_NAMESPACE::MathExc);
                                   ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:1212:26: error: ISO C++1z does not allow dynamic exception specifications
 Vec2<T>::normalizeExc () throw (IEX_NAMESPACE::MathExc)
                          ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:1249:33: error: ISO C++1z does not allow dynamic exception specifications
 Vec2<T>::normalizedExc () const throw (IEX_NAMESPACE::MathExc)
                                 ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:1704:26: error: ISO C++1z does not allow dynamic exception specifications
 Vec3<T>::normalizeExc () throw (IEX_NAMESPACE::MathExc)
                          ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:1743:33: error: ISO C++1z does not allow dynamic exception specifications
 Vec3<T>::normalizedExc () const throw (IEX_NAMESPACE::MathExc)
                                 ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:2109:26: error: ISO C++1z does not allow dynamic exception specifications
 Vec4<T>::normalizeExc () throw (IEX_NAMESPACE::MathExc)
                          ^~~~~
external/openexr/IlmBase/Imath/ImathVec.h:2150:33: error: ISO C++1z does not allow dynamic exception specifications
 Vec4<T>::normalizedExc () const throw (IEX_NAMESPACE::MathExc)
                                 ^~~~~
cc1plus: warning: unrecognized command line option '-Wno-deprecated-register'
cc1plus: warning: unrecognized command line option '-Wno-string-conversion'

我正在使用一个.bazelrc文件,它应该强制GCC使用C++17 (尽可能好;):

代码语言:javascript
复制
build:gcc --cxxopt=-std=c++17

有什么办法可以避免C++1z的错误吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-10-04 19:17:08

同时,我也解决了这个问题。基于seurat的生成文件文件,我采用了最新的主版本von,并开始修复所有问题。最后的BUILD.bazel在Ubuntu16.08 GCC、LLVM和Windows 10 VS2019上测试成功。

我为OpenEXR:https://github.com/Vertexwahn/openexr/tree/bazel创建了自己的bazel分支

Update OpenEXR现在拥有官方的Bazel支持。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64089675

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档