Using OpenEXR with Bazel? - gcc

I want to use OpenEXR in a Bazel project.
My WORKSPACE.bazel look like this:
# 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"],
)
I am using the openexr.BUILD file provided by seurat
In my BUILD.bazel file I create a test target:
cc_test(
name = "TestOpenEXR",
timeout = "short",
srcs = [
"test_openexr.cpp",
],
deps = [
"#googletest//:gtest_main",
"#openexr//:half",
"#openexr//:iex",
"#openexr//:ilm_imf",
"#openexr//:imath",
],
)
When I try to build this target using Bazel (3.5.0) (bazel build) with Ubuntu 18.04 and gcc 7.5.0 I get the following error:
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'
I am using a .bazelrc file that should force GCC to use C++17 (as good as it can ;)):
build:gcc --cxxopt=-std=c++17
Any ideas how I can get around the ISO C++1z error?

In the meantime, I was able to solve the problem. Base on the BUILD file file
from seurat I took an up to date master version von OpenEXR and started to fix all issues. The final BUILD.bazel was tested successfully with Ubuntu 16.08 GCC, LLVM and Windows 10 VS2019.
I created my own bazel branch for the OpenEXR: https://github.com/Vertexwahn/openexr/tree/bazel
Update
OpenEXR has now official Bazel support.

Related

Connection to NEAR Wallet following documentation does not work

I started checking out the NEAR protocol following near quick reference
But I get the error "Property 'keyStores' does not exist on type 'typeof import("../near-api-js/lib/index")'." on this line
const { connect, keyStores, WalletConnection } = nearAPI;
Adding the TS ignore declariation makes it compile:
// #ts-ignore
const { connect, keyStores, KeyPair } = nearAPI;

Failed overload resolution during pack expansion

while I was trying to make some adaptations in my code, I encountered a problem with pack expansion, where theoretically it should compile.
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(20,2): error C2672: 'ExpandArgs': no matching overloaded function found
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(17): message : see reference to function template instantiation 'void `anonymous-namespace'::ExpandArgs<const char(&)[9],>(boost::log::v2s_mt_nt6::record_ostream &,Arg)' being compiled
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(17): message : with
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(17): message : [
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(17): message : Arg=const char (&)[9]
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(17): message : ]
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(54): message : see reference to function template instantiation 'void `anonymous-namespace'::ExpandArgs<const char(&)[9],std::string&>(boost::log::v2s_mt_nt6::record_ostream &,Arg,std::string &)' being compiled
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(54): message : with
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(54): message : [
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(54): message : Arg=const char (&)[9]
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(54): message : ]
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(77): message : see reference to function template instantiation 'void CustomLogger::Log<boost::log::v2s_mt_nt6::sources::logger_mt,const char(&)[9],std::string&>(Logger &,const char (&)[9],std::string &)' being compiled
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(77): message : with
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(77): message : [
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(77): message : Logger=boost::log::v2s_mt_nt6::sources::logger_mt
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(77): message : ]
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(88): message : see reference to function template instantiation 'void sA::Log<const char(&)[9],std::string&>(const char (&)[9],std::string &)' being compiled
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(17,1): error C2780: 'void `anonymous-namespace'::ExpandArgs(boost::log::v2s_mt_nt6::record_ostream &,Arg &&,Args &&...)': expects 3 arguments - 1 provided
1>C:\Projects\PocTemplateOverloadingResolution\Source.cpp(16): message : see declaration of '`anonymous-namespace'::ExpandArgs'
Code: Link to code
I are using Visual Studio 2019 (v142)
SDK Version: 10.0.18362.0
Can anyone see the problem?
Can anyone see the problem?
Not sure (sorry: no experience with boost) but...
template< typename Arg, typename ...Args >
void ExpandArgs(boost::log::record_ostream& stream, Arg&& arg, Args&&... args)
{
ExpandArgs(stream, std::forward< Arg >(arg));
ExpandArgs(stream, std::forward<Args>(args)...); // SHOULD COMPILE, right?
//ExpandArgs(stream, "xpto", std::string("xpto"));
}
template< typename Arg >
void ExpandArgs(boost::log::record_ostream& stream, Arg&& arg)
{
stream << std::forward< Arg >(arg);
}
what about, when Args... is empty, in the "SHOULD COMPILE, right?" call?
ExpandArgs(stream, std::forward<Args>(args)...); // ???
The call become
ExpandArgs(stream);
but I don't see an ExpandArgs() function that receive only a stream argument.
I suppose you can add a terminal case as follows
void ExpandArgs (boost::log::record_ostream &)
{ }
to solve this problem.

