View Single Post
  #7   Spotlight this post!  
Unread 13-01-2017, 12:47
Thad House Thad House is online now
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,106
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: MJPG Streamer input from opencv in C++

Quote:
Originally Posted by jreneew2 View Post
That didn't seem to make a difference sadly. I also tried adding the arguments you used in your build and no difference. Here is the full output

Code:
g++ -std=c++1y `pkg-config --cflags --libs opencv` -Wformat=2 -Wall -Wextra -Werror -pedantic -Wno-psabi -Wno-unused-parameter -fPIC -rdynamic -Wno-error=deprecated-declarations -pthread -I/home/pi/wpiutil/include -I/home/pi/ntcore/include -I/home/pi/cscore/include -L/home/pi/wpiutil/Linux/arm -L/home/pi/ntcore/arm/ntcore/build/libs/ntcore/static -L/home/pi/cscore/Linux/arm -lwpiutil -lntcore -lcscore   -o test test.cpp
/tmp/ccEiQ61k.o: In function `cs::VideoSource::VideoSource(cs::VideoSource const&)':
test.cpp:(.text._ZN2cs11VideoSourceC2ERKS0_[_ZN2cs11VideoSourceC5ERKS0_]+0x44): undefined reference to `cs::CopySource(int, int*)'
/tmp/ccEiQ61k.o: In function `cs::VideoSource::~VideoSource()':
test.cpp:(.text._ZN2cs11VideoSourceD2Ev[_ZN2cs11VideoSourceD5Ev]+0x40): undefined reference to `cs::ReleaseSource(int, int*)'
/tmp/ccEiQ61k.o: In function `cs::UsbCamera::UsbCamera(llvm::StringRef, int)':
test.cpp:(.text._ZN2cs9UsbCameraC2EN4llvm9StringRefEi[_ZN2cs9UsbCameraC5EN4llvm9StringRefEi]+0x3c): undefined reference to `cs::CreateUsbCameraDev(llvm::StringRef, int, int*)'
/tmp/ccEiQ61k.o: In function `cs::CvSource::CvSource(llvm::StringRef, cs::VideoMode::PixelFormat, int, int, int)':
test.cpp:(.text._ZN2cs8CvSourceC2EN4llvm9StringRefENS_9VideoMode11PixelFormatEiii[_ZN2cs8CvSourceC5EN4llvm9StringRefENS_9VideoMode11PixelFormatEiii]+0x5c): undefined reference to `cs::CreateCvSource(llvm::StringRef, cs::VideoMode const&, int*)'
/tmp/ccEiQ61k.o: In function `cs::CvSource::PutFrame(cv::Mat&)':
test.cpp:(.text._ZN2cs8CvSource8PutFrameERN2cv3MatE[_ZN2cs8CvSource8PutFrameERN2cv3MatE]+0x38): undefined reference to `cs::PutSourceFrame(int, cv::Mat&, int*)'
/tmp/ccEiQ61k.o: In function `cs::VideoSink::~VideoSink()':
test.cpp:(.text._ZN2cs9VideoSinkD2Ev[_ZN2cs9VideoSinkD5Ev]+0x40): undefined reference to `cs::ReleaseSink(int, int*)'
/tmp/ccEiQ61k.o: In function `cs::VideoSink::SetSource(cs::VideoSource)':
test.cpp:(.text._ZN2cs9VideoSink9SetSourceENS_11VideoSourceE[_ZN2cs9VideoSink9SetSourceENS_11VideoSourceE]+0x54): undefined reference to `cs::SetSinkSource(int, int, int*)'
test.cpp:(.text._ZN2cs9VideoSink9SetSourceENS_11VideoSourceE[_ZN2cs9VideoSink9SetSourceENS_11VideoSourceE]+0x7c): undefined reference to `cs::SetSinkSource(int, int, int*)'
/tmp/ccEiQ61k.o: In function `cs::MjpegServer::MjpegServer(llvm::StringRef, llvm::StringRef, int)':
test.cpp:(.text._ZN2cs11MjpegServerC2EN4llvm9StringRefES2_i[_ZN2cs11MjpegServerC5EN4llvm9StringRefES2_i]+0x4c): undefined reference to `cs::CreateMjpegServer(llvm::StringRef, llvm::StringRef, int, int*)'
/tmp/ccEiQ61k.o: In function `cs::CvSink::CvSink(llvm::StringRef)':
test.cpp:(.text._ZN2cs6CvSinkC2EN4llvm9StringRefE[_ZN2cs6CvSinkC5EN4llvm9StringRefE]+0x30): undefined reference to `cs::CreateCvSink(llvm::StringRef, int*)'
/tmp/ccEiQ61k.o: In function `cs::CvSink::GrabFrame(cv::Mat&) const':
test.cpp:(.text._ZNK2cs6CvSink9GrabFrameERN2cv3MatE[_ZNK2cs6CvSink9GrabFrameERN2cv3MatE]+0x38): undefined reference to `cs::GrabSinkFrame(int, cv::Mat&, int*)'
collect2: error: ld returned 1 exit status
Makefile:11: recipe for target 'test' failed
make: *** [test] Error 1
Hmm that sounds like the link to cscore still isn't being setup right. Try instead of -L/home/pi/cscore/Linux/arm and -lcscore, try -L/home/pi/cscore/Linux/arm/libcscore.a

That should force the link. Sorry this is a lot of toubleshooting. I've only really tested the gradle setup, and unless you specifically needing to custom compile either ntcore or cscore, I'd recommend using that, since that will make sure to have all the linker settings right. If you want to try that, clone the repo to that link I sent for the build arguments, and use the Cpp folder. Basic setup is go into build.gradle, comment out ext.builtType = "windows", and uncomment the 3 lines below the comment that says uncomment these to build natively on a Pi. Then just replace the main.cpp in the src file with your main, and that should work. Your file works when testing on my end, so it's definitely something not being right in the make link script.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
Reply With Quote