root (cern) crashes with a libpng issue Fedora 20 - crash

I installed the last version of root from source, downloaded from cern website, and I am not able to open the TBrowser, due to the error I attach at the end of the message. I have already searched for help on several question on the root forum, but didn't find anything that worked for me or that helped me. Could anyone help me debugging this issue? thanks for any reply
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.2.50 but running with 1.6.6
Warning in <TASImage::GetMask>: No image
Warning in <TASImage::GetMask>: No image
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00007fc03ffe13ac in waitpid () from /lib64/libc.so.6
#1 0x00007fc03ff675b2 in do_system () from /lib64/libc.so.6
#2 0x00007fc040c92ec9 in TUnixSystem::StackTrace() () from /usr/local/lib/root/libCore.so
#3 0x00007fc040c94aec in TUnixSystem::DispatchSignals(ESignals) () from /usr/local/lib/root/libCore.so
#4 <signal handler called>
#5 0x00007fc039960971 in asimage_init () from /usr/local/lib/root/libASImage.so
#6 0x00007fc039961242 in destroy_asimage () from /usr/local/lib/root/libASImage.so
#7 0x00007fc03999ebb4 in merge_layers () from /usr/local/lib/root/libASImage.so
#8 0x00007fc039943da6 in TASImage::Merge(TImage const*, char const*, int, int) () from /usr/local/lib/root/libASImage.so
#9 0x00007fc03b1dc35c in TGPictureButton::CreateDisabledPicture() () from /usr/local/lib/root/libGui.so
#10 0x00007fc03b1d908c in TGPictureButton::DoRedraw() () from /usr/local/lib/root/libGui.so
#11 0x00007fc03b1d68fc in TGButton::SetState(EButtonState, bool) () from /usr/local/lib/root/libGui.so
#12 0x00007fc03b28b064 in TGTextEditor::Build() () from /usr/local/lib/root/libGui.so
#13 0x00007fc03b28c345 in TGTextEditor::TGTextEditor(char const*, TGWindow const*, unsigned int, unsigned int) () from /usr/local/lib/root/libGui.so
#14 0x00007fc03b548c73 in G__G__Gui3_385_0_2(G__value*, char const*, G__param*, int) () from /usr/local/lib/root/libGui.so
#15 0x00007fc03f44137d in Cint::G__ExceptionWrapper(int (*)(G__value*, char const*, G__param*, int), G__value*, char*, G__param*, int) () from /usr/local/lib/root/libCint.so
#16 0x00007fc03f48c307 in G__execute_call () from /usr/local/lib/root/libCint.so
#17 0x00007fc03f48c6c5 in G__call_cppfunc () from /usr/local/lib/root/libCint.so
#18 0x00007fc03f40a16d in G__interpret_func () from /usr/local/lib/root/libCint.so
#19 0x00007fc03f51d867 in G__getfunction () from /usr/local/lib/root/libCint.so
#20 0x00007fc03f44412c in G__new_operator () from /usr/local/lib/root/libCint.so
#21 0x00007fc03f41d72d in G__exec_statement () from /usr/local/lib/root/libCint.so
#22 0x00007fc03f3e6dd6 in G__exec_tempfile_core () from /usr/local/lib/root/libCint.so
#23 0x00007fc03f3e82be in G__exec_tempfile_fp () from /usr/local/lib/root/libCint.so
#24 0x00007fc03f537c69 in G__process_cmd () from /usr/local/lib/root/libCint.so
#25 0x00007fc040c62120 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /usr/local/lib/root/libCore.so
#26 0x00007fc040c030ab in TApplication::ProcessLine(char const*, bool, int*) () from /usr/local/lib/root/libCore.so
#27 0x00007fc040c28bdc in TROOT::ProcessLine(char const*, int*) () from /usr/local/lib/root/libCore.so
#28 0x00007fc03b24d741 in TRootBrowser::ExecPlugin(char const*, char const*, char const*, int, int) () from /usr/local/lib/root/libGui.so
#29 0x00007fc03b24e4f8 in TRootBrowser::InitPlugins(char const*) () from /usr/local/lib/root/libGui.so
#30 0x00007fc03b24e938 in TRootBrowser::TRootBrowser(TBrowser*, char const*, unsigned int, unsigned int, char const*, bool) () from /usr/local/lib/root/libGui.so
#31 0x00007fc03b24ee38 in TRootBrowser::NewBrowser(TBrowser*, char const*, unsigned int, unsigned int, char const*) () from /usr/local/lib/root/libGui.so
#32 0x00007fc03b56af8a in G__G__Gui3_418_0_47(G__value*, char const*, G__param*, int) () from /usr/local/lib/root/libGui.so
#33 0x00007fc03f44063b in Cint::G__CallFunc::Execute(void*) () from /usr/local/lib/root/libCint.so
#34 0x00007fc040c5d3e1 in TCint::CallFunc_ExecInt(void*, void*) const () from /usr/local/lib/root/libCore.so
#35 0x00007fc040c59861 in TMethodCall::Execute(void*, long&) () from /usr/local/lib/root/libCore.so
#36 0x00007fc040c2cce2 in TPluginHandler::ExecPlugin(int, ...) () from /usr/local/lib/root/libCore.so
#37 0x00007fc03b26c7b9 in TRootGuiFactory::CreateBrowserImp(TBrowser*, char const*, unsigned int, unsigned int, char const*) () from /usr/local/lib/root/libGui.so
#38 0x00007fc040c0af0a in TBrowser::TBrowser(char const*, char const*, TBrowserImp*, char const*) () from /usr/local/lib/root/libCore.so
#39 0x00007fc040cf00e0 in G__G__Base1_85_0_3(G__value*, char const*, G__param*, int) () from /usr/local/lib/root/libCore.so
#40 0x00007fc03f44137d in Cint::G__ExceptionWrapper(int (*)(G__value*, char const*, G__param*, int), G__value*, char*, G__param*, int) () from /usr/local/lib/root/libCint.so
#41 0x00007fc03f48c307 in G__execute_call () from /usr/local/lib/root/libCint.so
#42 0x00007fc03f48c6c5 in G__call_cppfunc () from /usr/local/lib/root/libCint.so
#43 0x00007fc03f40a16d in G__interpret_func () from /usr/local/lib/root/libCint.so
#44 0x00007fc03f51d867 in G__getfunction () from /usr/local/lib/root/libCint.so
#45 0x00007fc03f4d4ee9 in G__define_var () from /usr/local/lib/root/libCint.so
#46 0x00007fc03f41891c in G__exec_statement () from /usr/local/lib/root/libCint.so
#47 0x00007fc03f3e6dd6 in G__exec_tempfile_core () from /usr/local/lib/root/libCint.so
#48 0x00007fc03f3e82be in G__exec_tempfile_fp () from /usr/local/lib/root/libCint.so
#49 0x00007fc03f537c69 in G__process_cmd () from /usr/local/lib/root/libCint.so
#50 0x00007fc040c62120 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /usr/local/lib/root/libCore.so
#51 0x00007fc040c030ab in TApplication::ProcessLine(char const*, bool, int*) () from /usr/local/lib/root/libCore.so
#52 0x00007fc04081faa9 in TRint::HandleTermInput() () from /usr/local/lib/root/libRint.so
#53 0x00007fc040c942b5 in TUnixSystem::CheckDescriptors() () from /usr/local/lib/root/libCore.so
#54 0x00007fc040c94dda in TUnixSystem::DispatchOneEvent(bool) () from /usr/local/lib/root/libCore.so
#55 0x00007fc040bf2956 in TSystem::InnerLoop() () from /usr/local/lib/root/libCore.so
#56 0x00007fc040bf3500 in TSystem::Run() () from /usr/local/lib/root/libCore.so
#57 0x00007fc040c0173f in TApplication::Run(bool) () from /usr/local/lib/root/libCore.so
#58 0x00007fc040820bc7 in TRint::Run(bool) () from /usr/local/lib/root/libRint.so
#59 0x0000000000400fec in main ()
===========================================================
The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5 0x00007fc039960971 in asimage_init () from /usr/local/lib/root/libASImage.so
#6 0x00007fc039961242 in destroy_asimage () from /usr/local/lib/root/libASImage.so
#7 0x00007fc03999ebb4 in merge_layers () from /usr/local/lib/root/libASImage.so
#8 0x00007fc039943da6 in TASImage::Merge(TImage const*, char const*, int, int) () from /usr/local/lib/root/libASImage.so
#9 0x00007fc03b1dc35c in TGPictureButton::CreateDisabledPicture() () from /usr/local/lib/root/libGui.so
#10 0x00007fc03b1d908c in TGPictureButton::DoRedraw() () from /usr/local/lib/root/libGui.so
#11 0x00007fc03b1d68fc in TGButton::SetState(EButtonState, bool) () from /usr/local/lib/root/libGui.so
#12 0x00007fc03b28b064 in TGTextEditor::Build() () from /usr/local/lib/root/libGui.so
#13 0x00007fc03b28c345 in TGTextEditor::TGTextEditor(char const*, TGWindow const*, unsigned int, unsigned int) () from /usr/local/lib/root/libGui.so
===========================================================