Xamarin: Internal Error in the activation system when "Build All"

I'm getting an Unhandled Exception Error when "Build All" in Xamarin starts as below:
Xamarin.Components.Ide.ApiClients.XamarinStoreException: No user found.
at Xamarin.Components.Ide.ApiClients.XamarinStore.<StartTrial>m__0 (System.Threading.Tasks.Task`1 t) [0x00049] in /Users/builder/data/lanes/2508/0b60eecd/source/md-addins/Xamarin.Ide/Xamarin.Components.Ide/ApiClients/XamarinStore.cs:80
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[TAntecedentResult,TResult].InnerInvoke () [0x00027] in /private/tmp/source-mono-mac-4.2.0-branch/bockbuild-mono-4.2.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.2.1/external/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:207
at System.Threading.Tasks.Task.Execute () [0x00016] in /private/tmp/source-mono-mac-4.2.0-branch/bockbuild-mono-4.2.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.2.1/external/referencesource/mscorlib/system/threading/Tasks/Task.cs:2523

VerifyError using protobuf 2.4.1

I am getting below error when trying to create a newBuilder() object for a given protobuf class. Having protobuf-java-2.4.1.jar in the classpath.
Same is working on the server side but fails on the client.
java.lang.VerifyError: Bad return type
Exception Details:
Location:
packagename.QuerySpecProtos$QuerySpec$Builder.clone()Lcom/google/protobuf/AbstractMessageLite$Builder; #4: areturn
Reason:
Type 'packagename.QuerySpecProtos$QuerySpec$Builder' (current frame, stack[0]) is not assignable to 'com/google/protobuf/AbstractMessageLite$Builder' (from method signature)
Current Frame:
bci: #4
flags: { }
locals: { 'packagename.QuerySpecProtos$QuerySpec$Builder' }
stack: { 'packagename.QuerySpecProtos$QuerySpec$Builder' }
Bytecode:
0000000: 2ab6 0062 b0
Looks like a version mismatch. You need to be sure that both:
You use the same jar version when compiling and running.
You use the same version of protoc to match the jar.

Mono completely ignores app.config

I've added an app.config file to my project by right-clicking on the solution => Add => New File => Misc => Application Configuration File, and named it "LightmapUpdater.exe.config". "LightmapUpdater.exe" is the name of my executable. Here's what the config file has inside:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<dllmap dll="libIL" target="/opt/local/lib/libil.dylib" />
</configuration>
No matter what mistakes I intentionally make in the file, it keeps ignoring them, not giving me even a single warning. Is it supposed to be that way? Why is it ignoring everything I type in there? How can I make sure that mono looks inside of my config file before compiling? I must be missing some step.
It does work for me. With executable file Test773.exe the file is named Test773.exe.config and the dll mapping specified takes place. Is the file in the same directory as the exe file? Is it marked with a "Copy to output" option in MonoDevelop?
The source code of the application:
using System;
using System.Runtime.InteropServices;
namespace Test773
{
class MainClass
{
public static void Main(string[] args)
{
Funkcja();
}
[DllImport("libIL")]
public static extern void Funkcja();
}
}
The content of the config file is copy pasted from your question. The effect of the execution:
Unhandled Exception:
System.DllNotFoundException: /opt/local/lib/libil.dylib
at (wrapper managed-to-native) Test773.MainClass:Funkcja ()
at Test773.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: /opt/local/lib/libil.dylib
at (wrapper managed-to-native) Test773.MainClass:Funkcja ()
at Test773.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0
EDIT:
To trace/debug this you can use MONO_LOG_LEVEL. For example:
MONO_LOG_LEVEL=debug mono Test773.exe | grep config
results in:
Mono: Config attempting to parse: '/usr/lib/mono/4.5/mscorlib.dll.config'.
Mono: Config attempting to parse: '/usr/etc/mono/assemblies/mscorlib/mscorlib.config'.
Mono: Config attempting to parse: '/usr/etc/mono/config'.
Mono: Config attempting to parse: '/home/konrad/.mono/config'.
Mono: Config attempting to parse: '/home/konrad/eksperymenty/Test773/Test773/bin/Debug/Test773.exe.config'.
Mono: Config attempting to parse: '/usr/etc/mono/assemblies/Test773/Test773.config'.

Resources