rtravis/SkypeCacheViewer

Build error in Amazon Linux 2

Closed this issue · 7 comments

I got the following error when building:

Scanning dependencies of target SkypeCacheViewer
[ 93%] Building CXX object CMakeFiles/SkypeCacheViewer.dir/src/chromium_leveldb_comparator_provider.cpp.o
[ 96%] Building CXX object CMakeFiles/SkypeCacheViewer.dir/src/skype_leveldb_scanner.cpp.o
[100%] Linking CXX executable SkypeCacheViewer
CMakeFiles/SkypeCacheViewer.dir/src/skype_leveldb_scanner.cpp.o: In function `bool scan_leveldb<main::{lambda(leveldb::Slice, leveldb::Slice)#1}>(char const*, main::{lambda(leveldb::Slice, leveldb::Slice)#1})':
skype_leveldb_scanner.cpp:(.text+0x1432): undefined reference to `leveldb::DB::Open(leveldb::Options const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, leveldb::DB**)'
collect2: error: ld returned 1 exit status
make[2]: *** [SkypeCacheViewer] Error 1
make[1]: *** [CMakeFiles/SkypeCacheViewer.dir/all] Error 2
make: *** [all] Error 2

I've installed "leveldb-devel-1.12.0-11.el7.x86_64" from Epel REPO. Please let me know how to build this ?

Unfortunately the LevelDB library on Amazon Linux 2 is quite old (version 1.0.7) and only provides symbols that are compatible only with the C++98 ABI (i.e. it can't be used by a program that uses the C++11 or a newer standard of the C++ language).

Your error shows that this symbol is needed by the linker:

leveldb::DB::Open(leveldb::Options const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, leveldb::DB**)

However "/usr/lib64/libleveldb.so.1.0.7" offers this (different) symbol:

leveldb::DB::Open(leveldb::Options const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, leveldb::DB**)

Building in Docker with CentOS image resulted in this:

[root@01d4140c7d2e build]# cmake .. && make
-- Configuring done
-- Generating done
-- Build files have been written to: /app/SkypeCacheViewer/build
[ 90%] Built target leveldb_chromium_comparator
[ 93%] Linking CXX executable SkypeCacheViewer
chromium/libleveldb_chromium_comparator.a(indexed_db_leveldb_operations.cc.o):(.rodata+0x188): undefined reference to `typeinfo for leveldb::Comparator'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/SkypeCacheViewer.dir/build.make:100: SkypeCacheViewer] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/SkypeCacheViewer.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

Any chance you can help to resolve it? Thank you rtravis!

Yeah it fails to build on Rhel based distribution but builds ok in Ubuntu 20.04.

Thanks, it built successfully in Ubuntu! However, the only output I see is a list of contacts. Did you manage to access the actual messages?

Caveat: I’ve imported the Skype db from a Windows machine. Not sure if it’s relevant.

Thanks, it built successfully in Ubuntu! However, the only output I see is a list of contacts. Did you manage to access the actual messages?

Caveat: I’ve imported the Skype db from a Windows machine. Not sure if it’s relevant.

Yes. On previous versions, I had to manually edit source code. /src/skype_leveldb_scanner.cpp But in latest commit 7c2f096#diff-57c690f091700e6ed7fb9fa5d33097171439f4e8424e1779212344ca3083ca14,

add the "-m" command line parameter to show messages instead of contacts. I wrote a Go program to sort messages with time from the output of this program because the messages are in random order and it's hard to read without sorting properly. Below is my code to parse messages from messages.txt

//sortmessages.go
package main

import (
	"fmt"
	"io/ioutil"
	"regexp"
	"sort"
	"strings"
)

type message struct {
	time           string
	creator        string
	conversationId string
	content        string
}

func main() {
	messages := map[string]message{}
	b, err := ioutil.ReadFile("messages.txt")
	if err != nil {
		fmt.Print(err)
	}

	time := regexp.MustCompile("originalarrivaltime=(.*)")
	creator := regexp.MustCompile("creator=(.*)")
	content := regexp.MustCompile("(?s) content=(.*)type=Message")
	conversation := regexp.MustCompile("conversationId=(.*)")

	datas := strings.Split(string(b), "START Message-----")

	for _, v := range datas {
		m := message{}

		t := time.FindStringSubmatch(v)

		if len(t) < 1 {
			continue
		}

		c := creator.FindStringSubmatch(v)

		if len(c) < 1 {
			continue
		}

		cont := content.FindStringSubmatch(v)
		//fmt.Println("==========", len(cont), "====", cont[1], "=========")
		if len(cont) < 1 {
			continue
		}

		conv := conversation.FindStringSubmatch(v)
		if len(conv) < 1 {
			continue
		}
		m.creator = c[1]
		m.content = cont[1]
		m.conversationId = conv[1]
		m.time = t[1]
		//fmt.Println(m)
		messages[t[1]] = m

		//fmt.Println(m)
		// fmt.Println(t[1])
		// fmt.Println(c[1])
		// fmt.Println(cont[1])
		// fmt.Println(conv[1])
		//fmt.Println("----")

		//messages = append(messages, m)

	}

	names := make([]string, 0, len(messages))

	for name := range messages {
		names = append(names, name)
	}
	sort.Strings(names)

	for _, name := range names {

		fmt.Printf("(%s) %s %6s  %s\n", messages[name].time, messages[name].creator, "→",
			strings.Replace(messages[name].content, "\n", " ", -1))
		//fmt.Println(messages[name].time, "\n", messages[name].creator, ": ", messages[name].content)
	}

}

Unfortunately the LevelDB library on Amazon Linux 2 is quite old (version 1.0.7) and only provides symbols that are compatible only with the C++98 ABI (i.e. it can't be used by a program that uses the C++11 or a newer standard of the C++ language).

The LevelDB library installed is version 1.12.0-11

The LevelDB library installed is version 1.12.0-11

Yes it is. I used the version from the name of the shared library /usr/lib64/libleveldb.so.1.0.7, not that of the package, it's strange how on RHEL based distributions these versions differ. Nevertheless what I said above still holds: you can't link a program built with the C++11 ABI to that version of leveldb.

Closing as "won't fix".