#gcc #c 17 #bazel
#gcc #c 17 #bazel
Вопрос:
Я хочу использовать OpenEXR в проекте Bazel.
Мой WORKSPACE.bazel выглядит так:
# 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"],
)
Я использую openexr.Файл сборки предоставлен seurat
В моем файле BUILD.bazel я создаю тестовую цель:
cc_test(
name = "TestOpenEXR",
timeout = "short",
srcs = [
"test_openexr.cpp",
],
deps = [
"@googletest//:gtest_main",
"@openexr//:half",
"@openexr//:iex",
"@openexr//:ilm_imf",
"@openexr//:imath",
],
)
Когда я пытаюсь создать эту цель с помощью Bazel (3.5.0) ( bazel build
) с Ubuntu 18.04 и gcc 7.5.0, я получаю следующую ошибку:
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 amp; 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 amp; 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 amp; 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 (настолько хорошо, насколько это возможно ;)):
build:gcc --cxxopt=-std=c 17
Есть идеи, как я могу обойти ошибку ISO C 1z?
Ответ №1:
Тем временем я смог решить проблему. Основываясь на файле файла сборки от seurat, я взял обновленную основную версию OpenEXR и начал исправлять все проблемы. Финальная СБОРКА.bazel была успешно протестирована с Ubuntu 16.08 GCC, LLVM и Windows 10 VS2019.
Я создал свою собственную ветку bazel для OpenEXR: https://github.com/Vertexwahn/openexr/tree/bazel
Обновление OpenEXR теперь имеет официальную поддержку Bazel.