OVS with dpdk : error: ‘const struct vhost_device_ops’ has no member named ‘new_device’ - openvswitch

I see the following error while compiling openvswitch-2.13.6 library with dpdk. I have tried to look for answers and am not able to find. I did try to see what header is included. it is from
. /usr/local/include/rte_vhost.h and I see the variable definitions are available in struct vhost_device_ops
Any pointers and suggestions are welcome.
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I ./include -I ./include -I ./lib -I ./lib -I/root/dpdk/dpdk-21.11/build -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wswitch-bool -Wlogical-not-parentheses -Wsizeof-array-argument -Wbool-compare -Wshift-negative-value -Wduplicated-cond -Wshadow -mssse3 -include rte_config.h -I/usr/local/include -D_FILE_OFFSET_BITS=64 -I/root/dpdk/dpdk-21.11/build -Ofast -msse4.2 -mpopcnt -I/root/dpdk/dpdk-21.11/build -MT lib/netdev-dpdk.lo -MD -MP -MF lib/.deps/netdev-dpdk.Tpo -c lib/netdev-dpdk.c -o lib/netdev-dpdk.o
In file included from lib/netdev-dpdk.c:52:0:
lib/dp-packet.h: In function ‘dp_packet_hwol_is_tso’:
lib/dp-packet.h:541:13: warning: "PKT_TX_TCP_SEG" is deprecated
return !!(b->mbuf.ol_flags & PKT_TX_TCP_SEG);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_hwol_is_ipv4’:
lib/dp-packet.h:548:13: warning: "PKT_TX_IPV4" is deprecated
return !!(b->mbuf.ol_flags & PKT_TX_IPV4);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_hwol_l4_mask’:
lib/dp-packet.h:555:13: warning: "PKT_TX_L4_MASK" is deprecated
return b->mbuf.ol_flags & PKT_TX_L4_MASK;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_hwol_l4_is_tcp’:
lib/dp-packet.h:562:13: warning: "PKT_TX_L4_MASK" is deprecated
return (b->mbuf.ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h:562:13: warning: "PKT_TX_TCP_CKSUM" is deprecated
return (b->mbuf.ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_hwol_l4_is_udp’:
lib/dp-packet.h:569:13: warning: "PKT_TX_L4_MASK" is deprecated
return (b->mbuf.ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h:569:13: warning: "PKT_TX_UDP_CKSUM" is deprecated
return (b->mbuf.ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_hwol_l4_is_sctp’:
lib/dp-packet.h:576:13: warning: "PKT_TX_L4_MASK" is deprecated
return (b->mbuf.ol_flags & PKT_TX_L4_MASK) == PKT_TX_SCTP_CKSUM;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h:576:13: warning: "PKT_TX_SCTP_CKSUM" is deprecated
return (b->mbuf.ol_flags & PKT_TX_L4_MASK) == PKT_TX_SCTP_CKSUM;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_hwol_set_tx_ipv4’:
lib/dp-packet.h:583:13: warning: "PKT_TX_IPV4" is deprecated
b->mbuf.ol_flags |= PKT_TX_IPV4;
^~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_hwol_set_tx_ipv6’:
lib/dp-packet.h:590:13: warning: "PKT_TX_IPV6" is deprecated
b->mbuf.ol_flags |= PKT_TX_IPV6;
^~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_hwol_set_csum_tcp’:
lib/dp-packet.h:598:13: warning: "PKT_TX_TCP_CKSUM" is deprecated
b->mbuf.ol_flags |= PKT_TX_TCP_CKSUM;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_hwol_set_csum_udp’:
lib/dp-packet.h:606:13: warning: "PKT_TX_UDP_CKSUM" is deprecated
b->mbuf.ol_flags |= PKT_TX_UDP_CKSUM;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_hwol_set_csum_sctp’:
lib/dp-packet.h:614:13: warning: "PKT_TX_SCTP_CKSUM" is deprecated
b->mbuf.ol_flags |= PKT_TX_SCTP_CKSUM;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_hwol_set_tcp_seg’:
lib/dp-packet.h:623:13: warning: "PKT_TX_TCP_SEG" is deprecated
b->mbuf.ol_flags |= PKT_TX_TCP_SEG;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_set_rss_hash’:
lib/dp-packet.h:638:13: warning: "PKT_RX_RSS_HASH" is deprecated
p->mbuf.ol_flags |= PKT_RX_RSS_HASH;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_rss_valid’:
lib/dp-packet.h:644:13: warning: "PKT_RX_RSS_HASH" is deprecated
return p->mbuf.ol_flags & PKT_RX_RSS_HASH;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_reset_offload’:
lib/dp-packet.h:650:13: warning: "EXT_ATTACHED_MBUF" is deprecated
p->mbuf.ol_flags &= DPDK_MBUF_NON_OFFLOADING_FLAGS;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h:650:13: warning: "IND_ATTACHED_MBUF" is deprecated
lib/dp-packet.h: In function ‘dp_packet_ip_checksum_valid’:
lib/dp-packet.h:656:13: warning: "PKT_RX_IP_CKSUM_MASK" is deprecated
return (p->mbuf.ol_flags & PKT_RX_IP_CKSUM_MASK) ==
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h:657:13: warning: "PKT_RX_IP_CKSUM_GOOD" is deprecated
PKT_RX_IP_CKSUM_GOOD;
^~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_ip_checksum_bad’:
lib/dp-packet.h:663:13: warning: "PKT_RX_IP_CKSUM_MASK" is deprecated
return (p->mbuf.ol_flags & PKT_RX_IP_CKSUM_MASK) ==
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h:664:13: warning: "PKT_RX_IP_CKSUM_BAD" is deprecated
PKT_RX_IP_CKSUM_BAD;
^~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_l4_checksum_valid’:
lib/dp-packet.h:670:13: warning: "PKT_RX_L4_CKSUM_MASK" is deprecated
return (p->mbuf.ol_flags & PKT_RX_L4_CKSUM_MASK) ==
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h:671:13: warning: "PKT_RX_L4_CKSUM_GOOD" is deprecated
PKT_RX_L4_CKSUM_GOOD;
^~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_l4_checksum_bad’:
lib/dp-packet.h:677:13: warning: "PKT_RX_L4_CKSUM_MASK" is deprecated
return (p->mbuf.ol_flags & PKT_RX_L4_CKSUM_MASK) ==
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h:678:13: warning: "PKT_RX_L4_CKSUM_BAD" is deprecated
PKT_RX_L4_CKSUM_BAD;
^~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_has_flow_mark’:
lib/dp-packet.h:684:13: warning: "PKT_RX_FDIR_ID" is deprecated
if (p->mbuf.ol_flags & PKT_RX_FDIR_ID) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/dp-packet.h: In function ‘dp_packet_set_flow_mark’:
lib/dp-packet.h:696:13: warning: "PKT_RX_FDIR_ID" is deprecated
p->mbuf.ol_flags |= PKT_RX_FDIR_ID;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c: At top level:
lib/netdev-dpdk.c:191:21: error: variable ‘virtio_net_device_ops’ has initializer but incomplete type
static const struct vhost_device_ops virtio_net_device_ops =
^~~~~~~~~~~~~~~~
lib/netdev-dpdk.c:193:6: error: ‘const struct vhost_device_ops’ has no member named ‘new_device’
.new_device = new_device,
^~~~~~~~~~
lib/netdev-dpdk.c:193:20: warning: excess elements in struct initializer
.new_device = new_device,
^~~~~~~~~~
lib/netdev-dpdk.c:193:20: note: (near initialization for ‘virtio_net_device_ops’)
lib/netdev-dpdk.c:194:6: error: ‘const struct vhost_device_ops’ has no member named ‘destroy_device’
.destroy_device = destroy_device,
^~~~~~~~~~~~~~
lib/netdev-dpdk.c:194:23: warning: excess elements in struct initializer
.destroy_device = destroy_device,
^~~~~~~~~~~~~~
lib/netdev-dpdk.c:194:23: note: (near initialization for ‘virtio_net_device_ops’)
lib/netdev-dpdk.c:195:6: error: ‘const struct vhost_device_ops’ has no member named ‘vring_state_changed’
.vring_state_changed = vring_state_changed,
^~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c:195:28: warning: excess elements in struct initializer
.vring_state_changed = vring_state_changed,
^~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c:195:28: note: (near initialization for ‘virtio_net_device_ops’)
lib/netdev-dpdk.c:196:6: error: ‘const struct vhost_device_ops’ has no member named ‘features_changed’
.features_changed = NULL,
^~~~~~~~~~~~~~~~
lib/netdev-dpdk.c:196:25: warning: excess elements in struct initializer
.features_changed = NULL,
^~~~
lib/netdev-dpdk.c:196:25: note: (near initialization for ‘virtio_net_device_ops’)
lib/netdev-dpdk.c:197:6: error: ‘const struct vhost_device_ops’ has no member named ‘new_connection’
.new_connection = NULL,
^~~~~~~~~~~~~~
lib/netdev-dpdk.c:197:23: warning: excess elements in struct initializer
.new_connection = NULL,
^~~~
lib/netdev-dpdk.c:197:23: note: (near initialization for ‘virtio_net_device_ops’)
lib/netdev-dpdk.c:198:6: error: ‘const struct vhost_device_ops’ has no member named ‘destroy_connection’
.destroy_connection = destroy_connection,
^~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c:198:27: warning: excess elements in struct initializer
.destroy_connection = destroy_connection,
^~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c:198:27: note: (near initialization for ‘virtio_net_device_ops’)
lib/netdev-dpdk.c:199:6: error: ‘const struct vhost_device_ops’ has no member named ‘guest_notified’
.guest_notified = vhost_guest_notified,
^~~~~~~~~~~~~~
lib/netdev-dpdk.c:199:23: warning: excess elements in struct initializer
.guest_notified = vhost_guest_notified,
^~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c:199:23: note: (near initialization for ‘virtio_net_device_ops’)
lib/netdev-dpdk.c: In function ‘netdev_dpdk_get_num_ports’:
lib/netdev-dpdk.c:1342:13: error: ‘rte_eth_devices’ undeclared (first use in this function); did you mean ‘rte_eth_dev’?
if (rte_eth_devices[dev->port_id].device == device
^~~~~~~~~~~~~~~
rte_eth_dev
lib/netdev-dpdk.c:1342:13: note: each undeclared identifier is reported only once for each function it appears in
lib/netdev-dpdk.c: In function ‘vhost_common_construct’:
lib/netdev-dpdk.c:1354:44: warning: implicit declaration of function ‘rte_get_master_lcore’; did you mean ‘rte_get_main_lcore’? [-Wimplicit-function-declaration]
int socket_id = rte_lcore_to_socket_id(rte_get_master_lcore());
^~~~~~~~~~~~~~~~~~~~
rte_get_main_lcore
lib/netdev-dpdk.c: In function ‘netdev_dpdk_vhost_construct’:
lib/netdev-dpdk.c:1413:49: warning: passing argument 2 of ‘rte_vhost_driver_callback_register’ from incompatible pointer type [-Wincompatible-pointer-types]
&virtio_net_device_ops);
^
In file included from lib/netdev-dpdk.c:47:0:
/usr/local/include/rte_vhost.h:608:5: note: expected ‘const struct rte_vhost_device_ops * const’ but argument is of type ‘const struct vhost_device_ops *’
int rte_vhost_driver_callback_register(const char *path,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c: In function ‘netdev_dpdk_destruct’:
lib/netdev-dpdk.c:1516:20: error: ‘rte_eth_devices’ undeclared (first use in this function); did you mean ‘rte_eth_dev’?
eth_dev = &rte_eth_devices[dev->port_id];
^~~~~~~~~~~~~~~
rte_eth_dev
lib/netdev-dpdk.c:1518:20: error: dereferencing pointer to incomplete type ‘struct rte_eth_dev’
eth_dev->data &&
^~
lib/netdev-dpdk.c:1519:45: error: ‘RTE_ETH_DEV_CLOSE_REMOVE’ undeclared (first use in this function); did you mean ‘RTE_ETH_DEV_REMOVED’?
(eth_dev->data->dev_flags & RTE_ETH_DEV_CLOSE_REMOVE);
^~~~~~~~~~~~~~~~~~~~~~~~
RTE_ETH_DEV_REMOVED
lib/netdev-dpdk.c: In function ‘netdev_dpdk_vhost_client_set_config’:
lib/netdev-dpdk.c:2099:44: error: ‘RTE_VHOST_USER_DEQUEUE_ZERO_COPY’ undeclared (first use in this function); did you mean ‘RTE_VHOST_USER_ASYNC_COPY’?
dev->vhost_driver_flags |= RTE_VHOST_USER_DEQUEUE_ZERO_COPY;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RTE_VHOST_USER_ASYNC_COPY
lib/netdev-dpdk.c: In function ‘netdev_dpdk_prep_hwol_packet’:
lib/netdev-dpdk.c:2203:13: warning: "PKT_TX_L4_MASK" is deprecated
if (mbuf->ol_flags & PKT_TX_L4_MASK) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c:2210:13: warning: "PKT_TX_TCP_SEG" is deprecated
if (mbuf->ol_flags & PKT_TX_TCP_SEG) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c:2220:13: warning: "PKT_TX_TCP_CKSUM" is deprecated
mbuf->ol_flags |= PKT_TX_TCP_CKSUM;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c:2223:13: warning: "PKT_TX_IPV4" is deprecated
if (mbuf->ol_flags & PKT_TX_IPV4) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c:2224:13: warning: "PKT_TX_IP_CKSUM" is deprecated
mbuf->ol_flags |= PKT_TX_IP_CKSUM;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c: In function ‘netdev_dpdk_filter_packet_len’:
lib/netdev-dpdk.c:2571:13: warning: "PKT_TX_TCP_SEG" is deprecated
&& !(pkt->ol_flags & PKT_TX_TCP_SEG))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c: In function ‘dpdk_copy_dp_packet_to_mbuf’:
lib/netdev-dpdk.c:2793:13: warning: "EXT_ATTACHED_MBUF" is deprecated
~(EXT_ATTACHED_MBUF | IND_ATTACHED_MBUF));
^ ~~~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c:2793:13: warning: "IND_ATTACHED_MBUF" is deprecated
lib/netdev-dpdk.c:2798:13: warning: "PKT_TX_L4_MASK" is deprecated
if (mbuf_dest->ol_flags & PKT_TX_L4_MASK) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c: In function ‘dpdk_do_tx_copy’:
lib/netdev-dpdk.c:2843:13: warning: "PKT_TX_TCP_SEG" is deprecated
&& !(packet->mbuf.ol_flags & PKT_TX_TCP_SEG)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c: In function ‘netdev_dpdk_get_status’:
lib/netdev-dpdk.c:3687:13: warning: "PCI_ANY_ID" is deprecated
uint16_t vendor_id = PCI_ANY_ID;
^~~~~~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c:3688:13: warning: "PCI_ANY_ID" is deprecated
uint16_t device_id = PCI_ANY_ID;
^~~~~~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c: In function ‘netdev_dpdk_detach’:
lib/netdev-dpdk.c:3811:15: error: ‘rte_eth_devices’ undeclared (first use in this function); did you mean ‘rte_eth_dev’?
rte_dev = rte_eth_devices[port_id].device;
^~~~~~~~~~~~~~~
rte_eth_dev
lib/netdev-dpdk.c: In function ‘netdev_dpdk_vhost_client_reconfigure’:
lib/netdev-dpdk.c:5235:24: error: ‘RTE_VHOST_USER_DEQUEUE_ZERO_COPY’ undeclared (first use in this function); did you mean ‘RTE_VHOST_USER_ASYNC_COPY’?
& RTE_VHOST_USER_DEQUEUE_ZERO_COPY;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RTE_VHOST_USER_ASYNC_COPY
lib/netdev-dpdk.c:5263:50: warning: passing argument 2 of ‘rte_vhost_driver_callback_register’ from incompatible pointer type [-Wincompatible-pointer-types]
&virtio_net_device_ops);
^
In file included from lib/netdev-dpdk.c:47:0:
/usr/local/include/rte_vhost.h:608:5: note: expected ‘const struct rte_vhost_device_ops * const’ but argument is of type ‘const struct vhost_device_ops *’
int rte_vhost_driver_callback_register(const char *path,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/netdev-dpdk.c: In function ‘netdev_dpdk_rte_flow_query_count’:
lib/netdev-dpdk.c:5384:45: error: ‘struct rte_flow_action_count’ has no member named ‘shared’
struct rte_flow_action_count count = { .shared = 0, .id = 0 };
^~~~~~
lib/netdev-dpdk.c:5384:63: warning: initialized field overwritten [-Woverride-init]
struct rte_flow_action_count count = { .shared = 0, .id = 0 };
^
lib/netdev-dpdk.c:5384:63: note: (near initialization for ‘count.id’)
lib/netdev-dpdk.c: At top level:
lib/netdev-dpdk.c:191:38: error: storage size of ‘virtio_net_device_ops’ isn’t known
static const struct vhost_device_ops virtio_net_device_ops =
^~~~~~~~~~~~~~~~~~~~~
Makefile:4470: recipe for target 'lib/netdev-dpdk.lo' failed
make[2]: *** [lib/netdev-dpdk.lo] Error 1
make[2]: Leaving directory '/root/dpdk/openvswitch-2.13.6'
Makefile:5199: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/dpdk/openvswitch-2.13.6'
Makefile:2953: recipe for target 'all' failed
make: *** [all] Error 2

Found the issue, OVS release notes actually has the compatible version of DPDK listed and I got compilation going.

According to the OVS release notes, DPDK version 20.11.1 needs to be used instead of the latest.
So if you are doing installation according to this manual: https://docs.openvswitch.org/en/latest/intro/install/dpdk/
you need to use
wget https://fast.dpdk.org/rel/dpdk-20.11.1.tar.xz
instead of
wget https://fast.dpdk.org/rel/dpdk-21.11.tar.xz

Related

tensorflow: Errors when building op using g++ 6.3.0 (via MinGW) on Windows 7

I'm brand-new to tensorflow and am aiming to run a pre-built model created by another user. As an initial step in this process, I'm trying to build several ops. However, I have been unable to build even basic ops, let alone those that actually perform useful tasks. To give an example, I followed these directions and created the following as zero_out.cc:
#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/op_kernel.h"
REGISTER_OP("ZeroOut")
.Input("to_zero: int32")
.Output("zeroed: int32");
using namespace tensorflow;
class ZeroOutOp : public OpKernel {
public:
explicit ZeroOutOp(OpKernelConstruction* context) : OpKernel(context) {}
void Compute(OpKernelContext* context) override {
// Grab the input tensor
const Tensor& input_tensor = context->input(0);
auto input = input_tensor.flat<int32>();
// Create an output tensor
Tensor* output_tensor = NULL;
OP_REQUIRES_OK(context, context->allocate_output(0, input_tensor.shape(),
&output_tensor));
auto output = output_tensor->template flat<int32>();
// Set all but the first element of the output tensor to 0.
const int N = input.size();
for (int i = 1; i < N; i++) {
output(i) = 0;
}
// Preserve the first input value if possible.
if (N > 0) output(0) = input(0);
}
};
Afterward, I attempted to run the following in cmd (calling g++ 6.3.0, which I installed via MinGW):
g++ -std=c++11 -msse2 -shared zero_out.cc -o zero_out.so -I "C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include" -l tensorflow_framework -L "C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow" -fPIC -Wl,-rpath "C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow"
The above line did not produce an .so file and instead yielded an assortment of errors (which I've truncated to satisfy the Stack Overflow character limit):
In file included from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/message_lite.h:48:0,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/generated_enum_util.h:36,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/map.h:48,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/generated_message_table_driven.h:34,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_def.pb.h:26,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_def_builder.h:24,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op.h:23,
from zero_out.cc:1:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/stubs/once.h:43:24: error: 'once_flag' in namespace 'std' does not name a type
using once_flag = std::once_flag;
^~~~~~~~~
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/stubs/once.h: In function 'void google::protobuf::internal::call_once(Args&& ...)':
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/stubs/once.h:46:3: error: 'call_once' is not a member of 'std'
std::call_once(std::forward<Args>(args)...);
^~~
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/stubs/once.h:46:3: note: suggested alternative:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/stubs/once.h:45:6: note: 'google::protobuf::internal::call_once'
void call_once(Args&&... args ) {
^~~~~~~~~
In file included from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/descriptor.h:62:0,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/generated_message_reflection.h:47,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_def.pb.h:30,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_def_builder.h:24,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op.h:23,
from zero_out.cc:1:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/stubs/mutex.h: At global scope:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/stubs/mutex.h:107:8: error: 'mutex' in namespace 'std' does not name a type
std::mutex mu_;
^~~~~
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/stubs/mutex.h: In member function 'void google::protobuf::internal::WrappedMutex::Lock()':
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/stubs/mutex.h:99:43: error: 'mu_' was not declared in this scope
void Lock() GOOGLE_PROTOBUF_ACQUIRE() { mu_.lock(); }
^~~
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/stubs/mutex.h: In member function 'void google::protobuf::internal::WrappedMutex::Unlock()':
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/stubs/mutex.h:100:45: error: 'mu_' was not declared in this scope
void Unlock() GOOGLE_PROTOBUF_RELEASE() { mu_.unlock(); }
^~~
In file included from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/generated_message_reflection.h:47:0,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_def.pb.h:30,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_def_builder.h:24,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op.h:23,
from zero_out.cc:1:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/descriptor.h: At global scope:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/descriptor.h:221:13: error: 'once_flag' in namespace 'google::protobuf::internal' does not name a type
internal::once_flag* once_;
^~~~~~~~~
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/descriptor.h: In member function 'void google::protobuf::internal::LazyDescriptor::Init()':
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/descriptor.h:189:5: error: 'once_' was not declared in this scope
once_ = nullptr;
^~~~~
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/descriptor.h: At global scope:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/descriptor.h:787:13: error: 'once_flag' in namespace 'google::protobuf::internal' does not name a type
internal::once_flag* type_once_;
^~~~~~~~~
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/descriptor.h:1461:13: error: 'once_flag' in namespace 'google::protobuf::internal' does not name a type
internal::once_flag* dependencies_once_;
^~~~~~~~~
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/descriptor.h: In member function 'google::protobuf::FieldDescriptor::Type google::protobuf::FieldDescriptor::type() const':
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/descriptor.h:2053:7: error: 'type_once_' was not declared in this scope
if (type_once_) {
^~~~~~~~~~
In file included from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_def.pb.h:30:0,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_def_builder.h:24,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op.h:23,
from zero_out.cc:1:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/generated_message_reflection.h: At global scope:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/google/protobuf/generated_message_reflection.h:271:3: error: 'once_flag' does not name a type
once_flag* once;
^~~~~~~~~
In file included from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op.h:32:0,
from zero_out.cc:1:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/platform/mutex.h:231:8: error: 'cv_status' in namespace 'std' does not name a type
std::cv_status wait_for(mutex_lock& lock,
^~~~~~~~~
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/platform/mutex.h: In function 'tensorflow::ConditionResult tensorflow::WaitForMilliseconds(tensorflow::mutex_lock*, tensorflow::condition_variable*, tensorflow::int64)':
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/platform/mutex.h:249:3: error: 'cv_status' is not a member of 'std'
std::cv_status s = cv->wait_for(*mu, std::chrono::milliseconds(ms));
^~~
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/platform/mutex.h:250:11: error: 's' was not declared in this scope
return (s == std::cv_status::timeout) ? kCond_Timeout : kCond_MaybeNotified;
^
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/platform/mutex.h:250:21: error: 'std::cv_status' has not been declared
return (s == std::cv_status::timeout) ? kCond_Timeout : kCond_MaybeNotified;
^~~~~~~~~
In file included from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/platform/mutex.h:310:0,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op.h:32,
from zero_out.cc:1:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/platform/default/mutex.h: At global scope:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/platform/default/mutex.h:25:6: error: 'cv_status' in namespace 'std' does not name a type
std::cv_status wait_until_system_clock(
^~~~~~~~~
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/platform/default/mutex.h:31:6: error: 'cv_status' in namespace 'std' does not name a type
std::cv_status condition_variable::wait_for(
^~~~~~~~~
In file included from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:0,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/numeric_types.h:20,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/allocator.h:26,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_kernel.h:24,
from zero_out.cc:2:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/unsupported/Eigen/CXX11/Tensor:44:17: error: conflicting declaration 'typedef long int int32_t'
typedef __int32 int32_t;
^~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\string:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdexcept:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\array:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\tuple:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\functional:55,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op.h:19,
from zero_out.cc:1:
c:\mingw\include\stdint.h:62:15: note: previous declaration as 'typedef int int32_t'
typedef int int32_t;
^~~~~~~
In file included from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:0,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/numeric_types.h:20,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/allocator.h:26,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_kernel.h:24,
from zero_out.cc:2:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/unsupported/Eigen/CXX11/Tensor:45:26: error: conflicting declaration 'typedef long unsigned int uint32_t'
typedef unsigned __int32 uint32_t;
^~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\string:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdexcept:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\array:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\tuple:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\functional:55,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op.h:19,
from zero_out.cc:1:
c:\mingw\include\stdint.h:63:19: note: previous declaration as 'typedef unsigned int uint32_t'
typedef unsigned uint32_t;
^~~~~~~~
In file included from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/platform/notification.h:27:0,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/lib/core/notification.h:21,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/cancellation.h:22,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_kernel.h:25,
from zero_out.cc:2:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/platform/default/notification.h: In member function 'bool tensorflow::Notification::WaitForNotificationWithTimeout(tensorflow::int64)':
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/platform/default/notification.h:69:20: error: 'class tensorflow::condition_variable' has no member named 'wait_for'; did you mean 'wait'?
cv_.wait_for(l, std::chrono::microseconds(timeout_in_us)) !=
^~~~~~~~
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/platform/default/notification.h:70:25: error: 'std::cv_status' has not been declared
std::cv_status::timeout);
^~~~~~~~~
In file included from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:0,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/tensor.h:22,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/device_base.h:26,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_kernel.h:27,
from zero_out.cc:2:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/unsupported/Eigen/CXX11/Tensor: At global scope:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/unsupported/Eigen/CXX11/Tensor:44:17: error: conflicting declaration 'typedef long int int32_t'
typedef __int32 int32_t;
^~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\string:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdexcept:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\array:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\tuple:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\functional:55,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op.h:19,
from zero_out.cc:1:
c:\mingw\include\stdint.h:62:15: note: previous declaration as 'typedef int int32_t'
typedef int int32_t;
^~~~~~~
In file included from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:0,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/tensor.h:22,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/device_base.h:26,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_kernel.h:27,
from zero_out.cc:2:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/unsupported/Eigen/CXX11/Tensor:45:26: error: conflicting declaration 'typedef long unsigned int uint32_t'
typedef unsigned __int32 uint32_t;
^~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\string:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdexcept:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\array:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\tuple:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\functional:55,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op.h:19,
from zero_out.cc:1:
c:\mingw\include\stdint.h:63:19: note: previous declaration as 'typedef unsigned int uint32_t'
typedef unsigned uint32_t;
^~~~~~~~
In file included from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:0,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/tensor_shape.h:21,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/tensor.h:24,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/device_base.h:26,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_kernel.h:27,
from zero_out.cc:2:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/unsupported/Eigen/CXX11/Tensor:44:17: error: conflicting declaration 'typedef long int int32_t'
typedef __int32 int32_t;
^~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\string:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdexcept:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\array:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\tuple:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\functional:55,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op.h:19,
from zero_out.cc:1:
c:\mingw\include\stdint.h:62:15: note: previous declaration as 'typedef int int32_t'
typedef int int32_t;
^~~~~~~
In file included from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:0,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/tensor_shape.h:21,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/tensor.h:24,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/device_base.h:26,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_kernel.h:27,
from zero_out.cc:2:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/unsupported/Eigen/CXX11/Tensor:45:26: error: conflicting declaration 'typedef long unsigned int uint32_t'
typedef unsigned __int32 uint32_t;
^~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\string:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdexcept:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\array:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\tuple:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\functional:55,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op.h:19,
from zero_out.cc:1:
c:\mingw\include\stdint.h:63:19: note: previous declaration as 'typedef unsigned int uint32_t'
typedef unsigned uint32_t;
^~~~~~~~
In file included from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:0,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/tensor_types.h:19,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/tensor.h:25,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/device_base.h:26,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op_kernel.h:27,
from zero_out.cc:2:
C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/unsupported/Eigen/CXX11/Tensor:44:17: error: conflicting declaration 'typedef long int int32_t'
typedef __int32 int32_t;
^~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\stdint.h:9:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdint:41,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:420,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\string:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdexcept:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\array:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\tuple:39,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\functional:55,
from C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include/tensorflow/core/framework/op.h:19,
from zero_out.cc:1:
c:\mingw\include\stdint.h:62:15: note: previous declaration as 'typedef int int32_t'
typedef int int32_t;
^~~~~~~
Considering how basic zero_out.cc seems (at least to my novice eyes), my suspicion is that the main problem lies elsewhere. Notably, my attempts to build existing ops also triggered conflicting declaration errors, so even if I've made some mistake in writing zero_out.cc, that's not the full extent of the problem. From what I've read, later C++ standards supposedly fixed issues related to variable templates, but I've gotten the same exact errors regardless of whether I use -std=c++11, -std=c++14, or -std=c++17 as options in the call to g++ (among other options that I've attempted). It also doesn't seem like one should have to manually rewrite a bunch of standard installed files just to build a basic op... I hope.
There's probably some laughably simple mistake that is escaping my grasp, so I apologize for what is likely a very basic question from a novice. Nonetheless, any insights that you can offer would be greatly appreciated.
(Just in case it's relevant, I initially tried building tensorflow from source and encountered numerous problems with bazel and bazelisk. More recently, after having uninstalled my previous tensorflow version, I installed tensorflow from pip, which worked, as least as far as I can tell. However, I'm not sure if any artifacts left behind by my earlier installation attempts might be conflicting with the new installation, and to be frank, I'm unfamiliar enough with tensorflow that I'm not even sure how to begin diagnosing such an issue.)
UPDATE: I wound up biting the bullet and just using Visual Studio for kernel compilation--even though I wanted to avoid needlessly relying on a proprietary tool, there didn't seem to be much of a choice. In case it helps others, the below command prompt worked for zero_out.cc:
cpp -std=c++11 -msse2 -shared "C:/Users/Admin/AppData/Local/Programs/Python/Python38/Lib/site-packages/tensorflow/tensorflow/tensorflow/core/kernels/zero_out.cc" -o "C:/Users/Admin/AppData/Local/Programs/Python/Python38/Lib/site-packages/tensorflow/tensorflow/tensorflow/core/kernels/zero_out.so" -I "C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow\include" -l tensorflow_framework -L "C:\Users\Admin\AppData\Roaming\Python\Python38\site-packages\tensorflow"
With that said, I'd still be interested in any potential solutions involving g++ or a comparable tool, so I'll leave this question as-is so that others can post any answers that they have. (Additionally, while the above line of code worked for zero_out.cc, it resulted in errors for some other kernels. That seems to be a distinct issue, though, so I'll post it as a separate question if I can't resolve it on my own.)

Which version of protocol buffers does TensorFlow 1.1 depend on?

It is unclear which version of protocol buffers TensorFlow 1.1 depends on.
The pip package built by TensorFlow 1.1 depends on protobuf >= 3.2.
The TensorFlow installation instructions for Ubuntu reference protobuf 3.1.
Furthermore, attempting to build TensorFlow 1.1 from source whilst using protobuf 3.1, 3.2, or 3.3 built from source fails.
I can build TensorFlow 1.1 from source as long as I allow it to build its own copy of protobuf but I would rather it used a common version if possible.
If I build protobuf 3.1 from source and then attempt to build TensorFlow 1.1 from source I get the following error:
ERROR: <snip>/.cache/bazel/_bazel_daniel/041a78b467f26d47aee0fcd68c1f3624/external/protobuf/BUILD:73:1: C++ compilation of rule '#protobuf//:protobuf_lite' failed: gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG ... (remaining 45 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
external/protobuf/src/google/protobuf/wire_format_lite.cc:393:67: error: no 'void google::protobuf::internal::WireFormatLite::WriteFloatArray(const float*, int, google::protobuf::io::CodedOutputStream*)' member function declared in class 'google::protobuf::internal::WireFormatLite'
io::CodedOutputStream* output) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:398:67: error: no 'void google::protobuf::internal::WireFormatLite::WriteDoubleArray(const double*, int, google::protobuf::io::CodedOutputStream*)' member function declared in class 'google::protobuf::internal::WireFormatLite'
io::CodedOutputStream* output) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:403:67: error: no 'void google::protobuf::internal::WireFormatLite::WriteFixed32Array(const uint32*, int, google::protobuf::io::CodedOutputStream*)' member function declared in class 'google::protobuf::internal::WireFormatLite'
io::CodedOutputStream* output) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:408:69: error: no 'void google::protobuf::internal::WireFormatLite::WriteFixed64Array(const uint64*, int, google::protobuf::io::CodedOutputStream*)' member function declared in class 'google::protobuf::internal::WireFormatLite'
io::CodedOutputStream* output) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:413:69: error: no 'void google::protobuf::internal::WireFormatLite::WriteSFixed32Array(const int32*, int, google::protobuf::io::CodedOutputStream*)' member function declared in class 'google::protobuf::internal::WireFormatLite'
io::CodedOutputStream* output) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:418:69: error: no 'void google::protobuf::internal::WireFormatLite::WriteSFixed64Array(const int64*, int, google::protobuf::io::CodedOutputStream*)' member function declared in class 'google::protobuf::internal::WireFormatLite'
io::CodedOutputStream* output) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:423:66: error: no 'void google::protobuf::internal::WireFormatLite::WriteBoolArray(const bool*, int, google::protobuf::io::CodedOutputStream*)' member function declared in class 'google::protobuf::internal::WireFormatLite'
io::CodedOutputStream* output) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc: In static member function 'static void google::protobuf::internal::WireFormatLite::WriteGroupMaybeToArray(int, const google::protobuf::MessageLite&, google::protobuf::io::CodedOutputStream*)':
external/protobuf/src/google/protobuf/wire_format_lite.cc:557:17: error: 'class google::protobuf::io::CodedOutputStream' has no member named 'IsSerializationDeterministic'
output->IsSerializationDeterministic(), target);
^
external/protobuf/src/google/protobuf/wire_format_lite.cc: In static member function 'static void google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(int, const google::protobuf::MessageLite&, google::protobuf::io::CodedOutputStream*)':
external/protobuf/src/google/protobuf/wire_format_lite.cc:574:17: error: 'class google::protobuf::io::CodedOutputStream' has no member named 'IsSerializationDeterministic'
output->IsSerializationDeterministic(), target);
^
external/protobuf/src/google/protobuf/wire_format_lite.cc: At global scope:
external/protobuf/src/google/protobuf/wire_format_lite.cc:739:8: error: prototype for 'size_t google::protobuf::internal::WireFormatLite::Int32Size(const google::protobuf::RepeatedField<int>&)' does not match any in class 'google::protobuf::internal::WireFormatLite'
size_t WireFormatLite::Int32Size(const RepeatedField<int32>& value) {
^
In file included from external/protobuf/src/google/protobuf/wire_format_lite.cc:35:0:
<snip>/source/protobuf/protobuf-3.1.0/inst/include/google/protobuf/wire_format_lite_inl.h:813:15: error: candidate is: static size_t google::protobuf::internal::WireFormatLite::Int32Size(google::protobuf::int32)
inline size_t WireFormatLite::Int32Size(int32 value) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:748:8: error: prototype for 'size_t google::protobuf::internal::WireFormatLite::UInt32Size(const google::protobuf::RepeatedField<unsigned int>&)' does not match any in class 'google::protobuf::internal::WireFormatLite'
size_t WireFormatLite::UInt32Size(const RepeatedField<uint32>& value) {
^
In file included from external/protobuf/src/google/protobuf/wire_format_lite.cc:35:0:
<snip>/source/protobuf/protobuf-3.1.0/inst/include/google/protobuf/wire_format_lite_inl.h:819:15: error: candidate is: static size_t google::protobuf::internal::WireFormatLite::UInt32Size(google::protobuf::uint32)
inline size_t WireFormatLite::UInt32Size(uint32 value) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:757:8: error: prototype for 'size_t google::protobuf::internal::WireFormatLite::SInt32Size(const google::protobuf::RepeatedField<int>&)' does not match any in class 'google::protobuf::internal::WireFormatLite'
size_t WireFormatLite::SInt32Size(const RepeatedField<int32>& value) {
^
In file included from external/protobuf/src/google/protobuf/wire_format_lite.cc:35:0:
<snip>/source/protobuf/protobuf-3.1.0/inst/include/google/protobuf/wire_format_lite_inl.h:825:15: error: candidate is: static size_t google::protobuf::internal::WireFormatLite::SInt32Size(google::protobuf::int32)
inline size_t WireFormatLite::SInt32Size(int32 value) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:766:8: error: prototype for 'size_t google::protobuf::internal::WireFormatLite::EnumSize(const google::protobuf::RepeatedField<int>&)' does not match any in class 'google::protobuf::internal::WireFormatLite'
size_t WireFormatLite::EnumSize(const RepeatedField<int>& value) {
^
In file included from external/protobuf/src/google/protobuf/wire_format_lite.cc:35:0:
<snip>/source/protobuf/protobuf-3.1.0/inst/include/google/protobuf/wire_format_lite_inl.h:831:15: error: candidate is: static size_t google::protobuf::internal::WireFormatLite::EnumSize(int)
inline size_t WireFormatLite::EnumSize(int value) {
^
Target //tensorflow/tools/pip_package:build_pip_package failed to build
If I build protobuf 3.2 from source and then attempt to build TensorFlow 1.1 from source I get the following error:
ERROR: <snip>/.cache/bazel/_bazel_daniel/041a78b467f26d47aee0fcd68c1f3624/external/protobuf/BUILD:113:1: C++ compilation of rule '#protobuf//:protobuf' failed: gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG ... (remaining 43 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
external/protobuf/src/google/protobuf/util/json_util.cc:52:49: error: definition of implicitly-declared 'virtual google::protobuf::util::internal::ZeroCopyStreamByteSink::~ZeroCopyStreamByteSink()'
ZeroCopyStreamByteSink::~ZeroCopyStreamByteSink() {
^
external/protobuf/src/google/protobuf/util/json_util.cc: In member function 'virtual void google::protobuf::util::internal::ZeroCopyStreamByteSink::Append(const char*, size_t)':
external/protobuf/src/google/protobuf/util/json_util.cc:58:16: error: 'buffer_size_' was not declared in this scope
if (len <= buffer_size_) {
^
external/protobuf/src/google/protobuf/util/json_util.cc:59:14: error: 'buffer_' was not declared in this scope
memcpy(buffer_, bytes, len);
^
external/protobuf/src/google/protobuf/util/json_util.cc:64:12: error: 'buffer_' was not declared in this scope
memcpy(buffer_, bytes, buffer_size_);
^
external/protobuf/src/google/protobuf/util/json_util.cc:64:28: error: 'buffer_size_' was not declared in this scope
memcpy(buffer_, bytes, buffer_size_);
^
external/protobuf/src/google/protobuf/util/json_util.cc: In function 'google::protobuf::util::Status google::protobuf::util::BinaryToJsonStream(google::protobuf::util::TypeResolver*, const string&, google::protobuf::io::ZeroCopyInputStream*, google::protobuf::io::ZeroCopyOutputStream*, const google::protobuf::util::JsonPrintOptions&)':
external/protobuf/src/google/protobuf/util/json_util.cc:85:47: error: 'const struct google::protobuf::util::JsonPrintOptions' has no member named 'always_print_enums_as_ints'
proto_source.set_use_ints_for_enums(options.always_print_enums_as_ints);
^
Target //tensorflow/tools/pip_package:build_pip_package failed to build
If I build protobuf 3.3 from source and then attempt to build TensorFlow 1.1 from source I get the following error:
ERROR: <snip>/.cache/bazel/_bazel_daniel/041a78b467f26d47aee0fcd68c1f3624/external/protobuf/BUILD:73:1: C++ compilation of rule '#protobuf//:protobuf_lite' failed: gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG ... (remaining 45 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
external/protobuf/src/google/protobuf/arenastring.cc:41:6: error: redefinition of 'void google::protobuf::internal::ArenaStringPtr::AssignWithDefault(const string*, google::protobuf::internal::ArenaStringPtr)'
void ArenaStringPtr::AssignWithDefault(const ::std::string* default_value,
^
In file included from external/protobuf/src/google/protobuf/arenastring.cc:34:0:
<snip>/source/protobuf/protobuf-3.3.0/inst/include/google/protobuf/arenastring.h:316:13: note: 'void google::protobuf::internal::ArenaStringPtr::AssignWithDefault(const string*, google::protobuf::internal::ArenaStringPtr)' previously defined here
inline void ArenaStringPtr::AssignWithDefault(const ::std::string* default_value,
^
Target //tensorflow/tools/pip_package:build_pip_package failed to build

Build aruco 2.0.5 on Windows 8

I am trying to install aruco on my Windows machine using cmake 3.5.2 as suggested by the aruco developper.
My config:
Windows8
CMake 3.5.2
ArUco 2.0.5
I can configure and generate successfully aruco in cmake.
Then I go to aruco\build -> right click-> open cmd -> type mingw32-make -> get the following error:
C:\aruco-2.0.5\build>mingw32-make
Scanning dependencies of target aruco
[ 2%] Building CXX object src/CMakeFiles/aruco.dir/ar_omp.cpp.obj
[ 4%] Building CXX object src/CMakeFiles/aruco.dir/cameraparameters.cpp.obj
[ 6%] Building CXX object src/CMakeFiles/aruco.dir/cvdrawingutils.cpp.obj
In file included from C:\aruco-2.0.5\src\aruco.h:149:0,
from C:\aruco-2.0.5\src\cvdrawingutils.h:31,
from C:\aruco-2.0.5\src\cvdrawingutils.cpp:28:
C:\aruco-2.0.5\src\markerdetector.h:160:40: warning: "/*" within comment [-Wcomm
ent]
ARUCO_MIP_36h12, //**** recommended
^
C:\aruco-2.0.5\src\markerdetector.h:212:60: warning: unused parameter 'r2' [-Wun
used-parameter]
void setThresholdParamRange(size_t r1 = 0, size_t r2 = 0) {_params. _thresP
aram1_range = r1; }
^
C:\aruco-2.0.5\src\markerdetector.h:267:30: warning: unused parameter 'val' [-Wu
nused-parameter]
void setDesiredSpeed(int val){}
^
In file included from C:\aruco-2.0.5\src\posetracker.h:33:0,
from C:\aruco-2.0.5\src\aruco.h:150,
from C:\aruco-2.0.5\src\cvdrawingutils.h:31,
from C:\aruco-2.0.5\src\cvdrawingutils.cpp:28:
C:\aruco-2.0.5\src\markermap.h: In member function 'void aruco::Marker3DInfo::to
Stream(std::ostream&)':
C:\aruco-2.0.5\src\markermap.h:49:77: warning: comparison between signed and uns
igned integer expressions [-Wsign-compare]
void toStream(std::ostream &str){str<<id<<" "<<size()<<" ";for(int i=0;i<si
ze();i++) str<<at(i).x<<" "<<at(i).y<<" "<<at(i).z<<" ";}
^
In file included from C:\aruco-2.0.5\src\posetracker.h:33:0,
from C:\aruco-2.0.5\src\aruco.h:150,
from C:\aruco-2.0.5\src\cvdrawingutils.h:31,
from C:\aruco-2.0.5\src\cvdrawingutils.cpp:28:
C:\aruco-2.0.5\src\markermap.h: In member function 'void aruco::Marker3DInfo::fr
omStream(std::istream&)':
C:\aruco-2.0.5\src\markermap.h:50:80: warning: comparison between signed and uns
igned integer expressions [-Wsign-compare]
void fromStream(std::istream &str){int s;str>>id>>s;resize(s);for(int i=0;i
<size();i++) str>>at(i).x>>at(i).y>>at(i).z;}
^
[ 9%] Building CXX object src/CMakeFiles/aruco.dir/dictionary.cpp.obj
In file included from C:\aruco-2.0.5\src\dictionary.cpp:9:0:
C:\aruco-2.0.5\src\markermap.h: In member function 'void aruco::Marker3DInfo::to
Stream(std::ostream&)':
C:\aruco-2.0.5\src\markermap.h:49:77: warning: comparison between signed and uns
igned integer expressions [-Wsign-compare]
void toStream(std::ostream &str){str<<id<<" "<<size()<<" ";for(int i=0;i<si
ze();i++) str<<at(i).x<<" "<<at(i).y<<" "<<at(i).z<<" ";}
^
In file included from C:\aruco-2.0.5\src\dictionary.cpp:9:0:
C:\aruco-2.0.5\src\markermap.h: In member function 'void aruco::Marker3DInfo::fr
omStream(std::istream&)':
C:\aruco-2.0.5\src\markermap.h:50:80: warning: comparison between signed and uns
igned integer expressions [-Wsign-compare]
void fromStream(std::istream &str){int s;str>>id>>s;resize(s);for(int i=0;i
<size();i++) str>>at(i).x>>at(i).y>>at(i).z;}
^
C:\aruco-2.0.5\src\dictionary.cpp: In static member function 'static std::string
aruco::Dictionary::getTypeString(aruco::Dictionary::DICT_TYPES)':
C:\aruco-2.0.5\src\dictionary.cpp:236:11: warning: enumeration value 'ARTAG' not
handled in switch [-Wswitch]
switch(t){
^
C:\aruco-2.0.5\src\dictionary.cpp: In member function 'aruco::MarkerMap aruco::D
ictionary::createMarkerMap(cv::Size, int, int, const std::vector<int>&, bool)':
C:\aruco-2.0.5\src\dictionary.cpp:275:39: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
if (gridSize.height*gridSize.width!=ids.size())throw cv::Exception(9001, "g
ridSize != ids.size()Invalid ", "Dictionary::createMarkerMap", __FILE__, __LINE_
_);
^
C:\aruco-2.0.5\src\dictionary.cpp:284:23: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
for (int i=0;i<ids.size();i++) TInfo[i].id=ids[i];
^
C:\aruco-2.0.5\src\dictionary.cpp:285:13: warning: unused variable 'sizeY' [-Wun
used-variable]
int sizeY=gridSize.height*MarkerSize+(gridSize.height-1)*MarkerDistance
;
^
C:\aruco-2.0.5\src\dictionary.cpp:286:13: warning: unused variable 'sizeX' [-Wun
used-variable]
int sizeX=gridSize.width*MarkerSize+(gridSize.width-1)*MarkerDistance;
^
C:\aruco-2.0.5\src\dictionary.cpp:312:37: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
if (CurMarkerIdx>=ids.size()) throw cv::Exception(999," Fid
ucidalMarkers::createMarkerMapImage_ChessMarkerMap","INTERNAL ERROR. REWRITE THI
S!!",__FILE__,__LINE__);
^
C:\aruco-2.0.5\src\dictionary.cpp:300:13: warning: unused variable 'centerX' [-W
unused-variable]
int centerX=sizeX/2;
^
C:\aruco-2.0.5\src\dictionary.cpp:301:13: warning: unused variable 'centerY' [-W
unused-variable]
int centerY=sizeY/2;
^
C:\aruco-2.0.5\src\dictionary.cpp:303:14: warning: unused variable 'centerData'
[-Wunused-variable]
bool centerData=true;
^
[ 11%] Building CXX object src/CMakeFiles/aruco.dir/ippe.cpp.obj
C:\aruco-2.0.5\src\ippe.cpp: In function 'void IPPE::IPPComputeRotations(double,
double, double, double, double, double, cv::OutputArray, cv::OutputArray)':
C:\aruco-2.0.5\src\ippe.cpp:307:45: warning: variable 'ata10' set but not used [
-Wunused-but-set-variable]
double a00, a01, a10,a11, ata00, ata01, ata10,ata11,b00, b01, b10,b11,binv0
0, binv01, binv10,binv11;
^
C:\aruco-2.0.5\src\ippe.cpp:311:19: warning: variable 'a' set but not used [-Wun
used-but-set-variable]
double b0, b1,a,gamma,dtinv;
^
[ 13%] Building CXX object src/CMakeFiles/aruco.dir/marker.cpp.obj
C:\aruco-2.0.5\src\marker.cpp: In member function 'void aruco::Marker::rotateXAx
is(cv::Mat&)':
C:\aruco-2.0.5\src\marker.cpp:299:22: error: 'M_PI' was not declared in this sco
pe
float angleRad = M_PI / 2;
^
src\CMakeFiles\aruco.dir\build.make:187: recipe for target 'src/CMakeFiles/aruco
.dir/marker.cpp.obj' failed
mingw32-make[2]: *** [src/CMakeFiles/aruco.dir/marker.cpp.obj] Error 1
CMakeFiles\Makefile2:116: recipe for target 'src/CMakeFiles/aruco.dir/all' faile
d
mingw32-make[1]: *** [src/CMakeFiles/aruco.dir/all] Error 2
Makefile:126: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
C:\aruco-2.0.5\build>mingw32-make
Scanning dependencies of target aruco
[ 2%] Building CXX object src/CMakeFiles/aruco.dir/marker.cpp.obj
C:\aruco-2.0.5\src\marker.cpp: In member function 'void aruco::Marker::rotateXAx
is(cv::Mat&)':
C:\aruco-2.0.5\src\marker.cpp:299:22: error: 'M_PI' was not declared in this sco
pe
float angleRad = M_PI / 2;
^
src\CMakeFiles\aruco.dir\build.make:187: recipe for target 'src/CMakeFiles/aruco
.dir/marker.cpp.obj' failed
mingw32-make[2]: *** [src/CMakeFiles/aruco.dir/marker.cpp.obj] Error 1
CMakeFiles\Makefile2:116: recipe for target 'src/CMakeFiles/aruco.dir/all' faile
d
mingw32-make[1]: *** [src/CMakeFiles/aruco.dir/all] Error 2
Makefile:126: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
I have also tried to do it with codeblocks but I get the exact same error.
The developer has released a new version 2.0.7 fixing this issue.
What I have done to have aruco:
download the .zip on sourceforge
unzip it
create a build folder in aruco-2.0.7
open cmake-gui configure and generate
go into your build folder
open a cmd window from there
type mingw32-make
The library should have compiled properly.
If omp.h is missing from your compiler, find the source code on the internet and add it to mingw in MinGW\include. You should be ready to go. Don't forget to add aruco to your path & reboot.
If you are using an ide, you will have to add this library since it is an external library but it is another issue.
Finally, you might have some issues regarding c++11. I am working on it. If someone knows how to allow it on mingw (I haven't find any understandable explanation so far)

Use generic implementation of wxDataViewCtrl on OSX

By default wxDataViewCtrl has native implementation under OSX. How can I use generic implementation of wxDataViewCtrl under OSX.
I do not want to make any changes in wxWidgets Code. I would prefer a macro or some specific header.
Also I am thinking how I can use native and generic implementations both at the same time.
Tried the way suggested:
Following errors while building wxWidgets dynamic library:
./src/osx/dataview_osx.cpp:101:38: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
noFailureFlag = m_DataViewCtrlPtr->GetDataViewPeer()->Add(parent,item);
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:112:38: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
noFailureFlag = m_DataViewCtrlPtr->GetDataViewPeer()->Add(parent,items);
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:123:26: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
if (m_DataViewCtrlPtr->GetDataViewPeer()->Update(GetOwner()->GetParent(item),item))
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:153:28: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
if (m_DataViewCtrlPtr->GetDataViewPeer()->Update(GetOwner()->GetParent(items[indexItem]),items[indexItem]))
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:178:22: error: no member named 'SetDeleting' in 'wxDataViewCtrl'
m_DataViewCtrlPtr->SetDeleting(true);
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:179:38: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
noFailureFlag = m_DataViewCtrlPtr->GetDataViewPeer()->Remove(parent,item);
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:181:22: error: no member named 'SetDeleting' in 'wxDataViewCtrl'
m_DataViewCtrlPtr->SetDeleting(false);
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:197:22: error: no member named 'SetDeleting' in 'wxDataViewCtrl'
m_DataViewCtrlPtr->SetDeleting(true);
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:199:38: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
noFailureFlag = m_DataViewCtrlPtr->GetDataViewPeer()->Remove(parent,items);
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:201:22: error: no member named 'SetDeleting' in 'wxDataViewCtrl'
m_DataViewCtrlPtr->SetDeleting(false);
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:212:26: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
if (m_DataViewCtrlPtr->GetDataViewPeer()->Update(GetOwner()->GetParent(item),item))
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:233:29: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
return m_DataViewCtrlPtr->GetDataViewPeer()->Reload();
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:238:22: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
m_DataViewCtrlPtr->GetDataViewPeer()->Resort();
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:252:55: error: no member named 'GetColumnPtr' in 'wxDataViewCtrl'; did you mean 'GetColumnAt'?
wxDataViewColumn* column(m_DataViewCtrlPtr->GetColumnPtr(col));
^~~~~~~~~~~~
GetColumnAt
./include/wx/generic/dataview.h:248:23: note: 'GetColumnAt' declared here
wxDataViewColumn *GetColumnAt(unsigned int pos) const;
^
./src/osx/dataview_osx.cpp:267:28: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
m_DataViewCtrlPtr->GetDataViewPeer()->SetRowHeight(item,height);
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:287:57: error: no member named 'GetColumnPtr' in 'wxDataViewCtrl'; did you mean 'GetColumnAt'?
wxDataViewColumn* column(m_DataViewCtrlPtr->GetColumnPtr(col));
^~~~~~~~~~~~
GetColumnAt
./include/wx/generic/dataview.h:248:23: note: 'GetColumnAt' declared here
wxDataViewColumn *GetColumnAt(unsigned int pos) const;
^
./src/osx/dataview_osx.cpp:302:30: error: no member named 'GetDataViewPeer' in 'wxDataViewCtrl'
m_DataViewCtrlPtr->GetDataViewPeer()->SetRowHeight(items[itemIndex],height);
~~~~~~~~~~~~~~~~~ ^
./src/osx/dataview_osx.cpp:312:53: error: no member named 'GetColumnPtr' in 'wxDataViewCtrl'; did you mean 'GetColumnAt'?
wxDataViewColumn *column = m_DataViewCtrlPtr->GetColumnPtr(col);
^~~~~~~~~~~~
GetColumnAt
./include/wx/generic/dataview.h:248:23: note: 'GetColumnAt' declared here
wxDataViewColumn *GetColumnAt(unsigned int pos) const;
^
./src/osx/dataview_osx.cpp:314:20: error: no member named 'GetWidthVariable' in 'wxDataViewColumn'
if ( column->GetWidthVariable() == wxCOL_WIDTH_AUTOSIZE )
~~~~~~ ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [advdll_dataview_osx.o] Error 1
#include <wx/generic/dataview.h> ?
You need to globally predefine wxHAS_GENERIC_DATAVIEWCTRL and rebuild both wxWidgets and your application using it.
There is currently no way to use both the native and generic implementations of this control in the same build.
We need to build wxWidgets with both:
wxHAS_GENERIC_DATAVIEWCTRL
wxUSE_GENERICDATAVIEWCTRL
Only wxHAS_GENERIC_DATAVIEWCTRL will not work. Note, now I am able to use the generic implementation of wxWidgets on OSX.

Calling Fortran from C++-CLI

I have a fortran subroutine, FortranShake, and a C++ main function, HandShakingTest.cpp.
I'm trying to call a fortran subroutine from CLR C++.
I'm getting two batches of errors. Let's call them ERROR(1) and ERROR(2). I'd really appreciate if you could help me understand why these errors are happening.
When I try to compile with the following:
cl /clr HandShakingTest.cpp
I get the following ERROR(1):
HandShakingTest.obj : error LNK2028: unresolved token (0A00030A) "extern "C" void __c
ecl FortranShake(int &)" (?FortranShake##$$J0YAXAAH#Z) referenced in function "int __
lrcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#Sys
em###Z)
HandShakingTest.obj : error LNK2019: unresolved external symbol "extern "C" void __cd
cl FortranShake(int &)" (?FortranShake##$$J0YAXAAH#Z) referenced in function "int __c
rcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#Syst
m###Z)
HandShakingTest.exe : fatal error LNK1120: 2 unresolved externals
I then used the following commands to compile instead:
ifort /c FortranShake.f //Which compiles fine
cl /c /clr HandShakingTest.cpp //compiles fine
cl /o test HandShakingTest.obj FortranShake.obj //ERROR(2) occurs
ERROR(2) consists of:
MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(cla
ss type_info const &)" (??0type_info##AAE#ABV0##Z) already defined in LIBCMT.lib(typin
fo.obj)
MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_i
nfo::operator=(class type_info const &)" (??4type_info##AAEAAV0#ABV0##Z) already defin
ed in LIBCMT.lib(typinfo.obj)
MSVCRT.lib(merr.obj) : error LNK2005: __matherr already defined in LIBCMT.lib(_matherr
_.obj)
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NOD
EFAULTLIB:library
HandShakingTest.obj : error LNK2028: unresolved token (0A00030A) "extern "C" void __cd
ecl FortranShake(int &)" (?FortranShake##$$J0YAXAAH#Z) referenced in function "int __c
lrcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#Syst
em###Z)
HandShakingTest.obj : error LNK2019: unresolved external symbol "extern "C" void __cde
cl FortranShake(int &)" (?FortranShake##$$J0YAXAAH#Z) referenced in function "int __cl
rcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#Syste
m###Z)
libifcoremt.lib(for_main.obj) : error LNK2019: unresolved external symbol _MAIN__ refe
renced in function _main
test.exe : fatal error LNK1120: 3 unresolved externals
Here's the HandShakingTest.cpp:
#include "stdio.h"
#include <stdlib.h>
#include <Windows.h>
#using <System.DLL>
#using <System.Windows.Forms.DLL>
using namespace std;
using namespace System;
using namespace System::IO;
using namespace System::Diagnostics;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
extern "C" {void FortranShake(int&);}
int main(array<System::String ^> ^args)
{
Process^ testHand = gcnew Process();
testHand->StartInfo->UseShellExecute = false;
testHand->StartInfo->RedirectStandardInput = true;
testHand->StartInfo->RedirectStandardOutput = true;
testHand->StartInfo->ErrorDialog = true;
int numDebug = 0;
String^ returnedDebug = "Nothing";
FortranShake(numDebug);
StreamReader^ FromHandProcess = testHand->StandardOutput;
StreamWriter^ ToHandProcess = testHand->StandardInput;
String^ Line;
Line = FromHandProcess ->ReadLine();
if (Line->Equals("Enter Hand") )
{
Console::WriteLine(L"Hand Started!");
}
ToHandProcess ->WriteLine(numDebug.ToString());
returnedDebug = FromHandProcess ->ReadLine();
MessageBox::Show(returnedDebug);
return 0;
}
Here is the Fortran Subroutine:
SUBROUTINE FortranShake(GP_DEBUG)
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
INN = 5
WRITE(06,'(a)') 'Enter Hand'
READ(INN,*) GP_DEBUG
GP_DEBUG = GP_DEBUG + 55
WRITE(06,*) GP_DEBUG
RETURN
END
Your first error is actually a linker error - without the /c command line switch you are compiling and linking in one step. No Fortran code or object code has been provided.
Your second error is because:
You have specified (through omission) mismatching runtime libraries for the C++ and the Fortran. You need to decide whether you want to use static linking (the default for the current (as of today, but not necessarily as of next month...) release of Intel Fortran on windows) or dynamic linking (the default for the MS C++ compiler). Perhaps add /MD to the ifort command line, which specifies dynamic linking.
Without compiler options or directives to the contrary, the equivalent identifier for the Fortran procedure in C code as generated by that Fortran compiler is an upper case variant of the Fortran procedure's name - i.e. in the C++ code call the procedure FORTRANSHAKE. If you can write your Fortran code to the F2003 standard, you should use the C interoperability features of that language (BIND(C,...)) to control the C binding name of the Fortran procedure and ensure calling conventions, etc align.
The dummy argument of the Fortran subroutine has the DOUBLE PRECISION type specifier, which is equivalent to double in the C++ for this combination of compilers, not int. Again, F2003 introduces features that can make this alignment of argument types more robust.