Libgourou

Issue 37: Compilation fails

Reported by Alan Schmitt, Jun 9, 2022

I downloaded version 0.7.2 and I cannot compile it. Here is the log.

libgourou on  tags/v0.7.2 
➜ make
mkdir obj
g++ -Wall -fPIC -I./include -I./lib -I./lib/pugixml/src/ 
-I./lib/updfparser/include -O2 -c src/libgourou.cpp -o 
obj/libgourou.o
In file included from ./include/libgourou_common.h:38,
                 from src/libgourou.cpp:28:
src/libgourou.cpp: In member function ‘void 
gourou::DRMProcessor::removePDFDRM(const std::string&, const 
std::string&, const unsigned char*, unsigned int)’:
src/libgourou.cpp:1210:64: error: ‘off_t uPDFParser::Object::offset’ 
is private within this context
 1210 |                 GOUROU_LOG(DEBUG, "XRef stream at 
" << object->offset());
      |                                                              
  ^~~~~~
./include/libgourou_log.h:36:79: note: in definition of macro 
‘GOUROU_LOG’
   36 | #define GOUROU_LOG(__lvl, __msg) if (__lvl <= 
gourou::logLevel) {std::cout << __msg << std::endl 
<< std::flush;}
      |                                                              
                 ^~~~~
In file included from ./lib/updfparser/include/uPDFParser.h:34,
                 from src/libgourou.cpp:25:
./lib/updfparser/include/uPDFObject.h:143:15: note: declared private 
here
  143 |         off_t offset;
      |               ^~~~~~
src/libgourou.cpp:1210:70: error: expression cannot be used as a 
function
 1210 |                 GOUROU_LOG(DEBUG, "XRef stream at 
" << object->offset());
      |                                                        
~~~~~~~~~~~~~~^~
./include/libgourou_log.h:36:79: note: in definition of macro 
‘GOUROU_LOG’
   36 | #define GOUROU_LOG(__lvl, __msg) if (__lvl <= 
gourou::logLevel) {std::cout << __msg << std::endl 
<< std::flush;}
      |                                                              
                 ^~~~~
src/libgourou.cpp:1235:64: error: ‘class uPDFParser::String’ has no 
member named ‘unescapedValue’
 1235 |                     string = ((uPDFParser::String*) 
dictData)->unescapedValue();
      |                                                              
  ^~~~~~~~~~~~~~
src/libgourou.cpp:1258:28: error: ‘class uPDFParser::Dictionary’ has 
no member named ‘replace’
 1258 |                 dictionary.replace(dictIt->first, 
dictIt->second);
      |                            ^~~~~~~
src/libgourou.cpp:1270:56: error: ‘class uPDFParser::Stream’ has no 
member named ‘data’
 1270 |                 unsigned char* encryptedData = 
stream->data();
      |                                                        ^~~~
src/libgourou.cpp:1271:51: error: ‘class uPDFParser::Stream’ has no 
member named ‘dataLength’
 1271 |                 unsigned int dataLength = 
stream->dataLength();
      |                                                   ^~~~~~~~~~
src/libgourou.cpp:1275:102: error: ‘class uPDFParser::Stream’ has no 
member named ‘dataLength’
 1275 |                 GOUROU_LOG(DEBUG, "Decrypt stream id 
" << object->objectId() << ", size " 
<< stream->dataLength());
      |                                                              
                                        ^~~~~~~~~~
./include/libgourou_log.h:36:79: note: in definition of macro 
‘GOUROU_LOG’
   36 | #define GOUROU_LOG(__lvl, __msg) if (__lvl <= 
gourou::logLevel) {std::cout << __msg << std::endl 
<< std::flush;}
      |                                                              
                 ^~~~~
src/libgourou.cpp:1283:25: error: ‘class uPDFParser::Stream’ has no 
member named ‘setData’
 1283 |                 stream->setData(clearData, dataOutLength, 
true);
      |                         ^~~~~~~
src/libgourou.cpp:1289:46: error: ‘class uPDFParser::Parser’ has no 
member named ‘getTrailer’; did you mean ‘uPDFParser::Object 
uPDFParser::Parser::trailer’? (not accessible from this context)
 1289 |         uPDFParser::Object& trailer = 
parser.getTrailer();
      |                                              ^~~~~~~~~~
./lib/updfparser/include/uPDFParser.h:103:16: note: declared private 
here
  103 |         Object trailer;
      |                ^~~~~~~
src/libgourou.cpp:1290:17: error: ‘class uPDFParser::Object’ has no 
member named ‘deleteKey’
 1290 |         trailer.deleteKey("Encrypt");
      |                 ^~~~~~~~~
make: *** [Makefile:52: obj/libgourou.o] Error 1

If need be, here is my g++ version.

➜ g++ --version
g++ (GCC) 12.1.0

Comment 1 by Grégory Soutadé, Jun 10, 2022

Hello,

Did you update uPDFParser repository ?

Comment 2 by Alan Schmitt, Jun 10, 2022

Ah, that works.

Maybe the top-level README could tell to update that separate 
library, and that it needs to be built with BUILD_STATIC=1.

Thanks a lot for the help!

Alan

Comment 3 by Grégory Soutadé, Jun 12, 2022

I updated README.md and added a Makefile rule in order to update all 
internal libraries. Thanks.

Status: Fixed

Created: 11 months 30 days ago by Alan Schmitt

Updated: 11 months 27 days ago

Status: Fixed

Followed by: 1 person

Labels:
Priority:Medium
Type:Defect