Libgourou

Issue 45: Build Static Utils undefined reference to gourou:logLevel

Reported by Patrick , Jan 14, 2023

Steps to reproduce the problem:
1. Debian Testing (Bookworm)
2. Install dependencies for libgourou and utils
3. Pull latest git repository
4. run make UTILS_STATIC=1 BUILD_STATIC=1

Expected result:
Have static compiled utils

Actual result:
Building libgourou 0.8.1
mkdir lib
./scripts/setup.sh
Cloning into 'lib/updfparser'...
~/tmp/new/libgourou/lib/updfparser ~/tmp/new/libgourou
make[1]: Entering directory 
'/home/pah/tmp/new/libgourou/lib/updfparser'
mkdir obj
g++ -Wall -fPIC -I./include -O2 -c src/uPDFParser.cpp -o 
obj/uPDFParser.o
g++ -Wall -fPIC -I./include -O2 -c src/uPDFTypes.cpp -o 
obj/uPDFTypes.o
ar crs libupdfparser.a obj/*.o
make[1]: Leaving directory 
'/home/pah/tmp/new/libgourou/lib/updfparser'
~/tmp/new/libgourou
mkdir obj
g++ -Wall -fPIC -I./include -I./usr/include/pugixml 
-I./lib/updfparser/include -O2 -c src/libgourou.cpp -o 
obj/libgourou.o
g++ -Wall -fPIC -I./include -I./usr/include/pugixml 
-I./lib/updfparser/include -O2 -c src/user.cpp -o obj/user.o
g++ -Wall -fPIC -I./include -I./usr/include/pugixml 
-I./lib/updfparser/include -O2 -c src/device.cpp -o obj/device.o
g++ -Wall -fPIC -I./include -I./usr/include/pugixml 
-I./lib/updfparser/include -O2 -c src/fulfillment_item.cpp -o 
obj/fulfillment_item.o
g++ -Wall -fPIC -I./include -I./usr/include/pugixml 
-I./lib/updfparser/include -O2 -c src/loan_token.cpp -o 
obj/loan_token.o
g++ -Wall -fPIC -I./include -I./usr/include/pugixml 
-I./lib/updfparser/include -O2 -c src/bytearray.cpp -o 
obj/bytearray.o
ar crs libgourou.a obj/*.o  ./lib/updfparser/libupdfparser.a
g++ obj/*.o -Wl,-soname,libgourou.so.0.8.1 
./lib/updfparser/libupdfparser.a -lpugixml -o libgourou.so.0.8.1 
-shared
ln -f -s libgourou.so.0.8.1 libgourou.so
make -C utils ROOT=/home/pah/tmp/new/libgourou CXX=g++ AR=ar DEBUG= 
STATIC_UTILS=1 DEST_DIR= PREFIX=/usr/local
make[1]: Entering directory '/home/pah/tmp/new/libgourou/utils'
g++ -Wall -fPIC -I/home/pah/tmp/new/libgourou/include 
-I/home/pah/tmp/new/libgourou/lib/pugixml/src/ -O2 
drmprocessorclientimpl.cpp utils_common.cpp 
-L/home/pah/tmp/new/libgourou -lcrypto -lzip -lz -lcurl -lpugixml -c
ar crs utils.a drmprocessorclientimpl.o utils_common.o 
/home/pah/tmp/new/libgourou/libgourou.a
g++ -Wall -fPIC -I/home/pah/tmp/new/libgourou/include 
-I/home/pah/tmp/new/libgourou/lib/pugixml/src/ -O2 
acsmdownloader.cpp utils.a -L/home/pah/tmp/new/libgourou -lcrypto 
-lzip -lz -lcurl -lpugixml -o acsmdownloader
/usr/bin/ld: /tmp/cckbHDTE.o: in function 
`gourou::Exception::Exception(int, char const*, char const*, int)':
acsmdownloader.cpp:(.text._ZN6gourou9ExceptionC2EiPKcS2_i[_ZN6gourou9
ExceptionC5EiPKcS2_i]+0x30c): undefined reference to 
`gourou::logLevel'
/usr/bin/ld: /tmp/cckbHDTE.o: in function `main':
acsmdownloader.cpp:(.text.startup+0xf9): undefined reference to 
`gourou::DRMProcessor::getLogLevel()'
/usr/bin/ld: acsmdownloader.cpp:(.text.startup+0x3ab): undefined 
reference to `gourou::DRMProcessor::setLogLevel(int)'
/usr/bin/ld: /tmp/cckbHDTE.o: in function 
`ACSMDownloader::serializeLoanToken(gourou::FulfillmentItem*)':
acsmdownloader.cpp:(.text._ZN14ACSMDownloader18serializeLoanTokenEPN6
gourou15FulfillmentItemE[_ZN14ACSMDownloader18serializeLoanTokenEPN6g
ourou15FulfillmentItemE]+0x1f): undefined reference to 
`gourou::FulfillmentItem::getLoanToken()'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader18serializeLoanTokenEPN6
gourou15FulfillmentItemE[_ZN14ACSMDownloader18serializeLoanTokenEPN6g
ourou15FulfillmentItemE]+0xfa): undefined reference to 
`gourou::LoanToken::operator[](std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > 
const&)'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader18serializeLoanTokenEPN6
gourou15FulfillmentItemE[_ZN14ACSMDownloader18serializeLoanTokenEPN6g
ourou15FulfillmentItemE]+0x222): undefined reference to 
`gourou::LoanToken::operator[](std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > 
const&)'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader18serializeLoanTokenEPN6
gourou15FulfillmentItemE[_ZN14ACSMDownloader18serializeLoanTokenEPN6g
ourou15FulfillmentItemE]+0x335): undefined reference to 
`gourou::LoanToken::operator[](std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > 
const&)'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader18serializeLoanTokenEPN6
gourou15FulfillmentItemE[_ZN14ACSMDownloader18serializeLoanTokenEPN6g
ourou15FulfillmentItemE]+0x450): undefined reference to 
`gourou::FulfillmentItem::getMetadata(std::__cxx11::basic_string<c
har, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader18serializeLoanTokenEPN6
gourou15FulfillmentItemE[_ZN14ACSMDownloader18serializeLoanTokenEPN6g
ourou15FulfillmentItemE]+0x61d): undefined reference to 
`gourou::LoanToken::operator[](std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > 
const&)'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader18serializeLoanTokenEPN6
gourou15FulfillmentItemE[_ZN14ACSMDownloader18serializeLoanTokenEPN6g
ourou15FulfillmentItemE]+0x66a): undefined reference to 
`gourou::LoanToken::operator[](std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > 
const&)'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader18serializeLoanTokenEPN6
gourou15FulfillmentItemE[_ZN14ACSMDownloader18serializeLoanTokenEPN6g
ourou15FulfillmentItemE]+0x779): undefined reference to 
`gourou::ByteArray::ByteArray(unsigned char const*, unsigned int)'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader18serializeLoanTokenEPN6
gourou15FulfillmentItemE[_ZN14ACSMDownloader18serializeLoanTokenEPN6g
ourou15FulfillmentItemE]+0x794): undefined reference to 
`gourou::ByteArray::toHex[abi:cxx11]()'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader18serializeLoanTokenEPN6
gourou15FulfillmentItemE[_ZN14ACSMDownloader18serializeLoanTokenEPN6g
ourou15FulfillmentItemE]+0xf63): undefined reference to 
`gourou::ByteArray::~ByteArray()'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader18serializeLoanTokenEPN6
gourou15FulfillmentItemE[_ZN14ACSMDownloader18serializeLoanTokenEPN6g
ourou15FulfillmentItemE]+0x135a): undefined reference to 
`gourou::ByteArray::~ByteArray()'
/usr/bin/ld: /tmp/cckbHDTE.o: in function `ACSMDownloader::run()':
acsmdownloader.cpp:(.text._ZN14ACSMDownloader3runEv[_ZN14ACSMDownload
er3runEv]+0x172): undefined reference to 
`gourou::DRMProcessor::DRMProcessor(gourou::DRMProcessorClient*, 
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&)'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader3runEv[_ZN14ACSMDownload
er3runEv]+0x48b): undefined reference to 
`gourou::DRMProcessor::exportPrivateLicenseKey(std::__cxx11::basic_st
ring<char, std::char_traits<char>, 
std::allocator<char> >)'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader3runEv[_ZN14ACSMDownload
er3runEv]+0x536): undefined reference to 
`gourou::DRMProcessor::~DRMProcessor()'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader3runEv[_ZN14ACSMDownload
er3runEv]+0x6a0): undefined reference to 
`gourou::DRMProcessor::fulfill(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > 
const&)'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader3runEv[_ZN14ACSMDownload
er3runEv]+0x980): undefined reference to 
`gourou::DRMProcessor::download(gourou::FulfillmentItem*, 
std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> >, bool)'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader3runEv[_ZN14ACSMDownload
er3runEv]+0xab1): undefined reference to 
`gourou::User::getUsername[abi:cxx11]()'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader3runEv[_ZN14ACSMDownload
er3runEv]+0xed5): undefined reference to 
`gourou::FulfillmentItem::getMetadata(std::__cxx11::basic_string<c
har, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: 
acsmdownloader.cpp:(.text._ZN14ACSMDownloader3runEv[_ZN14ACSMDownload
er3runEv]+0x14cd): undefined reference to 
`gourou::DRMProcessor::~DRMProcessor()'
/usr/bin/ld: utils.a(drmprocessorclientimpl.o): in function 
`curlRead(void*, unsigned long, unsigned long, void*)':
drmprocessorclientimpl.cpp:(.text+0x1bb): undefined reference to 
`gourou::ByteArray::append(unsigned char const*, unsigned int)'
/usr/bin/ld: utils.a(drmprocessorclientimpl.o): in function 
`downloadProgress(void*, long, long, long, long)':
drmprocessorclientimpl.cpp:(.text+0x43c): undefined reference to 
`gourou::logLevel'
/usr/bin/ld: utils.a(drmprocessorclientimpl.o): in function 
`DRMProcessorClientImpl::zipReadFile(void*, 
std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> > const&, gourou::ByteArray&, 
bool)':
drmprocessorclientimpl.cpp:(.text+0x54e0): undefined reference to 
`gourou::ByteArray::resize(unsigned int, bool)'
/usr/bin/ld: utils.a(drmprocessorclientimpl.o): in function 
`DRMProcessorClientImpl::zipWriteFile(void*, 
std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> > const&, 
gourou::ByteArray&)':
drmprocessorclientimpl.cpp:(.text+0x5822): undefined reference to 
`gourou::ByteArray::addRef()'
/usr/bin/ld: utils.a(drmprocessorclientimpl.o): in function 
`DRMProcessorClientImpl::inflate(gourou::ByteArray&, 
gourou::ByteArray&, int)':
drmprocessorclientimpl.cpp:(.text+0x6281): undefined reference to 
`gourou::ByteArray::append(unsigned char const*, unsigned int)'
/usr/bin/ld: drmprocessorclientimpl.cpp:(.text+0x64e3): undefined 
reference to `gourou::ByteArray::append(unsigned char const*, 
unsigned int)'
/usr/bin/ld: utils.a(drmprocessorclientimpl.o): in function 
`DRMProcessorClientImpl::deflate(gourou::ByteArray&, 
gourou::ByteArray&, int, int)':
drmprocessorclientimpl.cpp:(.text+0x6927): undefined reference to 
`gourou::ByteArray::append(unsigned char const*, unsigned int)'
/usr/bin/ld: utils.a(drmprocessorclientimpl.o): in function 
`DRMProcessorClientImpl::sendHTTPRequest(std::__cxx11::basic_string&l
t;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::map<std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >, 
std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> >, 
std::less<std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > >, 
std::allocator<std::pair<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> > > > >*, int, bool)':
drmprocessorclientimpl.cpp:(.text+0x6cb6): undefined reference to 
`gourou::ByteArray::ByteArray(bool)'
/usr/bin/ld: drmprocessorclientimpl.cpp:(.text+0x6ce4): undefined 
reference to `gourou::logLevel'
/usr/bin/ld: drmprocessorclientimpl.cpp:(.text+0x6fca): undefined 
reference to `gourou::logLevel'
/usr/bin/ld: drmprocessorclientimpl.cpp:(.text+0x6ffb): undefined 
reference to `gourou::logLevel'
/usr/bin/ld: drmprocessorclientimpl.cpp:(.text+0x7102): undefined 
reference to `gourou::logLevel'
/usr/bin/ld: drmprocessorclientimpl.cpp:(.text+0x7133): undefined 
reference to `gourou::logLevel'
/usr/bin/ld: 
utils.a(drmprocessorclientimpl.o):drmprocessorclientimpl.cpp:(.text+0
x739a): more undefined references to `gourou::logLevel' follow
/usr/bin/ld: utils.a(drmprocessorclientimpl.o): in function 
`DRMProcessorClientImpl::sendHTTPRequest(std::__cxx11::basic_string&l
t;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::map<std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >, 
std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> >, 
std::less<std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > >, 
std::allocator<std::pair<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> > > > >*, int, bool)':
drmprocessorclientimpl.cpp:(.text+0x742a): undefined reference to 
`gourou::ByteArray::~ByteArray()'
/usr/bin/ld: drmprocessorclientimpl.cpp:(.text+0x744b): undefined 
reference to `gourou::logLevel'
/usr/bin/ld: utils.a(drmprocessorclientimpl.o): in function 
`curlHeaders(char*, unsigned long, unsigned long, void*)':
drmprocessorclientimpl.cpp:(.text+0x836c): undefined reference to 
`gourou::logLevel'
/usr/bin/ld: utils.a(drmprocessorclientimpl.o): in function 
`DRMProcessorClientImpl::sendHTTPRequest(std::__cxx11::basic_string&l
t;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::map<std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >, 
std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> >, 
std::less<std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > >, 
std::allocator<std::pair<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> > > > >*, int, bool) [clone 
.cold]':
drmprocessorclientimpl.cpp:(.text.unlikely+0x2356): undefined 
reference to `gourou::ByteArray::~ByteArray()'
/usr/bin/ld: utils.a(utils_common.o): in function `version()':
utils_common.cpp:(.text+0x24): undefined reference to 
`gourou::DRMProcessor::VERSION[abi:cxx11]'
/usr/bin/ld: utils.a(utils_common.o): in function `findFile(char 
const*, bool)':
utils_common.cpp:(.text+0x11a): undefined reference to 
`gourou::DRMProcessor::getDefaultAdeptDir[abi:cxx11]()'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:38: acsmdownloader] Error 1
make[1]: Leaving directory '/home/pah/tmp/new/libgourou/utils'
make: *** [Makefile:85: build_utils] Error 2

Comment 1 by Grégory Soutadé, Jan 14, 2023

Should be fixed now in master. Can you try ?

Status: Started

Comment 2 by Patrick , Jan 14, 2023

Hi Grégory,

Thanks for your quick reply and fix.
It works now.

Best Regards,
Patrick

Comment 3 by Grégory Soutadé, Jan 15, 2023


Status: Fixed

Created: 4 months 25 days ago by Patrick

Updated: 4 months 24 days ago

Status: Fixed

Followed by: 1 person

Labels:
Priority:Medium
Type:Defect