Try setting LD_LIBRARY_PATH in your environment, to point to the directory that contains libpng16 (for example, if libpng16.so is in /path/to/lib/libpng16.so, do this:
$ LD_LIBRARY_PATH=/path/to/lib export LD_LIBRARY_PATH
$ root
root[0] new TBrowser
That worked for me on Ubuntu, although I also had to include the path to libCore.so that is installed along with root.

When you build root (assuming you're installing from source), try running configure with the --disable-builtin-afterimage option.

Related

Undefined reference to klee when building s2e

I'm trying to start a new prject and build s2e in a new directory. But at arounf the 100% mark, it gives me an undefined reference error. The relevant part (imo) is this:
[ 92%] Linking CXX executable ../ExprTest
../../lib/libkleeCore.a(Executor.cpp.o): In function `klee::Executor::setModule(llvm::Module*, klee::Interpreter::ModuleOptions const&, bool)':
~/s2e_projects/source/s2e/klee/include/klee/Internal/Module/KModule.h:189: undefined reference to `klee::KModule::KModule(llvm::Module*)'
My directory structure is such:
|-s2e-env
|-s2e_projects
|-venv
I followed the steps from here: http://s2e.systems/docs/s2e-env.html I followed all the steps upto s2e build which is where this problem occurs.
For reference, the (truncated) output which I got from doing s2e build &> log:
[ 88%] Built target kleeModule
make[3]: Entering directory '~/s2e_projects/build/klee-release'
make[3]: Entering directory '~/s2e_projects/build/klee-release'
make[3]: Entering directory '~/s2e_projects/build/klee-release'
make[3]: Leaving directory '~/s2e_projects/build/klee-release'
make[3]: Leaving directory '~/s2e_projects/build/klee-release'
make[3]: Leaving directory '~/s2e_projects/build/klee-release'
make[3]: Entering directory '~/s2e_projects/build/klee-release'
make[3]: Entering directory '~/s2e_projects/build/klee-release'
make[3]: Entering directory '~/s2e_projects/build/klee-release'
[ 91%] Linking CXX executable ../ADTTest
[ 91%] Linking CXX executable ../UtilsTest
[ 92%] Linking CXX executable ../ExprTest
../../lib/libkleeCore.a(Executor.cpp.o): In function `klee::Executor::setModule(llvm::Module*, klee::Interpreter::ModuleOptions const&, bool)':
~/s2e_projects/source/s2e/klee/include/klee/Internal/Module/KModule.h:189: undefined reference to `klee::KModule::KModule(llvm::Module*)'
../../lib/libkleeCore.a(Executor.cpp.o): In function `klee::Executor::setModule(llvm::Module*, klee::Interpreter::ModuleOptions const&, bool)':
~/s2e_projects/build/llvm-10.0.0.src/include/llvm/IR/DataLayout.h:393: undefined reference to `llvm::DataLayout::getPointerSize(unsigned int) const'
../../lib/libkleeCore.a(Executor.cpp.o): In function `klee::Executor::setModule(llvm::Module*, klee::Interpreter::ModuleOptions const&, bool)':
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:107: undefined reference to `klee::KModule::linkLibraries(klee::Interpreter::ModuleOptions const&)'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:108: undefined reference to `klee::KModule::buildShadowStructures()'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:110: undefined reference to `klee::KModule::prepare(klee::Interpreter::ModuleOptions const&, klee::InterpreterHandler*)'
../../lib/libkleeCore.a(Executor.cpp.o): In function `klee::Executor::initializeGlobalObject(klee::ExecutionState&, boost::intrusive_ptr<klee::ObjectState> const&, llvm::Constant const*, unsigned int)':
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:150: undefined reference to `llvm::ConstantDataSequential::getNumElements() const'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:151: undefined reference to `llvm::ConstantDataSequential::getElementAsConstant(unsigned int) const'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:153: undefined reference to `llvm::DataLayout::getStructLayout(llvm::StructType*) const'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:158: undefined reference to `klee::KModule::evalConstant(std::unordered_map<llvm::GlobalValue const*, klee::ref<klee::ConstantExpr>, std::hash<llvm::GlobalValue const*>, std::equal_to<llvm::GlobalValue const*>, std::allocator<std::pair<llvm::GlobalValue const* const, klee::ref<klee::ConstantExpr> > > > const&, llvm::Constant const*, klee::KInstruction const*)'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:163: undefined reference to `klee::ConstantExpr::ZExt(unsigned int)'
../../lib/libkleeCore.a(Executor.cpp.o): In function `klee::Executor::initializeGlobals(klee::ExecutionState&)':
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:200: undefined reference to `llvm::Value::getName() const'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:241: undefined reference to `llvm::Value::getName() const'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:247: undefined reference to `llvm::GlobalValue::isDeclaration() const'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:258: undefined reference to `llvm::Value::getName() const'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:260: undefined reference to `llvm::Value::getName() const'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:262: undefined reference to `llvm::Value::getName() const'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:268: undefined reference to `llvm::Value::getName() const'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:281: undefined reference to `llvm::Value::getName() const'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:306: undefined reference to `klee::KModule::evalConstant(std::unordered_map<llvm::GlobalValue const*, klee::ref<klee::ConstantExpr>, std::hash<llvm::GlobalValue const*>, std::equal_to<llvm::GlobalValue const*>, std::allocator<std::pair<llvm::GlobalValue const* const, klee::ref<klee::ConstantExpr> > > > const&, llvm::Constant const*, klee::KInstruction const*)'
~/s2e_projects/source/s2e/klee/lib/Core/Executor.cpp:311: undefined reference to `llvm::Value::getName() const'
../../lib/libkleeCore.a(Executor.cpp.o): In function `klee::Executor::initializeGlobals(klee::ExecutionState&)':
~/s2e_projects/build/llvm-10.0.0.src/include/llvm/IR/GlobalVariable.h:92: undefined reference to `llvm::GlobalValue::isDeclaration() const'
../../lib/libkleeCore.a(Executor.cpp.o): In function `klee::Executor::initializeGlobals(klee::ExecutionState&)':
...
I had the exact same error and solved it with:
sudo apt install gcc-9 g++-9
Also check to make sure clang selects the installed gcc-9 toolchain:
$ PATH_TO_S2E/install/bin/clang++ -v
...
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
...
As for why a compatible gcc toolchain is needed, even though clang is used to compile S2E:
Why clang selects a gcc installation?

NoSuchMethodError: The getter 'length' was called on null. While calling put api?

I have one issue while working on flutter, whenever i tried to calling the http.put request strange issue occurred.
Here is my main code.
saveBookMarksLogin(id) async {
final prefs = await SharedPreferences.getInstance();
var bookmarkData = {
"userId": userId,
"newsFeedId": id,
};
try {
final response = await http.put(
Uri(
scheme: 'http',
host: host,
port: 3000,
path: '/v1/saveBookmark',
),
body: bookmarkData,
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
);
if (response.body != null) {
prefs.setStringList("bookmarkIds", [id]);
return json.decode(response.body);
}
} on SocketException {
Fluttertoast.showToast(
msg: "No internet connection",
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
timeInSecForIos: 1,
textColor: Colors.white,
fontSize: 16.0,
backgroundColor: Colors.black,
);
}
}
Stack trace of issue while debugging..
I/flutter (23979): error NoSuchMethodError: The getter 'length' was called on null.
I/flutter (23979): Receiver: null
I/flutter (23979): Tried calling: length
I/flutter (23979): stacktrace #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
I/flutter (23979): #1 _Uri._uriEncode (dart:core-patch/uri_patch.dart:44:23)
I/flutter (23979): #2 Uri.encodeQueryComponent (dart:core/uri.dart:1103:17)
I/flutter (23979): #3 mapToQuery.<anonymous closure>
package:http/src/utils.dart:19
I/flutter (23979): #4 CastMap.forEach.<anonymous closure> (dart:_internal/cast.dart:286:8)
I/flutter (23979): #5 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
I/flutter (23979): #6 CastMap.forEach (dart:_internal/cast.dart:285:13)
I/flutter (23979): #7 mapToQuery
package:http/src/utils.dart:17
I/flutter (23979): #8 Request.bodyFields=
package:http/src/request.dart:128
I/flutter (23979): #9 BaseClient._sendUnstreamed
package:http/src/base_client.dart:163
I/flutter (23979): <asynchronous suspension>
I/flutter (23979): #10 BaseClient.put
package:http/src/base_client.dart:76
I/flutter (23979): #11 put.<anonymous closure>
package:http/http.dart:94
I/flutter (23979): #12 _withClient
package:http/http.dart:166
I/flutter (23979): <asynchronous suspension>
I/flutter (23979): #13 put
package:http/http.dart:93
I/flutter (23979): #14 _NewsPageState.saveBookMarksLogin (package:i
Flutter doctor -v
[√] Flutter (Channel stable, 2.0.6, on Microsoft Windows [Version 10.0.21359.1], locale en-IN)
• Flutter version 2.0.6 at C:\Program Files\flutter
• Framework revision 1d9032c7e1 (2 weeks ago), 2021-04-29 17:37:58 -0700
• Engine revision 05e680e202
• Dart version 2.12.3
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\lkrja\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.3)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.9.31129.286
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[√] VS Code (version 1.56.1)
• VS Code at C:\Users\lkrja\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.22.0
[√] Connected device (4 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.21359.1]
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.212
• Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.56
• No issues found!

Cannot properly link the libraries in CMakeLists

I have some troubles with linking the source files (I have added them as Libraries in my CMakeLists) with my main file. Here is my CMakeLists:
cmake_minimum_required(VERSION 2.8.3)
project(ros_bridge)
set(${PROJECT_NAME}_CATKIN_COMPONENTS
nav_msgs
roscpp
sensor_msgs
std_msgs
)
add_compile_options(-std=c++14)
find_package(catkin REQUIRED COMPONENTS ${${PROJECT_NAME}_CATKIN_COMPONENTS})
find_package(RapidJSON REQUIRED)
catkin_package(
INCLUDE_DIRS
include
include/aws_iot_sdk
include/common
include/network
CATKIN_DEPENDS ${${PROJECT_NAME}_CATKIN_COMPONENTS}
)
include_directories(
include
include/aws_iot_sdk
${catkin_INCLUDE_DIRS}
)
## Libraries
add_library(ros_client src/ros_client.cpp)
add_library(ConfigCommon include/common/ConfigCommon.cpp)
add_library(OpenSSL include/network/OpenSSL/OpenSSLConnection.cpp)
add_library(WebSocket include/network/WebSocket/WebSocketConnection.cpp)
add_executable(ros_bridge_node src/main.cpp)
## Lib links
target_link_libraries(ros_client ConfigCommon ${catkin_LIBRARIES} ${RapidJSON_LIBRARIES} OpenSSL WebSocket)
target_link_libraries(ConfigCommon ${catkin_LIBRARIES} ${RapidJSON_LIBRARIES} OpenSSL WebSocket)
target_link_libraries(ros_bridge_node ${catkin_LIBRARIES} ros_client ConfigCommon OpenSSL WebSocket ${RapidJSON_LIBRARIES})
So when the compiler tries to link my main file (which is ros_bridge_node) I get the error with the linkage:
ros_client.cpp:(.text+0x605): undefined reference to `awsiotsdk::util::Logging::GetLogSystem()'
ros_client.cpp:(.text+0x66d): undefined reference to `awsiotsdk::ResponseHelper::ToString[abi:cxx11](awsiotsdk::ResponseCode)'
CMakeFiles/ros_bridge_node.dir/src/ros_client.cpp.o: In function `ros_bridge::RosClient::RunPublish(int&)':
ros_client.cpp:(.text+0x8d9): undefined reference to `awsiotsdk::Utf8String::Create(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/home/abyl/master-wheel/devel/lib/libWebSocket.so: undefined reference to `BIO_push'
/home/abyl/master-wheel/devel/lib/libWebSocket.so: undefined reference to `awsiotsdk::NetworkConnection::Read(std::vector<unsigned char, std::allocator<unsigned char> >&, unsigned long, unsigned long, unsigned long&)'
/home/abyl/master-wheel/devel/lib/libConfigCommon.so: undefined reference to `awsiotsdk::util::JsonParser::InitializeFromJsonFile(rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/abyl/master-wheel/devel/lib/libWebSocket.so: undefined reference to `SHA1'
/home/abyl/master-wheel/devel/lib/libWebSocket.so: undefined reference to `BIO_f_base64'
/home/abyl/master-wheel/devel/lib/libWebSocket.so: undefined reference to `awsiotsdk::network::OpenSSLConnection::IsPhysicalLayerConnected()'
/home/abyl/master-wheel/devel/lib/libWebSocket.so: undefined reference to `BIO_set_flags'
/home/abyl/master-wheel/devel/lib/libWebSocket.so: undefined reference to `BIO_new'
So how can I properly link the libraries against my Main file?
EDIT:
I have set the object files of aws_iot_sdk like this:
set(${aws_sdk} /home/ren/aws-iot-device-sdk-cpp/build/CMakeFiles/aws-iot-sdk-cpp.dir/src)
set_source_files_properties(
${aws_sdk_path}
PROPERTIES
EXTERNAL_OBJECT true
GENERATED true
)
And tried to link that against my main file:
target_link_libraries(ros_bridge_node ros_client ConfigCommon Open WebSocket wslay ${RapidJSON_LIBRARIES} ${catkin_LIBRARIES} -lssl ${aws_sdk})
But still getting the same linkage problem. May be I am linking the object files wrong? (Now all the linkage problem is from the aws_iot_sdk)

CGAL compile error

I installed all the required libraries of CGAL, and added all the library path to my makefile while compiling my program on linux, but it still occured compiling error.
This is the content of my makefile
//--------------------------------------------------
FLAGS = -Wall -g -std=c++11 -O3
BOOST_LIB_PATH = -I /usr/include/include/
CGAL_LIB_PATH = -I /usr/local/include/
all :
g++ $(FLAGS) $(BOOST) $(CGAL) main.cpp -o main
clean :
rm main
//--------------------------------------------------
Bellow is the error message while compiling, Please help !
//----------------------------------------------------
g++ -Wall -g -std=c++11 -O3 -I /usr/include/include/ -I /usr/local/include/ main.cpp -o main
/usr/local/include/CGAL/Interval_nt.h:208: undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/usr/local/include/CGAL/Interval_nt.h:210: undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/cc5WX5dM.o: In function `~Gmpz_rep':
/usr/local/include/CGAL/GMP/Gmpz_type.h:57: undefined reference to `__gmpz_clear'
/usr/local/include/CGAL/GMP/Gmpz_type.h:57: undefined reference to `__gmpz_clear'
/usr/local/include/CGAL/GMP/Gmpz_type.h:57: undefined reference to `__gmpz_clear'
/tmp/cc5WX5dM.o: In function `CGAL::Gmpz::operator==(CGAL::Gmpz const&) const':
/usr/local/include/CGAL/GMP/Gmpz_type.h:154: undefined reference to `__gmpz_cmp'
/usr/local/include/CGAL/GMP/Gmpz_type.h:154: undefined reference to `__gmpz_cmp'
/tmp/cc5WX5dM.o: In function `CGAL::Quadratic_program_solution<CGAL::Gmpz>::optimality_certificate_numerators_begin() const':
/usr/local/include/CGAL/QP_solution.h:460: undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/cc5WX5dM.o: In function `CGAL::Gmpz::operator<(CGAL::Gmpz const&) const':
/usr/local/include/CGAL/GMP/Gmpz_type.h:152: undefined reference to `__gmpz_cmp'
/usr/local/include/CGAL/GMP/Gmpz_type.h:152: undefined reference to `__gmpz_cmp'
/usr/local/include/CGAL/GMP/Gmpz_type.h:152: undefined reference to `__gmpz_cmp'
/tmCGAL::assertion_fail(char const*, char const*, int, char const*)'
collect2: error: ld returned 1 exit status
make: *** [all] Error 1
I had a similar problem. I fix it by adding
find_library( GMP_LIB NAMES "gmp" PATHS ${CMAKE_LIBRARY_PATH} )
and add it to the target_link_libraries

Mono p/invoke giving 'undefined symbol __dso_handle'

I added the .so to LDConfig following this article. Still getting the following. You can get the source for the code here. Here is the log from the startup of the binary.
MONO_LOG_LEVEL=debug mono 39dll-4-linux.exe
Mono: gc took 20 usecs
Mono: Assembly Loader probing location: '/usr/lib/mono/4.0/mscorlib.dll'.
Mono: Image addref mscorlib[0x1bd58e0] -> /usr/lib/mono/4.0/mscorlib.dll[0x1bd4c10]: 2
Mono: AOT failed to load AOT module /usr/lib/mono/4.0/mscorlib.dll.so: /usr/lib/mono/4.0/mscorlib.dll.so: cannot open shared object file: No such file or directory
Mono: Assembly Loader loaded assembly from location: '/usr/lib/mono/4.0/mscorlib.dll'.
Mono: Config attempting to parse: '/usr/lib/mono/4.0/mscorlib.dll.config'.
Mono: Config attempting to parse: '/etc/mono/assemblies/mscorlib/mscorlib.config'.
Mono: Assembly mscorlib[0x1bd58e0] added to domain 39dll-4-linux.exe, ref_count=1
Mono: Config attempting to parse: '/etc/mono/config'.
Mono: Config attempting to parse: '/home/nick/.mono/config'.
Mono: Assembly Loader probing location: '39dll-4-linux.exe'.
Mono: Image addref 39dll-4-linux[0x1c520f0] -> /home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/39dll-4-linux.exe[0x1bd3980]: 3
Mono: Assembly 39dll-4-linux[0x1c520f0] added to domain 39dll-4-linux.exe, ref_count=1
Mono: AOT failed to load AOT module /home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/39dll-4-linux.exe.so: /home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/39dll-4-linux.exe.so: cannot open shared object file: No such file or directory
Mono: Assembly Loader loaded assembly from location: '39dll-4-linux.exe'.
Mono: Config attempting to parse: '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/39dll-4-linux.exe.config'.
Mono: Config attempting to parse: '/etc/mono/assemblies/39dll-4-linux/39dll-4-linux.config'.
Mono: Assembly Loader probing location: '39dll-4-linux.exe'.
Mono: AOT failed to load AOT module /home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/39dll-4-linux.exe.so: /home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/39dll-4-linux.exe.so: cannot open shared object file: No such file or directory
Mono: Assembly Ref addref 39dll-4-linux[0x1c520f0] -> mscorlib[0x1bd58e0]: 2
Mono: DllImport attempting to load: 'libWinsockLib'.
Mono: DllImport loading library: '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib'.
Mono: DllImport error loading library '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib: cannot open shared object file: No such file or directory'.
Mono: DllImport loading library: '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib.so'.
Mono: DllImport error loading library '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib.so: undefined symbol: __dso_handle'.
Mono: DllImport loading location: 'libWinsockLib'.
Mono: DllImport error loading library: 'libWinsockLib: cannot open shared object file: No such file or directory'.
Mono: DllImport loading location: 'libWinsockLib.so'.
Mono: DllImport error loading library: '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib.so: undefined symbol: __dso_handle'.
Mono: DllImport loading: 'libWinsockLib'.
Mono: DllImport error loading library 'libWinsockLib: cannot open shared object file: No such file or directory'.
Mono: DllImport unable to load library 'libWinsockLib: cannot open shared object file: No such file or directory'.
Mono: DllImport attempting to load: 'libWinsockLib'.
Mono: DllImport loading library: '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib'.
Mono: DllImport error loading library '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib: cannot open shared object file: No such file or directory'.
Mono: DllImport loading library: '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib.so'.
Mono: DllImport error loading library '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib.so: undefined symbol: __dso_handle'.
Mono: DllImport loading location: 'libWinsockLib'.
Mono: DllImport error loading library: 'libWinsockLib: cannot open shared object file: No such file or directory'.
Mono: DllImport loading location: 'libWinsockLib.so'.
Mono: DllImport error loading library: '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib.so: undefined symbol: __dso_handle'.
Mono: DllImport loading: 'libWinsockLib'.
Mono: DllImport error loading library 'libWinsockLib: cannot open shared object file: No such file or directory'.
Mono: DllImport unable to load library 'libWinsockLib: cannot open shared object file: No such file or directory'.
Unhandled Exception: System.DllNotFoundException: libWinsockLib
at (wrapper managed-to-native) dll4linux.Net:dllInit ()
at dll4linux.SockLib.Init () [0x00000] in <filename unknown>:0
at dll4linux.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: libWinsockLib
at (wrapper managed-to-native) dll4linux.Net:dllInit ()
at dll4linux.SockLib.Init () [0x00000] in <filename unknown>:0
at dll4linux.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0
I am completely stumped. Any ideas as to whats going wrong?
FYI, I am invoking the following C# code:
[DllImport("libWinsockLib", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dllInit")]
public static extern Double dllInit();
Finally, I used the following build commands to build the 39dll-4-linux project:
Executed for each .cpp file:
g++ -fPIC -c -o obj/<filename>.o <filename>.cpp
Then I executed:
ld -G obj/*.o -o 39dll4linux.so
Never mind! I figured it out. Turns out, ld is not a good way to package and link a shared library.
Instead of the ld command, i used:
g++ -shared obj/*.o -o 39dll-4-linux.so
It works like a charm!