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.
I'm using jsreport to render HTML and generate a PDF file and it works locally, but on Lambda, it throws this error:
{
"errorMessage": "Error during rendering report: Cannot read property 'filter' of undefined",
"errorType": "TypeError",
"stackTrace": [
"Phantom.execute (/var/task/node_modules/jsreport-phantom-pdf/lib/phantom.js:169:53)",
"/var/task/node_modules/jsreport-core/lib/render/render.js:118:23",
"tryCatcher (/var/task/node_modules/bluebird/js/release/util.js:16:23)",
"Promise._settlePromiseFromHandler (/var/task/node_modules/bluebird/js/release/promise.js:512:31)",
"Promise._settlePromise (/var/task/node_modules/bluebird/js/release/promise.js:569:18)",
"Promise._settlePromise0 (/var/task/node_modules/bluebird/js/release/promise.js:614:10)",
"Promise._settlePromises (/var/task/node_modules/bluebird/js/release/promise.js:693:18)",
"Async._drainQueue (/var/task/node_modules/bluebird/js/release/async.js:133:16)",
"Async._drainQueues (/var/task/node_modules/bluebird/js/release/async.js:143:10)",
"Immediate.Async.drainQueues (/var/task/node_modules/bluebird/js/release/async.js:17:14)",
"runCallback (timers.js:672:20)",
"tryOnImmediate (timers.js:645:5)",
"processImmediate [as _immediateCallback] (timers.js:617:5)"
]
}
Same environment variables, same Node version.
Here's the line that generates the error above: https://github.com/jsreport/jsreport-phantom-pdf/blob/ad8d42e640348abffe77f2fed818528bee3eed98/lib/phantom.js#L169
var phantom = this.definition.options.phantoms.filter(function (p) {
return p.version === request.template.phantom.phantomjsVersion
})
which implies the object path options.phantoms is undefined.
You'll have to check how definitions is set up in your Lambda.
As it turned out, it was a problem of this library: node-app-root-path.
I fixed it by passing the correct rootDirectory option to jsreport.
I'm having a bit of a problem understanding the compile errors I'm getting when trying to create a boost::asio::deadline_timer. I get the errors below with the following code example on MSVC10. It was built with Boost 1.48
The first error looks like it is complaining about a member function set as a handler to async_wait being a reference. However, when I change the argument it gives a similar error.
I've been looking at Boost::Bind and Boost::Asio to try and figure out what I'm doing wrong. My code is similar to this example with the way I use bind and deadline_timer.
Sorry about how messy the compile errors look. I'm still trying to get a handle on Markdown.
Code Example
include
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <boost/asio.hpp>
#include <boost/system/error_code.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
class TimerThing
{
protected:
boost::asio::deadline_timer* statusTimer_;
boost::thread_group worker_threads_;
boost::asio::io_service io_service_;
boost::shared_ptr<boost::asio::io_service::work> work_;
public:
TimerThing() {}
virtual ~TimerThing(){}
void updateStatus(boost::system::error_code& ec)
{
if (ec == boost::asio::error::operation_aborted)
return;
std::cout<<"Status Update"<<std::endl;
statusTimer_->expires_at(statusTimer_->expires_at() + boost::posix_time::seconds(1));
statusTimer_->async_wait(boost::bind(&TimerThing::updateStatus, this, , boost::asio::placeholders::error));
}
void start()
{
statusTimer_=new boost::asio::deadline_timer(io_service_);
boost::shared_ptr<boost::asio::io_service::work> myWork(new boost::asio::io_service::work(io_service_));
work_=myWork;
worker_threads_.create_thread( boost::bind( &TimerThing::threadAction, this ) );
statusTimer_->expires_at(statusTimer_->expires_at() + boost::posix_time::seconds(1));
statusTimer_->async_wait(boost::bind(&TimerThing::updateStatus, this, boost::asio::placeholders::error));
}
void threadAction()
{
io_service_.run();
}
void stop()
{
work_.reset();
io_service_.stop();
worker_threads_.join_all();
delete statusTimer_;
}
};
#include "TimerThing.h"
int main(int argc, const char* argv[] )
{
TimerThing t;
std::string input;
std::cout<<"Press f to stop"<<std::endl;
t.start();
std::cin>>input;
t.stop();
return 0;
}
Compiler errors
c:\Underware\version\include\boost/bind/bind.hpp(313): error C2664: 'R boost::_mfi::mf1::operator ()(const U &,A1) const' : cannot convert parameter 2 from 'const boost::system::error_code' to 'boost::system::error_code &'
with
[
R=void,
T=TimerThing,
A1=boost::system::error_code &,
U=TimerThing *
]
Conversion loses qualifiers
c:\Underware\version\include\boost/bind/bind_template.hpp(47) : see reference to function template instantiation 'void boost::_bi::list2<A1,A2>::operator ()<F,boost::_bi::list1<const boost::system::error_code &>>(boost::_bi::type<T>,F &,A &,int)' being compiled
with
[
A1=boost::_bi::value<TimerThing *>,
A2=boost::arg<1>,
F=boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,
T=void,
A=boost::_bi::list1<const boost::system::error_code &>
]
c:\Underware\version\include\boost/asio/detail/bind_handler.hpp(46) : see reference to function template instantiation 'void boost::_bi::bind_t<R,F,L>::operator ()<const Arg1>(const A1 &)' being compiled
with
[
R=void,
F=boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,
L=boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>,
Arg1=const boost::system::error_code,
A1=const boost::system::error_code
]
c:\Underware\version\include\boost/asio/detail/bind_handler.hpp(45) : while compiling class template member function 'void boost::asio::detail::binder1<Handler,Arg1>::operator ()(void)'
with
[
Handler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>,
Arg1=boost::system::error_code
]
c:\Underware\version\include\boost/asio/detail/wait_handler.hpp(59) : see reference to class template instantiation 'boost::asio::detail::binder1<Handler,Arg1>' being compiled
with
[
Handler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>,
Arg1=boost::system::error_code
]
c:\Underware\version\include\boost/asio/detail/wait_handler.hpp(45) : while compiling class template member function 'void boost::asio::detail::wait_handler<Handler>::do_complete(boost::asio::detail::io_service_impl *,boost::asio::detail::operation *,const boost::system::error_code &,size_t)'
with
[
Handler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>
]
c:\Underware\version\include\boost/asio/detail/deadline_timer_service.hpp(185) : see reference to class template instantiation 'boost::asio::detail::wait_handler<Handler>' being compiled
with
[
Handler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>
]
c:\Underware\version\include\boost/asio/deadline_timer_service.hpp(137) : see reference to function template instantiation 'void boost::asio::detail::deadline_timer_service<Time_Traits>::async_wait<WaitHandler>(boost::asio::detail::deadline_timer_service<Time_Traits>::implementation_type &,Handler)' being compiled
with
[
Time_Traits=boost::asio::time_traits<boost::posix_time::ptime>,
WaitHandler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>,
Handler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>
]
c:\Underware\version\include\boost/asio/basic_deadline_timer.hpp(502) : see reference to function template instantiation 'void boost::asio::deadline_timer_service<TimeType,TimeTraits>::async_wait<WaitHandler>(boost::asio::detail::deadline_timer_service<Time_Traits>::implementation_type &,const WaitHandler &)' being compiled
with
[
TimeType=boost::posix_time::ptime,
TimeTraits=boost::asio::time_traits<boost::posix_time::ptime>,
WaitHandler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>,
Time_Traits=boost::asio::time_traits<boost::posix_time::ptime>
]
c:\users\tharper\documents\visual studio 2010\projects\asiotimer\asiotimer\TimerThing.h(48) : see reference to function template instantiation 'void boost::asio::basic_deadline_timer::async_wait>(const WaitHandler &)' being compiled
with
[
Time=boost::posix_time::ptime,
R=void,
F=boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,
L=boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>,
WaitHandler=boost::_bi::bind_t,boost::_bi::list2,boost::arg<1>>>
]
TimerThing.cpp
c:\Underware\version\include\boost/bind/bind.hpp(313): error C2664: 'R boost::_mfi::mf1::operator ()(const U &,A1) const' : cannot convert parameter 2 from 'const boost::system::error_code' to 'boost::system::error_code &'
with
[
R=void,
T=TimerThing,
A1=boost::system::error_code &,
U=TimerThing *
]
Conversion loses qualifiers
c:\Underware\version\include\boost/bind/bind_template.hpp(47) : see reference to function template instantiation 'void boost::_bi::list2::operator ()>(boost::_bi::type,F &,A &,int)' being compiled
with
[
A1=boost::_bi::value<TimerThing *>,
A2=boost::arg<1>,
F=boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,
T=void,
A=boost::_bi::list1<const boost::system::error_code &>
]
c:\Underware\version\include\boost/asio/detail/bind_handler.hpp(46) : see reference to function template instantiation 'void boost::_bi::bind_t<R,F,L>::operator ()<const Arg1>(const A1 &)' being compiled
with
[
R=void,
F=boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,
L=boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<>>,
Arg1=const boost::system::error_code,
A1=const boost::system::error_code
]
c:\Underware\version\include\boost/asio/detail/bind_handler.hpp(45) : while compiling class template member function 'void boost::asio::detail::binder1<Handler,Arg1>::operator ()(void)'
with
[
Handler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>,
Arg1=boost::system::error_code
]
c:\Underware\version\include\boost/asio/detail/wait_handler.hpp(59) : see reference to class template instantiation 'boost::asio::detail::binder1<Handler,Arg1>' being compiled
with
[
Handler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>,
Arg1=boost::system::error_code
]
c:\Underware\version\include\boost/asio/detail/wait_handler.hpp(45) : while compiling class template member function 'void boost::asio::detail::wait_handler<Handler>::do_complete(boost::asio::detail::io_service_impl *,boost::asio::detail::operation *,const boost::system::error_code &,size_t)'
with
[
Handler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>
]
c:\Underware\version\include\boost/asio/detail/deadline_timer_service.hpp(185) : see reference to class template instantiation 'boost::asio::detail::wait_handler<Handler>' being compiled
with
[
Handler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>
]
c:\Underware\version\include\boost/asio/deadline_timer_service.hpp(137) : see reference to function template instantiation 'void boost::asio::detail::deadline_timer_service<Time_Traits>::async_wait<WaitHandler>(boost::asio::detail::deadline_timer_service<Time_Traits>::implementation_type &,Handler)' being compiled
with
[
Time_Traits=boost::asio::time_traits<boost::posix_time::ptime>,
WaitHandler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>,
Handler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>
]
c:\Underware\version\include\boost/asio/basic_deadline_timer.hpp(502) : see reference to function template instantiation 'void boost::asio::deadline_timer_service<TimeType,TimeTraits>::async_wait<WaitHandler>(boost::asio::detail::deadline_timer_service<Time_Traits>::implementation_type &,const WaitHandler &)' being compiled
with
[
TimeType=boost::posix_time::ptime,
TimeTraits=boost::asio::time_traits<boost::posix_time::ptime>,
WaitHandler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>,
Time_Traits=boost::asio::time_traits<boost::posix_time::ptime>
]
c:\users\tharper\documents\visual studio 2010\projects\asiotimer\asiotimer\TimerThing.h(48) : see reference to function template instantiation 'void boost::asio::basic_deadline_timer<Time>::async_wait<boost::_bi::bind_t<R,F,L>>(const WaitHandler &)' being compiled
with
[
Time=boost::posix_time::ptime,
R=void,
F=boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,
L=boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>,
WaitHandler=boost::_bi::bind_t<void,boost::_mfi::mf1<void,TimerThing,boost::system::error_code &>,boost::_bi::list2<boost::_bi::value<TimerThing *>,boost::arg<1>>>
]
void updateStatus(boost::system::error_code& ec) should be void updateStatus(const boost::system::error_code& ec).
And you have extra comma in boost::bind(&TimerThing::updateStatus, this, , boost::asio::placeholders::error));
Your bind in start is correct, the one in updateStatus is not:
void updateStatus(const boost::system::error_code& ec)
{
if (ec == boost::asio::error::operation_aborted)
return;
std::cout<<"Status Update"<<std::endl;
statusTimer_->expires_at(
statusTimer_->expires_at() + boost::posix_time::seconds(1));
statusTimer_->async_wait(
boost::bind(&TimerThing::updateStatus, this,
boost::asio::placeholders::error));
}
You need to use the placeholder as well.
A general hint: Prefer posting compilable examples instead of a full compiler barf. In your case remove the unportable VC cruft (tmain, stdafx) and add all includes.