You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@singa.apache.org by "Moaz Reyad (JIRA)" <ji...@apache.org> on 2016/11/19 14:19:59 UTC
[jira] [Updated] (SINGA-272) singa::logging classes are missing
from libsinga.so
[ https://issues.apache.org/jira/browse/SINGA-272?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Moaz Reyad updated SINGA-272:
-----------------------------
Description:
When I try to compile a C++ file like
{code:title=test.cpp|borderStyle=solid}
#include "singa/io/encoder.h"
#include "singa/io/decoder.h"
#include <iostream>
#include <sstream>
#include <algorithm>
using namespace std;
using singa::Shape;
using singa::Tensor;
int main()
{
cout << "Testing..." << endl;
singa::CSVEncoder encoder;
singa::CSVDecoder decoder;
singa::DecoderConf decoder_conf;
decoder_conf.set_has_label(true);
decoder.Setup(decoder_conf);
float in_data[] = {1.23f, 4.5f, 5.1f, 3.33f, 0.44f};
std::string in_str = "2, 1.23, 4.5, 5.1, 3.33, 0.44";
int in_label = 2;
size_t size = 5;
std::vector<Tensor> input;
Tensor data(Shape{size}, singa::kFloat32), label(Shape{1}, singa::kInt);
data.CopyDataFromHostPtr<float>(in_data, size);
label.CopyDataFromHostPtr<int>(&in_label, 1);
input.push_back(data);
input.push_back(label);
std::string value = encoder.Encode(input);
in_str.erase(std::remove(in_str.begin(), in_str.end(), ' '), in_str.end());
std::vector<Tensor> output = decoder.Decode(value);
const auto* out_data = output.at(0).data<float>();
const auto* out_label = output.at(1).data<int>();
return 0;
}
{code}
I get this error:
{code:title=compiling|borderStyle=solid}
$ g++ ./test.cpp -l singa
/tmp/cc46xzSI.o: In function `singa::Block::data() const':
test.cpp:(.text._ZNK5singa5Block4dataEv[_ZNK5singa5Block4dataEv]+0x4b): undefined reference to `singa::logging::LogMessageFatal::LogMessageFatal(char const*, int)'
test.cpp:(.text._ZNK5singa5Block4dataEv[_ZNK5singa5Block4dataEv]+0x7f): undefined reference to `singa::logging::LogMessageFatal::~LogMessageFatal()'
test.cpp:(.text._ZNK5singa5Block4dataEv[_ZNK5singa5Block4dataEv]+0xba): undefined reference to `singa::logging::LogMessageFatal::~LogMessageFatal()'
collect2: error: ld returned 1 exit status
{code}
I think singa::logging classes are not linked correctly in libsinga.so during installation.
The workaround is to do:
$g++ -DUSE_GLOG ./test.cpp -l singa -l glog
But it is better if libsinga.so is built with singa::logging classes.
was:
When I try to compile a C++ file like
{code:title=test.cpp|borderStyle=solid}
#include "singa/io/encoder.h"
#include "singa/io/decoder.h"
#include <iostream>
#include <sstream>
#include <algorithm>
using namespace std;
using singa::Shape;
using singa::Tensor;
int main()
{
cout << "Testing..." << endl;
singa::CSVEncoder encoder;
singa::CSVDecoder decoder;
singa::DecoderConf decoder_conf;
decoder_conf.set_has_label(true);
decoder.Setup(decoder_conf);
float in_data[] = {1.23f, 4.5f, 5.1f, 3.33f, 0.44f};
std::string in_str = "2, 1.23, 4.5, 5.1, 3.33, 0.44";
int in_label = 2;
size_t size = 5;
std::vector<Tensor> input;
Tensor data(Shape{size}, singa::kFloat32), label(Shape{1}, singa::kInt);
data.CopyDataFromHostPtr<float>(in_data, size);
label.CopyDataFromHostPtr<int>(&in_label, 1);
input.push_back(data);
input.push_back(label);
std::string value = encoder.Encode(input);
in_str.erase(std::remove(in_str.begin(), in_str.end(), ' '), in_str.end());
std::vector<Tensor> output = decoder.Decode(value);
const auto* out_data = output.at(0).data<float>();
const auto* out_label = output.at(1).data<int>();
return 0;
}
{code}
I get this error:
$ g++ ./test.cpp -l singa
/tmp/cc46xzSI.o: In function `singa::Block::data() const':
test.cpp:(.text._ZNK5singa5Block4dataEv[_ZNK5singa5Block4dataEv]+0x4b): undefined reference to `singa::logging::LogMessageFatal::LogMessageFatal(char const*, int)'
test.cpp:(.text._ZNK5singa5Block4dataEv[_ZNK5singa5Block4dataEv]+0x7f): undefined reference to `singa::logging::LogMessageFatal::~LogMessageFatal()'
test.cpp:(.text._ZNK5singa5Block4dataEv[_ZNK5singa5Block4dataEv]+0xba): undefined reference to `singa::logging::LogMessageFatal::~LogMessageFatal()'
collect2: error: ld returned 1 exit status
I think singa::logging classes are not linked correctly in libsinga.so during installation.
The workaround is to do:
$g++ -DUSE_GLOG ./test.cpp -l singa -l glog
But it is better if libsinga.so is built with singa::logging classes.
> singa::logging classes are missing from libsinga.so
> ----------------------------------------------------
>
> Key: SINGA-272
> URL: https://issues.apache.org/jira/browse/SINGA-272
> Project: Singa
> Issue Type: Bug
> Environment: Linux (Ubuntu)
> Reporter: Moaz Reyad
>
> When I try to compile a C++ file like
> {code:title=test.cpp|borderStyle=solid}
> #include "singa/io/encoder.h"
> #include "singa/io/decoder.h"
> #include <iostream>
> #include <sstream>
> #include <algorithm>
> using namespace std;
> using singa::Shape;
> using singa::Tensor;
> int main()
> {
> cout << "Testing..." << endl;
> singa::CSVEncoder encoder;
> singa::CSVDecoder decoder;
> singa::DecoderConf decoder_conf;
> decoder_conf.set_has_label(true);
> decoder.Setup(decoder_conf);
> float in_data[] = {1.23f, 4.5f, 5.1f, 3.33f, 0.44f};
> std::string in_str = "2, 1.23, 4.5, 5.1, 3.33, 0.44";
> int in_label = 2;
> size_t size = 5;
> std::vector<Tensor> input;
> Tensor data(Shape{size}, singa::kFloat32), label(Shape{1}, singa::kInt);
> data.CopyDataFromHostPtr<float>(in_data, size);
> label.CopyDataFromHostPtr<int>(&in_label, 1);
> input.push_back(data);
> input.push_back(label);
> std::string value = encoder.Encode(input);
> in_str.erase(std::remove(in_str.begin(), in_str.end(), ' '), in_str.end());
> std::vector<Tensor> output = decoder.Decode(value);
> const auto* out_data = output.at(0).data<float>();
> const auto* out_label = output.at(1).data<int>();
> return 0;
> }
> {code}
> I get this error:
> {code:title=compiling|borderStyle=solid}
> $ g++ ./test.cpp -l singa
> /tmp/cc46xzSI.o: In function `singa::Block::data() const':
> test.cpp:(.text._ZNK5singa5Block4dataEv[_ZNK5singa5Block4dataEv]+0x4b): undefined reference to `singa::logging::LogMessageFatal::LogMessageFatal(char const*, int)'
> test.cpp:(.text._ZNK5singa5Block4dataEv[_ZNK5singa5Block4dataEv]+0x7f): undefined reference to `singa::logging::LogMessageFatal::~LogMessageFatal()'
> test.cpp:(.text._ZNK5singa5Block4dataEv[_ZNK5singa5Block4dataEv]+0xba): undefined reference to `singa::logging::LogMessageFatal::~LogMessageFatal()'
> collect2: error: ld returned 1 exit status
> {code}
> I think singa::logging classes are not linked correctly in libsinga.so during installation.
> The workaround is to do:
> $g++ -DUSE_GLOG ./test.cpp -l singa -l glog
> But it is better if libsinga.so is built with singa::logging classes.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)