env:
ubuntu-18.04
python - 2.7.15rc1
GPU 0 : GeForce RTX 2080Ti and
GPU 1 : P1000 Quadro
CUDA : 9.1.85
tensorflow : 1.12.0
pip install magenta-gpu
If I do pip install magenta and then run melody_rnn_train, the training step goes through, with my custom sequence_example training_melodies.tfrecord.
But when I do pip install magenta-gpu after pip uninstall magenta, and I run the melody_rnn_train, on the same dataset, I run into "Segmentation Fault". I can see that it is trying to using the GPU 0 : NVIDIA Geforce.
Command I run is :
./.local/bin/melody_rnn_train --config=attention_rnn --run_dir=~/music/run1 --sequence_example_file=~/music/my_midi_sequence_examples/training_melodies.tfrecord --hparams="batch_size=1,rnn_layer_sizes=[64,64]" --num_training_steps=20000
The backtrace using gdb python, of the segmentation fault, is as below:
(gdb) bt
0 0x00007fff4631ec08 in ?? () from /usr/lib/x86_64-linux-gnu/libcudnn.so.7
1 0x00007fff4631f114 in ?? () from /usr/lib/x86_64-linux-gnu/libcudnn.so.7
2 0x00007fff45e08850 in ?? () from /usr/lib/x86_64-linux-gnu/libcudnn.so.7
3 0x00007fff45e2b452 in ?? () from /usr/lib/x86_64-linux-gnu/libcudnn.so.7
4 0x00007fff45e2c1de in ?? () from /usr/lib/x86_64-linux-gnu/libcudnn.so.7
5 0x00007fff453d2416 in ?? () from /usr/lib/x86_64-linux-gnu/libcudnn.so.7
6 0x00007fff453d317b in cudnnGetConvolutionBackwardFilterWorkspaceSize () from /usr/lib/x86_64-linux-gnu/libcudnn.so.7
7 0x00007fff6184f184 in stream_executor::cuda::(anonymous namespace)::AllocateCudnnConvolutionBackwardFilterWorkspace(stream_executor::Stream*, stream_executor::cuda::(anonymous namespace)::CudnnHandle const&, stream_executor::cuda::(anonymous namespace)::CudnnTensorDescriptor const&, stream_executor::cuda::(anonymous namespace)::CudnnFilterDescriptor const&, stream_executor::cuda::(anonymous namespace)::CudnnConvolutionDescriptor const&, stream_executor::cuda::(anonymous namespace)::CudnnTensorDescriptor const&, stream_executor::dnn::AlgorithmDesc*, stream_executor::ScratchAllocator*) ()
from .local/lib/python2.7/site-packages/tensorflow/python/../libtensorflow_framework.so
8 0x00007fff6184f597 in stream_executor::cuda::(anonymous namespace)::GetCudnnConvolutionBackwardFilterAlgorithm(stream_executor::Stream*, stream_executor::cuda::(anonymous namespace)::CudnnHandle const&, stream_executor::dnn::AlgorithmConfig const&, stream_executor::cuda::(anonymous namespace)::CudnnTensorDescriptor const&, stream_executor::cuda::(anonymous namespace)::CudnnFilterDescriptor const&, stream_executor::cuda::(anonymous namespace)::CudnnConvolutionDescriptor const&, stream_executor::cuda::(anonymous namespace)::CudnnTensorDescriptor const&, stream_executor::ScratchAllocator*, stream_executor::DeviceMemory<unsigned char>*) [clone .constprop.315] () from .local/lib/python2.7/site-packages/tensorflow/python/../libtensorflow_framework.so
9 0x00007fff6185c7c3 in tensorflow::Status stream_executor::cuda::CudnnSupport::DoConvolveBackwardFilterImpl<float>(stream_executor::Stream*, stream_executor::dnn::BatchDescriptor const&, stream_executor::DeviceMemory<float> const&, stream_executor::dnn::BatchDescriptor const&, stream_executor::DeviceMemory<float>, stream_executor::dnn::ConvolutionDescriptor const&, stream_executor::dnn::FilterDescriptor const&, stream_executor::DeviceMemory<float>*, stream_executor::ScratchAllocator*, stream_executor::dnn::AlgorithmConfig const&, stream_executor::dnn::ProfileResult*) ()
from .local/lib/python2.7/site-packages/tensorflow/python/../libtensorflow_framework.so
10 0x00007fff6185d212 in stream_executor::cuda::CudnnSupport::DoConvolveBackwardFilter(stream_executor::Stream*, stream_executor::dnn::BatchDescriptor const&, stream_executor::DeviceMemory<float> const&, stream_executor::dnn::BatchDescriptor const&, stream_executor::DeviceMemory<float>, stream_executor::dnn::ConvolutionDescriptor const&, stream_executor::dnn::FilterDescriptor const&, stream_executor::DeviceMemory<float>*, stream_executor::ScratchAllocator*, stream_executor::dnn::AlgorithmConfig const&, stream_executor::dnn::ProfileResult*) ()
from .local/lib/python2.7/site-packages/tensorflow/python/../libtensorflow_framework.so
11 0x00007fff617efb2c in stream_executor::Stream::ThenConvolveBackwardFilterWithAlgorithm(stream_executor::dnn::BatchDescriptor const&, stream_executor::DeviceMemory<float> const&, stream_executor::dnn::BatchDescriptor const&, stream_executor::DeviceMemory<float>, stream_executor::dnn::ConvolutionDescriptor const&, stream_executor::dnn::FilterDescriptor const&, stream_executor::DeviceMemory<float>*, stream_executor::ScratchAllocator*, stream_executor::dnn::AlgorithmConfig const&, stream_executor::dnn::ProfileResult*) ()
from .local/lib/python2.7/site-packages/tensorflow/python/../libtensorflow_framework.so
12 0x00007fff679e088a in tensorflow::LaunchConv2DBackpropFilterOp<Eigen::GpuDevice, float>::operator()(tensorflow::OpKernelContext*, bool, bool, tensorflow::Tensor const&, tensorflow::Tensor const&, int, int, int, int, tensorflow::Padding const&, tensorflow::Tensor*, tensorflow::TensorFormat) () from .local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
13 0x00007fff679e12d0 in tensorflow::Conv2DSlowBackpropFilterOp<Eigen::GpuDevice, float>::Compute(tensorflow::OpKernelContext*) ()
from .local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
14 0x00007fff613ee911 in tensorflow::BaseGPUDevice::ComputeHelper(tensorflow::OpKernel*, tensorflow::OpKernelContext*) ()
from .local/lib/python2.7/site-packages/tensorflow/python/../libtensorflow_framework.so
15 0x00007fff613eee32 in tensorflow::BaseGPUDevice::Compute(tensorflow::OpKernel*, tensorflow::OpKernelContext*) ()
from .local/lib/python2.7/site-packages/tensorflow/python/../libtensorflow_framework.so
16 0x00007fff61438a56 in tensorflow::(anonymous namespace)::ExecutorState::Process(tensorflow::(anonymous namespace)::ExecutorState::TaggedNode, long long) ()
from .local/lib/python2.7/site-packages/tensorflow/python/../libtensorflow_framework.so
17 0x00007fff61438eea in std::_Function_handler<void (), tensorflow::(anonymous namespace)::ExecutorState::ScheduleReady(absl::InlinedVector<tensorflow::(anonymous namespace)::ExecutorState::TaggedNode, 8ul, std::allocator<tensorflow::(anonymous namespace)::ExecutorState::TaggedNode> > const&, tensorflow::(anonymous namespace)::ExecutorState::TaggedNodeReadyQueue*)::{lambda() 1}>::_M_invoke(std::_Any_data const&) () from .local/lib/python2.7/site-packages/tensorflow/python/../libtensorflow_framework.so
18 0x00007fff614a81ea in Eigen::NonBlockingThreadPoolTempl<tensorflow::thread::EigenEnvironment>::WorkerLoop(int) ()
from .local/lib/python2.7/site-packages/tensorflow/python/../libtensorflow_framework.so
19 0x00007fff614a7242 in std::_Function_handler<void (), tensorflow::thread::EigenEnvironment::CreateThread(std::function<void ()>)::{lambda() 1}>::_M_invoke(std::_Any_data const&) ()
from .local/lib/python2.7/site-packages/tensorflow/python/../libtensorflow_framework.so
20 0x00007fff57c128f0 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
21 0x00007ffff77cc6db in start_thread (arg=0x7ffde27fc700) at pthread_create.c:463
23 0x00007ffff7b0588f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
The CPU variant worked fine for me but i am not able to run the GPU variant because of this segmentation fault.
Could someone please advise if I missed something during the setup ?
Related
Getting seg fault as debugged using Gdb for the following snippet:
ConnectionOptions connection_options;
connection_options.host = "127.0.0.1"; // Required.
connection_options.port = 9001; // Optional. The default port is 6379.
ConnectionPoolOptions pool_options;
pool_options.size = 3;
RedisCluster cluster2(connection_options, pool_options);
cluster2.set("hello_key", "world_value");
The log from gdb:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff58949ae in sw::redis::ConnectionPool::_fetch() ()
from /home/workspace_git/third_party/redis-plus-plus/redis-plus-plus_install/lib/libredis++.so.1
(gdb) bt
0x00007ffff58949ae in sw::redis::ConnectionPool::_fetch() ()
from /home/workspace_git/mongoose/third_party/redis-plus-plus/redis-plus-plus_install/lib/libredis++.so.1
(gdb) bt
#0 0x00007ffff58949ae in sw::redis::ConnectionPool::_fetch() ()
from /home/workspace_git/third_party/redis-plus-plus/redis-plus-plus_install/lib/libredis++.so.1
#1 0x00007ffff5896e76 in sw::redis::ConnectionPool::fetch() ()
from /home/workspace_git/third_party/redis-plus-plus/redis-plus-plus_install/lib/libredis++.so.1
#2 0x00007ffff58a20a1 in sw::redis::SafeConnection::SafeConnection(sw::redis::ConnectionPool&) ()
from /home/workspace_git/third_party/redis-plus-plus/redis-plus-plus_install/lib/libredis++.so.1
#3 0x00007ffff58ac53a in std::unique_ptr<redisReply, sw::redis::ReplyDeleter> sw::redis::RedisCluster::_command<void (*)(sw::redis::Connection&, sw::redis::StringView const&, sw::redis::StringView const&, long long, sw::redis::UpdateType), sw::redis::StringView const&, sw::redis::StringView const&, long, sw::redis::UpdateType&>(void (*)(sw::redis::Connection&, sw::redis::StringView const&, sw::redis::StringView const&, long long, sw::redis::UpdateType), sw::redis::StringView const&, sw::redis::StringView const&, sw::redis::StringView const&, long&&, sw::redis::UpdateType&) ()
from /home/workspace_git/third_party/redis-plus-plus/redis-plus-plus_install/lib/libredis++.so.1
#4 0x00007ffff58a9015 in sw::redis::RedisCluster::set(sw::redis::StringView const&, sw::redis::StringView const&, std::chrono::duration<long, std::ratio<1l, 1000l> > const&, sw::redis::UpdateType) () from /home/workspace_git/third_party/redis-plus-plus/redis-plus-plus_install/lib/libredis++.so.1
The version of hiredis: 1.0.2.
The version of redis-plus-plus: 1.3.3
Compiled with C++ 11 option.
Am I doing any basic mistake ?
I'm trying to use odb for my first cpp project (based on progress database).
I have installed everything i need and want to connect to my database.
I wrote a simple instance for my database connection:
#include <odb/database.hxx>
#include <odb/pgsql/database.hxx>
int main(int argc, char *argv[]) {
std::unique_ptr<odb::database> db (
new odb::pgsql::database (
"postgres", // database login name
"postgres", // database password
"test" // database name
));
and got this linking problem:
...: Undefined reference to `odb::pgsql::database::database(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, odb::details::transfer_ptr<odb::pgsql::connection_factory>)' collect2: error: ld returned 1 exit status
I think i need to extend my CMakeList.txt (still auto generated), but what i have to link ? ...
when I run pstack {pid} on linux, Sometimes, I shows ?? for some records. what is the reason for that? if it is just be optimized, how can I know the real related code ?
#0 0x00000037d620b3dc in pthread_cond_wait##GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x00000000008c83db in boost::condition_variable::wait(boost::unique_lock<boost::mutex>&) ()
#2 0x0000000000d95f7b in mongo::SimpleRWLock::lock_shared() ()
#3 0x00000000008bce47 in mongo::Lock::DBRead::lockOther(mongo::StringData const&) ()
#4 0x00000000008bfc86 in mongo::Lock::DBRead::lockDB(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#5 0x00000000008c1eb0 in mongo::Lock::DBRead::DBRead(mongo::StringData const&) ()
#6 0x000000000081fa35 in mongo::Client::ReadContext::ReadContext(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
**#7 0x0000000000b852bb in ?? ()**
#8 0x00000000008ab646 in mongo::CmdServerStatus::run(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj&, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, mongo::BSONObjBuilder&, bool) ()
Even I don't know why just 1 record show "??", but I have found the solution to know what the "??" represent in this case.
I got the previous stack in production. and I run the traffic in DEV env (in DEV, I compiled with -ggdb option and install with --nostrip), I got the following stack:
Thread 2 (Thread 0x7fb112c27700 (LWP 29881)):
#0 0x0000003af460b43c in pthread_cond_wait##GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x00000000008661cb in boost::condition_variable::wait(boost::unique_lock<boost::mutex>&) ()
#2 0x0000000000d093e3 in mongo::SimpleRWLock::lock_shared() ()
#3 0x00000000008e0cfb in mongo::Lock::DBRead::lockOther(mongo::StringData const&) ()
#4 0x00000000008e2701 in mongo::Lock::DBRead::lockDB(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#5 0x00000000008e3557 in mongo::Lock::DBRead::DBRead(mongo::StringData const&) ()
#6 0x0000000000859d00 in mongo::Client::ReadContext::ReadContext(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>
, std::allocator<char> > const&) ()
#7 0x0000000000b5a6c0 in mongo::(anonymous namespace)::RecordStats::generateSection(mongo::BSONElement const&) const ()
#8 0x00000000008c4934 in mongo::CmdServerStatus::run(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj&, int, std::basic_string<char, std::char_tr
aits<char>, std::allocator<char> >&, mongo::BSONObjBuilder&, bool) ()
#9 0x00000000008ef0d4 in mongo::_execCommand(mongo::Command*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj&, int, std::basic_string<char, std
::char_traits<char>, std::allocator<char> >&, mongo::BSONObjBuilder&, bool) ()
I am currently a real beginner in Objective C, and I am developing an app using the framework OpenCV.
I am following a tutorial, but while builing the project, I got several errors :
Undefined symbols for architecture i386:
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from:
cv::gpu::error(char const*, char const*, int, char const*) in opencv2(gpumat.o)
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in opencv2(gpumat.o)
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in opencv2(gpumat.o)
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int)", referenced from:
cv::gpu::error(char const*, char const*, int, char const*) in opencv2(gpumat.o)
"std::__1::cerr", referenced from:
cv::gpu::error(char const*, char const*, int, char const*) in opencv2(gpumat.o)
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in opencv2(gpumat.o)
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in opencv2(gpumat.o)
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
__ZNSt3__16vectorImNS_9allocatorImEEE6assignIPmEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeES7_S7_ in opencv2(matrix.o)
std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >::vector(unsigned long) in opencv2(matrix.o)
std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >::__append(unsigned long) in opencv2(matrix.o)
std::__1::vector<cv::Vec<float, 2>, std::__1::allocator<cv::Vec<float, 2> > >::vector(unsigned long) in opencv2(matrix.o)
std::__1::vector<int, std::__1::allocator<int> >::vector(unsigned long) in opencv2(matrix.o)
std::__1::vector<cv::Vec<int, 128>, std::__1::allocator<cv::Vec<int, 128> > >::__append(unsigned long) in opencv2(matrix.o)
std::__1::vector<cv::Vec<int, 64>, std::__1::allocator<cv::Vec<int, 64> > >::__append(unsigned long) in opencv2(matrix.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
cv::Mat::create(int, int const*, int) in opencv2(matrix.o)
__ZN2cvL7setSizeERNS_3MatEiPKiPKmb in opencv2(matrix.o)
cv::Mat::Mat(cv::Mat const&, cv::Range const&, cv::Range const&) in opencv2(matrix.o)
cv::Mat::Mat(cv::Mat const&, cv::Rect_<int> const&) in opencv2(matrix.o)
cv::Mat::Mat(cv::Mat const&, cv::Range const*) in opencv2(matrix.o)
cv::Mat::diag(int) const in opencv2(matrix.o)
cv::Mat::Mat(_IplImage const*, bool) in opencv2(matrix.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
cv::Mat::create(int, int const*, int) in opencv2(matrix.o)
__ZN2cvL7setSizeERNS_3MatEiPKiPKmb in opencv2(matrix.o)
cv::Mat::Mat(cv::Mat const&, cv::Range const&, cv::Range const&) in opencv2(matrix.o)
cv::Mat::Mat(cv::Mat const&, cv::Rect_<int> const&) in opencv2(matrix.o)
cv::Mat::Mat(cv::Mat const&, cv::Range const*) in opencv2(matrix.o)
cv::Mat::diag(int) const in opencv2(matrix.o)
cv::Mat::Mat(_IplImage const*, bool) in opencv2(matrix.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::resize(unsigned long, char)", referenced from:
__ZL8icvCloseP13CvFileStoragePNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in opencv2(persistence.o)
"std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__init(wchar_t const*, unsigned long)", referenced from:
cv::toUtf16(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in opencv2(persistence.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in opencv2(system.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)", referenced from:
cv::tempfile(char const*) in opencv2(system.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in opencv2(system.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::assign(char const*)", referenced from:
cv::tempfile(char const*) in opencv2(system.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
cv::Exception::Exception(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in opencv2(system.o)
cv::tempfile(char const*) in opencv2(system.o)
cv::Exception::Exception(cv::Exception const&) in opencv2(system.o)
cv::operator<<(cv::FileStorage&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in opencv2(persistence.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
cv::Exception::formatMessage() in opencv2(system.o)
cv::tempfile(char const*) in opencv2(system.o)
cv::operator<<(cv::FileStorage&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in opencv2(persistence.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am sure that the problem comes from the framework, but not the framework itself, but how it is link in the project, or...
I precise that I've linked it that way in the .pch file
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
#ifdef __cplusplus
#import <opencv2/opencv.hpp>
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
Don't really know what to do..
EDIT : forgot to tell that I renamed my .m file to .mm and my .h file to .hh
Is there anything else we need to do to get an objective C++ projet ?
Building on Cthutu's answer, to add libc++.dylib to your project:
Select your project (the blue file) in your project navigator
(Command 1 if it's hidden)
Select your target
Go to Build Phases
Expand "Link Binary With Libraries"
Click the "+"
Type libc++.dylib in the search bar.
Select the libc++.dylib file and press "Add"
You're missing the standard C++ library. You need to link with it to get all the implementations for the STL classes you're getting errors for.
Add the libc++.dylib to your project.
This actually seems to hide the actual problem: the fact that your LLVM compiler may not choose a proper standard C++ library for compiling by default. You should go to
Project (or your Target) -> Build Settings -> Apple LLVM 6.0 - Language - C++ -> C++ Standard Library
and make sure that you pick libc++ as your choice, not just Compiler Default, since modern OpenCV library is linked against libc++. This will solve your problem without having to add the extra libc++.dylib. Including libc++.dylib framework as a workaround will not always work out if your Compiler Default actually does not choose libc++ library!
To check what "Compiler Default" is, you can do something like this. Mine somehow chooses c++98 as a default.
The user can also add the libc++.tbd if libc++.dylib is not available in the "Link Binary With Libraries"
Thanks
Mitesh
I had a similar problem, try removing "-lopencv_ts" from "Other Linker Flags"
i want to use wxMediaCtrl for this i make a header file with content like
#ifndef MEDIA_H_
#define MEDIA_H_
#include <wx/wx.h>
#include <wx/mediactrl.h>
class media: public wxFrame
{
public:
wxWindow *window;
media(const wxString& title);
wxMediaCtrl *media_ctrl;
};
#endif /* MEDIA_H_ */
and make a cpp file with code like
#include "media.h"
media::media(const wxString& title)
:wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 600))
{
window=new wxWindow(this,wxID_ANY,wxPoint(0,0),wxSize(600,600),wxBORDER_SIMPLE,wxT("window"));
media_ctrl= new wxMediaCtrl(window, wxID_ANY , wxT(""),wxDefaultPosition, wxDefaultSize, 0, wxT(""), wxDefaultValidator, wxT("hello"));}
when i m trying to run the page ,i got an error like
make all
Building target: media
Invoking: GCC C++ Linker
g++ `wx-config --libs` -o"media" ./programfiles/main.o ./programfiles/media.o
./programfiles/media.o: In function `wxMediaCtrl::wxMediaCtrl(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&, wxValidator const&, wxString const&)':
media.cpp:(.text._ZN11wxMediaCtrlC1EP8wxWindowiRK8wxStringRK7wxPointRK6wxSizelS4_RK11wxValidatorS4_[wxMediaCtrl::wxMediaCtrl(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&, wxValidator const&, wxString const&)]+0x35): ****undefined reference to `vtable for wxMediaCtrl'****
media.cpp:(.text._ZN11wxMediaCtrlC1EP8wxWindowiRK8wxStringRK7wxPointRK6wxSizelS4_RK11wxValidatorS4_[wxMediaCtrl::wxMediaCtrl(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&, wxValidator const&, wxString const&)]+0x9a): undefined reference to `wxMediaCtrl::Create(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&, wxValidator const&, wxString const&)'
collect2: ld returned 1 exit status
make: *** [media] Error 1
can anyone tell me where i m doing the mistake
try using
wx-config --libs std,media
in building...
To build wxWidgets with wxMediaCtrl enabled on linux (gstreamer 0.10) libgconf2-dev and libgstreamer0.10-dev are required.
http://wiki.wxwidgets.org/WxMediaCtrl