Standalone UDO example errors


#1

I am having trouble getting the example at http://www.scidb.org/forum/viewtopic.php?f=18&t=1099 to load. If I use the default boost location, I get the following error on compilation:

<warnings about variadic macros>
PhysicalExample.cpp: In member function ‘virtual boost::shared_ptr<scidb::Array> scidb::PhysicalExample::execute(std::vector<boost::shared_ptr<scidb::Array> >&, boost::shared_ptr<scidb::Query>)’:
PhysicalExample.cpp:50:55: error: no matching function for call to ‘scidb::MemArray::MemArray(scidb::ArrayDesc&)’
         shared_ptr<Array> result (new MemArray(_schema));
                                                       ^
PhysicalExample.cpp:50:55: note: candidates are:
In file included from /opt/scidb/scidb_src/include/query/Operator.h:55:0,
                 from PhysicalExample.cpp:23:
/opt/scidb/scidb_src/include/array/MemArray.h:513:9: note: scidb::MemArray::MemArray(const scidb::MemArray&)
         MemArray(const MemArray&);
         ^
/opt/scidb/scidb_src/include/array/MemArray.h:513:9: note:   no known conversion for argument 1 from ‘scidb::ArrayDesc’ to ‘const scidb::MemArray&’
/opt/scidb/scidb_src/include/array/MemArray.h:490:9: note: scidb::MemArray::MemArray(boost::shared_ptr<scidb::Array>&, const boost::shared_ptr<scidb::Query>&, bool)
         MemArray(boost::shared_ptr<Array>& input, boost::shared_ptr<Query> const& query, bool vertical = true);
         ^
/opt/scidb/scidb_src/include/array/MemArray.h:490:9: note:   candidate expects 3 arguments, 1 provided
/opt/scidb/scidb_src/include/array/MemArray.h:476:9: note: scidb::MemArray::MemArray(const scidb::ArrayDesc&, const boost::shared_ptr<scidb::Query>&)
         MemArray(ArrayDesc const& arr, boost::shared_ptr<Query> const& query);
         ^
/opt/scidb/scidb_src/include/array/MemArray.h:476:9: note:   candidate expects 2 arguments, 1 provided
make: *** [example] Error 1

If I change the boost path to another boost installation, the .so compiles quietly, but iquery can’t load it:

scidb@islhead1:~$ iquery -aq "load_library('example')" SystemException in file: src/util/PluginManager.cpp function: findModule line: 117 Error id: scidb::SCIDB_SE_PLUGIN_MGR::SCIDB_LE_CANT_LOAD_MODULE Error description: Plugin manager error. Cannot load module '/opt/scidb/13.12/lib/scidb/plugins/libexample.so', dlopen returned '/opt/scidb/13.12/lib/scidb/plugins/libexample.so: cannot open shared object file: No such file or directory. Failed query id: 1100907584471

I am using SciDB 13.12. I get the same error whether or not I use the built-in boost, or with boost 1.54.0. Here is my modified Makefile:

SCIDB_BOOST_INCLUDE_DIR=/home/fjk1625/boost_1_54_0
SCIDB_SOURCE_DIR=/opt/scidb/scidb_src

CFLAGS=-Dexample_EXPORTS -pedantic -W -Wextra -Wall -Wno-strict-aliasing -Wno-long-long -Wno-unused-parameter -fPIC -D__STDC_FORMAT_MACROS -Wno-system-headers -isystem -O2 -g -DNDEBUG -ggdb3  -D__STDC_LIMIT_MACROS
INC=-I. -DPROJECT_ROOT="\"$(SCIDB_SOURCE_DIR)\"" -I"$(SCIDB_BOOST_INCLUDE_DIR)" -I"$(SCIDB_SOURCE_DIR)/include" -I/usr/include/google/protobuf -I/usr/include/postgresql
LIBS=-L"$(SCIDB_SOURCE_DIR)/lib" -shared -Wl,-soname,libexample.so -L. 

example:
        @if test ! -d "$(SCIDB_SOURCE_DIR)"; then echo  "Error. Try:\n\nmake SCIDB_SOURCE_DIR=<PATH TO SCIDB TRUNK>"; exit 1; fi
        $(CXX) $(CFLAGS) $(INC) -o plugin.cpp.o -c plugin.cpp
        $(CXX) $(CFLAGS) $(INC) -o LogicalExample.cpp.o -c LogicalExample.cpp
        $(CXX) $(CFLAGS) $(INC) -o PhysicalExample.cpp.o -c PhysicalExample.cpp
        $(CXX) $(CFLAGS) $(INC) -o libexample.so plugin.cpp.o LogicalExample.cpp.o PhysicalExample.cpp.o $(LIBS)

clean:
        rm -f *.o *.so

If I write over the physical/logical cpp files with the stub files from examples/operators, I can successfully make libexample.so. If I move it to the plugins folder, it doesn’t work. Here’s the output I get with attempted loads:

scidb@host:~$ iquery -aq "load_library('point')"
Query was executed successfully
scidb@host:~$ iquery -aq "load_library('example')"
SystemException in file: src/util/PluginManager.cpp function: findModule line: 117
Error id: scidb::SCIDB_SE_PLUGIN_MGR::SCIDB_LE_CANT_LOAD_MODULE
Error description: Plugin manager error. Cannot load module '/opt/scidb/13.12/lib/scidb/plugins/libexample.so', dlopen returned '/opt/scidb/13.12/lib/scidb/plugins/libexample.so: cannot open shared object file: No such file or directory.
Failed query id: 1100906860358

I get the same error if libexample.so doesn’t exist, or if it has trash in it. Is there an updated method for making a standalone UDO?


#2

Hello,

That particular example is outdated. I think we should remove that from the build directory and do some housekeeping. Apologies.

Take a look at examples/example_udos instead. Those participate in the regular scidb build and there should be a standalone makefile you can adapt too.