Re: [DynInst_API:] Building UNSTRIP from source


Date: Thu, 27 Oct 2016 17:59:37 +0000
From: "Osborn, Justin D." <Justin.Osborn@xxxxxxxxxx>
Subject: Re: [DynInst_API:] Building UNSTRIP from source
Solved - had no idea this was a thing - but when I switched the -l<libs> switches to the end of the gcc command line in the UNSTRIP makefile (and set the flag to build with the new ABI, because that's what I built dyninst with apparently), it found everything fine.  No idea why I had this problem but others didn't.

http://stackoverflow.com/questions/12272864/linker-error-on-linux-undefined-reference-to

Thanks Bill - it's off to the races - we are generally exploring the problem of function signaturing on architectures that tend to have a statically linked program running a single contiguous address space (meaning "system" calls are just like any other call).

Justin

-----Original Message-----
From: Bill Williams [mailto:bill@xxxxxxxxxxx] 
Sent: Wednesday, October 26, 2016 4:41 PM
To: Osborn, Justin D.; 'dyninst-api@xxxxxxxxxxx'
Subject: Re: Building UNSTRIP from source

That's...odd. I'm only on 5.3.0 locally but that worked fine. Your libsymtabAPI.so (etc) are in /usr/local/lib or /usr/local/lib/lib and accessible, right? nm shows symbols? This is a pretty comprehensive link failure (looks like all of the Dyninst calls) so I expect it's something a bit off in your environment vs. your makefile...

________________________________________
From: Osborn, Justin D. <Justin.Osborn@xxxxxxxxxx>
Sent: Wednesday, October 26, 2016 3:06 PM
To: Bill Williams; 'dyninst-api@xxxxxxxxxxx'
Subject: RE: Building UNSTRIP from source

Bill - so I had it set to -std=c++11, adding -D_GLIBCXX_USE_CXX11_ABI=0 got rid of some of the undefined references involving libstdc++11 stuff. (I have gcc 5.4.0 and apparently it is set to use the new ABI by default, but dyninst must have overrode that).

However I'm still getting a bunch of undefined references to stuff in dyninst libraries (see below).  Any ideas?  Thanks for the help so far!

Justin

osborjd1@wall-e3:~/JARVIS/UNSTRIP/tools-master/unstrip$ make
g++ -g -Wall -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -I/usr/local/include 
g++ -I/usr/local/lib/include -c types.C -g -Wall -std=c++11 
g++ -D_GLIBCXX_USE_CXX11_ABI=0 -I/usr/local/include 
g++ -I/usr/local/lib/include -c util.C -g -Wall -std=c++11 
g++ -D_GLIBCXX_USE_CXX11_ABI=0 -I/usr/local/include 
g++ -I/usr/local/lib/include -c semanticDescriptor.C -g -Wall -std=c++11 
g++ -D_GLIBCXX_USE_CXX11_ABI=0 -I/usr/local/include 
g++ -I/usr/local/lib/include -c database.C -g -Wall -std=c++11 
g++ -D_GLIBCXX_USE_CXX11_ABI=0 -I/usr/local/include 
g++ -I/usr/local/lib/include -c fingerprint.C -g -Wall -std=c++11 
g++ -D_GLIBCXX_USE_CXX11_ABI=0 -I/usr/local/include 
g++ -I/usr/local/lib/include -c callback.C -g -Wall -std=c++11 
g++ -D_GLIBCXX_USE_CXX11_ABI=0 -I/usr/local/include 
g++ -I/usr/local/lib/include -c unstrip.C -g -Wall -std=c++11 
g++ -D_GLIBCXX_USE_CXX11_ABI=0 -L/usr/local/lib//lib \
        -L/usr/local/lib \
        -ldwarf -lelf \
        -lparseAPI -lsymtabAPI -ldynElf -ldynDwarf -linstructionAPI \
        -lcommon \
        -o unstrip unstrip.o \
        callback.o database.o fingerprint.o semanticDescriptor.o types.o util.o
unstrip.o: In function `main':
/home/osborjd1/JARVIS/UNSTRIP/tools-master/unstrip/unstrip.C:182: undefined reference to `Dyninst::SymtabAPI::Symtab::openFile(Dyninst::SymtabAPI::Symtab*&, std::string, Dyninst::SymtabAPI::Symtab::def_t)'
/home/osborjd1/JARVIS/UNSTRIP/tools-master/unstrip/unstrip.C:198: undefined reference to `Dyninst::SymtabAPI::Symtab::findModuleByName(Dyninst::SymtabAPI::Module*&, std::string)'
/home/osborjd1/JARVIS/UNSTRIP/tools-master/unstrip/unstrip.C:204: undefined reference to `Dyninst::ParseAPI::SymtabCodeSource::SymtabCodeSource(Dyninst::SymtabAPI::Symtab*)'
/home/osborjd1/JARVIS/UNSTRIP/tools-master/unstrip/unstrip.C:206: undefined reference to `Dyninst::ParseAPI::CodeObject::CodeObject(Dyninst::ParseAPI::CodeSource*, Dyninst::ParseAPI::CFGFactory*, Dyninst::ParseAPI::ParseCallback*, bool)'
/home/osborjd1/JARVIS/UNSTRIP/tools-master/unstrip/unstrip.C:207: undefined reference to `Dyninst::ParseAPI::CodeObject::parse()'
/home/osborjd1/JARVIS/UNSTRIP/tools-master/unstrip/unstrip.C:215: undefined reference to `Dyninst::ParseAPI::CodeObject::parseGaps(Dyninst::ParseAPI::CodeRegion*, Dyninst::ParseAPI::GapParsingType)'
/home/osborjd1/JARVIS/UNSTRIP/tools-master/unstrip/unstrip.C:225: undefined reference to `Dyninst::ParseAPI::Function::extents()'
/home/osborjd1/JARVIS/UNSTRIP/tools-master/unstrip/unstrip.C:229: undefined reference to `Dyninst::SymtabAPI::Symtab::createFunction(std::string, unsigned long, unsigned long, Dyninst::SymtabAPI::Module*)'
/home/osborjd1/JARVIS/UNSTRIP/tools-master/unstrip/unstrip.C:243: undefined reference to `Dyninst::SymtabAPI::Symtab::emit(std::string, unsigned int)'
fingerprint.o: In function `Fingerprint::findMain(Dyninst::SymtabAPI::Symtab*, Dyninst::ParseAPI::SymtabCodeSource*, Dyninst::SymtabAPI::Module*)':
/home/osborjd1/JARVIS/UNSTRIP/tools-master/unstrip/fingerprint.C:50: undefined reference to `Dyninst::SymtabAPI::Symtab::findRegion(Dyninst::SymtabAPI::Region*&, std::string)'
/home/osborjd1/JARVIS/UNSTRIP/tools-master/unstrip/fingerprint.C:56: undefined reference to `Dyninst::SymtabAPI::Region::getPtrToRawData() const'
/home/osborjd1/JARVIS/UNSTRIP/tools-master/unstrip/fingerprint.C:58: undefined reference to `Dyninst::SymtabAPI::Region::getMemSize() const'
/home/osborjd1/JARVIS/UNSTRIP/tools-master/unstrip/fingerprint.C:58: undefined reference to `Dyninst::InstructionAPI::InstructionDecoder::InstructionDecoder(unsigned char const*, unsigned long, Dyninst::Architecture)'
/home/osborjd1/JARVIS/UNSTRIP/tools-master/unstrip/fingerprint.C:60: undefined reference to `Dyninst::InstructionAPI::InstructionDecoder::decode()'

...
(lots more undefined references)


-----Original Message-----
From: Bill Williams [mailto:bill@xxxxxxxxxxx]
Sent: Wednesday, October 26, 2016 2:03 PM
To: Osborn, Justin D.; 'dyninst-api@xxxxxxxxxxx'
Subject: Re: Building UNSTRIP from source

Justin--

I just checked this out locally and pushed up source code and makefile updates. The makefile will need manual configuration:

* set the C++0x/C++11 flag appropriately for your compiler
* set the new/old GNU ABI flag to match how you built dyninst (default is old ABI in both unstrip and dyninst)

Should work though.

Is ARM32 one of the embedded architectures you're looking at?

--bw

________________________________________
From: Dyninst-api <dyninst-api-bounces@xxxxxxxxxxx> on behalf of Osborn, Justin D. <Justin.Osborn@xxxxxxxxxx>
Sent: Wednesday, October 26, 2016 12:22 PM
To: 'dyninst-api@xxxxxxxxxxx'
Subject: [DynInst_API:] Building UNSTRIP from source

Hi all - please forgive the newbie question.

I am trying to get UNSTRIP built from source.  Looks like the last source version on github was updated 4 years ago.  I jumped through a couple hoops to get dyninst built and installed, and then I was able to get UNSTRIP to compile, however, I get a bunch of "undefined reference to" Dyninst API functions when linking.  It's properly finding my dyninst libraries, so I assume the issue is that the dyninst api has changed between now and whatever version of dyninst UNSTRIP was built for? (but maybe that's a bad assumption, I don't know).  Do I need an older version of dyninst for UNSTRIP, and if so, what version?

I am running a project where we are investigating porting existing function-level signaturing methods to embedded architectures.

Thanks,
Justin

--
Justin Osborn
JHU/APL

[← Prev in Thread] Current Thread [Next in Thread→]