C++ Macro example: DocumentLoader

aitor_czr aitor_czr at gnuinos.org
Sat Mar 19 12:20:44 UTC 2016


Hi Stephan,

On 02/01/2016 02:04 PM, Stephan Bergmann wrote:
> On 02/01/2016 12:24 PM, aitor_czr wrote:
>> $ make DocumentLoader.run
>> cd /usr/lib/libreoffice/sdk/LINUXexample.out/bin && DocumentLoader
>> -env:URE_MORE_TYPES=file://"/types/offapi.rdb"
>> "/usr/lib/libreoffice/sdk/test.odt"
>> Error: cannot establish a connection using
>> 'uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager':
>>         Connector : couldn't connect to socket (Success)
>> Makefile:101: recipe for target 'DocumentLoader.run' failed
>> make: *** [DocumentLoader.run] Error 1
>>
>> I tried doing:
>>
>> $/usr/lib/libreoffice/program/soffice
>> "--accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager" 
>> &
>>
>> before running the application, but it doesn't work.
>
> I cannot reproduce that problem; works fine here. You can use 
> something like
>
>   netstat -an | grep 2083
>
> to check that nothing is listening on port 2083 before you start 
> soffice, and then again check that soffice started to listen on that 
> port after starting soffice.


I installed libreoffice-dev-doc (1:4.3.3-2-deb8u2) in debian jessie 
including all the macro examples, and ran the 
"/usr/lib/libreoffice/sdk/setsdkenv_unix.sh" script. Trying to build 
DocumentLoader, this is what i get:


root at gnuinos:/usr/lib/libreoffice/sdk/examples/cpp/DocumentLoader# make
mkdir -p ../../../LINUXexample.out/obj/DocumentLoader
gcc -c -fpic -fvisibility=hidden -O -I. -I../../../LINUXexample.out/inc 
-I../../../LINUXexample.out/inc/examples -I../../../include 
-I../../../LINUXexample.out/inc/DocumentLoader -DUNX -DGCC -DLINUX 
-DCPPU_ENV=gcc3 -DHAVE_GCC_VISIBILITY_FEATURE 
-o../../../LINUXexample.out/obj/DocumentLoader/DocumentLoader.o 
DocumentLoader.cxx
mkdir -p ../../../LINUXexample.out/bin
mkdir -p ../../../LINUXexample.out/misc/DocumentLoader
g++ -Wl,--allow-shlib-undefined -Wl,-export-dynamic -Wl,-z,defs 
-Wl,--no-whole-archive -L"../../../LINUXexample.out/lib" 
-L"/usr/lib/libreoffice/sdk/lib" -L"" -o 
../../../LINUXexample.out/bin/DocumentLoader 
../../../LINUXexample.out/obj/DocumentLoader/DocumentLoader.o \
   -luno_cppuhelpergcc3 -luno_cppu -luno_salhelpergcc3 -luno_sal
g++: error: ../../../LINUXexample.out/bin/DocumentLoader: No such file 
or directory
Makefile:69: recipe for target 
'../../../LINUXexample.out/bin/DocumentLoader' failed
make: *** [../../../LINUXexample.out/bin/DocumentLoader] Error 1


The same issue trying to build another c++ example (osiris; i.e, 
odt2pdf.cxx):


root at gnuinos:/usr/lib/libreoffice/sdk/examples/cpp/osiris# make
mkdir -p /usr/lib/libreoffice/sdk/LINUXexample.out/obj/odt2pdf
gcc -c -fpic -fvisibility=hidden -O -I. 
-I/usr/lib/libreoffice/sdk/LINUXexample.out/inc 
-I/usr/lib/libreoffice/sdk/LINUXexample.out/inc/examples 
-I/usr/lib/libreoffice/sdk/include 
-I/usr/lib/libreoffice/sdk/LINUXexample.out/inc/odt2pdf -DUNX -DGCC 
-DLINUX -DCPPU_ENV=gcc3 -DHAVE_GCC_VISIBILITY_FEATURE 
-o/usr/lib/libreoffice/sdk/LINUXexample.out/obj/odt2pdf/odt2pdf.o 
odt2pdf.cxx
mkdir -p /usr/lib/libreoffice/sdk/LINUXexample.out/bin
mkdir -p /usr/lib/libreoffice/sdk/LINUXexample.out/misc/odt2pdf
g++ -Wl,--allow-shlib-undefined -Wl,-export-dynamic -Wl,-z,defs 
-Wl,--no-whole-archive -L"/usr/lib/libreoffice/sdk/LINUXexample.out/lib" 
-L"/usr/lib/libreoffice/sdk/lib" -L"" -o 
/usr/lib/libreoffice/sdk/LINUXexample.out/bin/odt2pdf 
/usr/lib/libreoffice/sdk/LINUXexample.out/obj/odt2pdf/odt2pdf.o \
   -luno_cppuhelpergcc3 -luno_cppu -luno_salhelpergcc3 -luno_sal
g++: error: /usr/lib/libreoffice/sdk/LINUXexample.out/bin/odt2pdf: No 
such file or directory
Makefile:71: recipe for target 
'/usr/lib/libreoffice/sdk/LINUXexample.out/bin/odt2pdf' failed
make: *** [/usr/lib/libreoffice/sdk/LINUXexample.out/bin/odt2pdf] Error 1


In both cases, the binary is not generated:


case 1)  g++: error: ../../../LINUXexample.out/bin/DocumentLoader: No 
such file or directory
case 2)  g++: error: 
/usr/lib/libreoffice/sdk/LINUXexample.out/bin/odt2pdf: No such file or 
directory


On the other hand, i think that the used port isn't the origin of the 
issue. Sometimes i get:


root at gnuinos:/usr/lib/libreoffice/sdk/examples/cpp/osiris# netstat -an | 
grep 2083
tcp        0      0 127.0.0.1:2083 0.0.0.0:*               LISTEN


and sometimes i don't get anything. In both cases i can run libreoffice 
succesfully via:


|$ soffice 
"--accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager"


Thanks in advance,

   Aitor.
|




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20160319/532b3ff1/attachment.html>


More information about the LibreOffice mailing list