I tried following the [instructions for building c++ 
examples](https://github.com/apache/incubator-mxnet/tree/master/cpp-package#building-c-examples-in-examples-folder).

The resulting binaries don't work out of the box, and after troubleshooting 
some terminate abruptly, core dump or do nothing.

```
./alexnet: error while loading shared libraries: libmxnet.so: cannot open 
shared object file: No such file or directory
```

I worked on the example C++ for image prediction (#12397) that has its own 
Makefile that points to libmxnet.so specifically, and was able to get it to run 
without hunting for the mxnet library. The Makefile for the 
`cpp-package/example` files does not mention the library at all. Maybe that's a 
problem? 

The steps in the README could use some clarification. Eventually after trying a 
bunch of things, I found a reference that led me to try this:

```
export LD_LIBRARY_PATH=~/incubator-mxnet/lib
```

And some of the examples started working! At least they're finding the library. 
I can add this line to the instructions if this is what we should recommend 
that people do after building from source with the cpp package flag turned on.  
Is it?

But, then there's also the fact that several the examples core dump:

```
./mlp_gpu
[21:13:44] src/io/iter_mnist.cc:110: MNISTIter: load 60000 images, shuffle=1, 
shape=(100,784)
[21:13:44] src/io/iter_mnist.cc:110: MNISTIter: load 10000 images, shuffle=1, 
shape=(100,784)
terminate called after throwing an instance of 'dmlc::Error'
  what():  [21:13:44] ../include/mxnet-cpp/ndarray.hpp:54: Check failed: 
MXNDArrayCreate(shape.data(), shape.size(), context.GetDeviceType(), 
context.GetDeviceId(), delay_alloc, &handle) == 0 (-1 vs. 0) 
```

```
./inception_bn 
terminate called after throwing an instance of 'dmlc::Error'
  what():  [21:15:16] ../include/mxnet-cpp/symbol.hpp:219: Check failed: 
MXSymbolInferShape(GetHandle(), keys.size(), keys.data(), arg_ind_ptr.data(), 
arg_shape_data.data(), &in_shape_size, &in_shape_ndim, &in_shape_data, 
&out_shape_size, &out_shape_ndim, &out_shape_data, &aux_shape_size, 
&aux_shape_ndim, &aux_shape_data, &complete) == 0 (-1 vs. 0) 
```

```
./test_score 
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Aborted (core dumped)
```

Or do nothing:

```
./test_optimizer 
```


[ Full content available at: 
https://github.com/apache/incubator-mxnet/issues/12401 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to