Install PUNO in Ubuntu
This is a walkthrough how to install PUNO in Ubuntu. I have tried this in Ubuntu start from gutsy (7.10) to karmic (9.10) using OOo 2.4.x to 3.1.x (look table comparison).
The official how to install puno is in PUNO website: install.
12/11/2010: Due to new version of PUNO, this walkthrough only covers PUNO version 0.6.
INDEX
- Requirement
- Why Ubuntu?
- OOo Original or from Distro?
- Uninstall OOo from Distro
- Download OOo
- Extract OOo Packet
- Install OOo
- Install OOo-SDK
- Install WebServer & PHP
- Execute OOo-SDK Environment
- Download & Extract PUNO Source
- PHPize PUNO
- Configure
- Build automatic generated headers and Puno
- Install files in PHP module's directory
- Check puno.so Library Dependencies
- Add extension in PHP.ini
- Configure WebServer or Shell starting scripts
- Restart Webserver
- Table Comparison
Requirement
- Operating System
Ubuntu (choose between 7.10 to 9.10) - OpenOffice.org
Choose between OOo original or from distro (choose from OOo 2.4.x to 3.1.x) - OpenOffice.org SDK
If you use OOo original, then use OOo-SDK original too. But if you use OOo from distro, use OOo-SDK (development packet) from distro. - Web Server
Apache (i use apache bundled from ZendCore) - PHP
>= 5 (i use 5.2.4 bundled from ZendCore) - Another packets
Standard Ubuntu installation will need this packets- alien (optional)
- autoconf (i use autoconf 2.61-4)
- Dependency: m4 >=1.4.8 (i use m4 1.4.10-1)
- g++ (i use packet from CD installation*)
- libc6-dev (i use packet from CD installation*)
- libstlport4.6-dev (4.6.2-3.2)
- Dependency: libstlport4.6ldbl (4.6.2-3.2)
Why Ubuntu?
OOo Original or from Distro?
Later if i have quick internet connection, i will upload some copies of OOo and OOo-SDK.
Uninstall OOo from Distro
sudo apt-get remove openoffice.org*
If this line works, then it will prompt you a question: Do you want to continue [Y/n]?. It this line do not work, then it will output: Couldn't find package ... . Try this one:
sudo apt-get remove openoffice.org-*
After removing OOo, i suggest you to restart Ubuntu or restart X using combination ctrl - alt - backspace.
Download OOo
Extract OOo Packet
cd <OO_DOWNLOAD_PATH>
tar xzvf OOo_2.4.0_LinuxIntel_install_en-US_deb.tar.gz
cd <extracted files directory>/DEBS
Install OOo
sudo dpkg -i *.deb
cd desktop-integration (optional)
sudo dpkg -i *.deb (optional: show menu under Applications -> Office)
Install OOo-SDK
Thanks to OpenOffice.org, since OOo 3.1.0 they have OOo-SDK packet with both deb and rpm installer. No need to use alien again if you use OOo 3.1.0 or later.Because it is RPM, you need alien to convert it to deb packet. I assume you have installed alien in your distro.cd <OO_SDK_DOWNLOAD_PATH>
sh OOo-SDK_2.4.0_LinuxIntal_install.sh
cd <extracted files directory>/RPMS
Possible errors:sudo alien -d openoffice.org-sdk-2.4.0-9286.i586.rpm
sudo dpkg -i openoffice.org-sdk_2.4.0-9287_i386.deb
- ERROR:
dependency problem prevent configuration libstlport4.6-dev - SOLUTION:
download libstlport4.6-dev (4.6.2-3.2), and install it.
Install WebServer & PHP
Execute OOo-SDK Environment
Before going into OOo-SDK Environment, we must check our platform:The possible output:cd <OOO_SDK_PATH> ./config.guess
- i686-pc-linux-gnulibc1
- i686-pc-linux-gnu
What will happen in the second platform? This example will happen:****************************************************
*
* SDK environment is prepared for [blank]
*
You can see above, in the second example, OOo-SDK can recognize your platform. If OOo-SDK has already recognized your platform, then go on to the next step: into OOo-SDK environment.****************************************************
*
* SDK environment is prepared for Linux
*
Warning:sudo ./setsdkenv_unix
After this line, you must build puno under OOo-SDK environment.
Download & Extract PUNO Source
PHPize PUNO
#cd <PUNO_SOURCE_PATH>
#phpize
If you can not call phpize directly, then use full path. For example:
#/usr/local/Zend/Core/bin/phpize
Possible errors:
- ERROR:
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script - SOLUTION:
Try to install autoconf and m4 (autoconf's dependency).#apt-get install autoconf
Configure
#./configure --with-puno=<OOO_SDK_PATH>
Possible Errors:
- ERROR:
configure: error: C compiler cannot create executables - SOLUTION:
#apt-get install libc6-dev
- ERROR:
configure: error: Cannot find php-config. Please use --with-php-config=PATH - SOLUTION:
#./configure --with-puno=<OOO_SDK_PATH> --with-php-config=/usr/local/Zend/Core/bin/php-config
- ERROR:
configure: error: C++ preprocessor "/lib/cpp" fails sanity check - SOLUTION:
#apt-get install g++
configure: creating ./config-status
config.status: creating config.h
Build automatic generated headers and Puno
#make cppumaker
Possible errors:
- ERROR:
/bin/bash: regmerge: command not found
/bin/bash: regcomp: command not found - SOLUTION:
Locate and create link regmerge and regcomp to $OO_SDK_HOME/$PLATFORM/bin
If $PLATFORM is empty, then create link regmerge to $OO_SDK_HOME/bin. Example:#echo $OO_SDK_HOME
#echo $PLATFORM
The same solution apply when can not find regcomp (+ do not forget to link regcomp.bin and startup.sh [if available] too) and cppumaker.#ln -f /opt/openoffice.org2.4_sdk/linux/bin/regmerge /opt/openoffice.org2.4_sdk/bin/regmerge
- ERROR:
regmerge: error while loading shared libraries: libuno_sal.so.3: cannot open shared object file: No such file or directory - SOLUTION:
Maybe there are more library errors occured. The possibilities are:- libuno_sal.so.3
- libuno_salhelpergcc3.so.3
- libreg.so.3
- libstlport_gcc.so
- libstore.so.3
- libuno_cppu.so
- libuno_cppuhelpergcc3.so.3
- bootstrap.uno.so
- ERROR:
Error description: cannot get uno environments! - SOLUTION:
rerun ./setsdkenv_unix - ERROR:
loading component library failed : connector.uno.so - SOLUTION:
Maybe there are more library errors occured. The possibilites are:- remotebridge.uno.so
- bridgefac.uno.so
- uuresolver.uno.so
- Locate the library and create link to $OO_SDK_HOME/lib and/or $OFFICE_PROGRAM_PATH.
- Locate the library and edit makefile.complement file (do this before phpize puno).
//this is end section of the makefile.complement file.
//edit <LIBRARY_DIR> with the location of library from locate.
//example: replace <LIBRARY_DIR> with /opt/openoffice.org2.4/program/
//if the directory contain some space, do not forget to use double quote.
@echo --------------------------------------------------------------------------------
@echo Register necessary runtime components in the types.rdb
@echo --------------------------------------------------------------------------------
regcomp -register -r $(OUT_BIN)/types.rdb -c <LIBRARY_DIR>connector.uno.$(SHAREDLIB_EXT)
regcomp -register -r $(OUT_BIN)/types.rdb -c <LIBRARY_DIR>remotebridge.uno.$(SHAREDLIB_EXT)
regcomp -register -r $(OUT_BIN)/types.rdb -c <LIBRARY_DIR>bridgefac.uno.$(SHAREDLIB_EXT)
regcomp -register -r $(OUT_BIN)/types.rdb -c <LIBRARY_DIR>uuresolver.uno.$(SHAREDLIB_EXT)
@echo bla > $@ - Get and use original OOo & OOo-SDK.
- ERROR:
cppumaker.bin Error: cannot dump type 'com/sun/star/uno/RuntimeException' - SOLUTION:
Error is caused by types.rdb can not be found (installer detect wrong path or location). Source: bugzilla.redhat.com/show_bug.cgi?id=456459.
The solution is locate types.rdb (exception types.rdb result from puno install), restart your step from Download & Extract PUNO Source, and add it to makefile.complement.//find this line -> before
regmerge $@ / $(DKREGISTRYNAME)
regmerge $@ / "<TYPES.RDB_PATH>/types.rdb"
//for example: regmerge $@ / "/opt/openoffice.org2.4/program/types.rdb"
//find this line -> after
cppumaker : $(COMPONENT_RDB) $(COMPOENNT_ENV_FLAG) - ERROR:
cppumaker.bin Error: cannot dump type 'com/sun/star/lang/NullPointerException' - SOLUTION:
The same as above error, this error is caused by types.rdb can not be found. The different is you have included offapi.rdb in the makefile.complement. Solution for this error is the same as above error. - ERROR:
javaldx: Could not find a Java Runtime Environment - OPTIONAL SOLUTION:
The solution is just installing Java Runtime Environment. You can choose original sun-java6-jre packet or openjdk-6-jre or other jre packets available. This is optional because it still works fine without the JRE.
echo flagged > cppumaker
#make all
Possible errors:
- ERROR:
/opt/openoffice.org2.4_sdk/include/uno/lbnames.h:78:2: error: #error "Supported gcc majors are 2 , 3 and 4 <=4.3. Unsupported gcc major version." - SOLUTION:
Install g++ and gcc version <=4.3. This error happens when you are using OOo <=3.0.1. This error is caused by gcc and g++ installed version is > 4.3. - ERROR:
Can not find puno.lo - SOLUTION:
rename puno.loT to puno.lo or create link.#ln puno.loT puno.lo
- ERROR:
Error: /usr/bin/ld: cannot find -lstlport_gcc - SOLUTION:
Install libstlport4.6-dev. - ERROR:
libtool: link: unable to infer tagged configuration.
libtool: link: specify a tag with `--tag'
make: *** [puno.la] Error1 - SOLUTION:
This happens when you are using PHP 5.2.10 or later, aren't you? The solution is open and edit Makefile file.//Search for this text (in the bottom!)
./puno.la: $(shared_objects_puno) $(PUNO_SHARED_DEPENDENCIES)
$(LIBTOOL) --tag=CXX --mode=link $(CC) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o $@ -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $(shared_objects_puno) $(PUNO_SHARED_LIBADD) - ERROR: (only when using OOo3)
/usr/bin/ld: cannot find -luno_cppuhelpergcc3 - SOLUTION:
This error cause by OOo-SDK can not recognize your platform and not set SDK environment correctly. There are 2 solutions available:- Easy way: Remove all puno extracted file, exit from OOo-SDK environment, and rerun OOo-SDK environment (back to step Execute OOo-SDK Environment).
- Hard way: Create a library link manually.
-L"path"
How to find this? Run this:
This will output a file name test.txt. Analyzed that file, right until the last command, and you will find "path". Example:#make all > test.txt 2>&1
Maybe there are more libraries errors occured. The possibilities are:#ln -f /opt/openoffice.org/ure/lib/libuno_cppuhelpergcc3.so.3 /opt/openoffice.org/ure/lib/libuno_cppuhelpergcc3.so
- libuno_cppu.so
- libuno_salhelpergcc3.so
- libstlport_gcc.so
- ERROR: (only when using OOo3)
php_puno.h:45:51: error: com/sun/star/frame/XComponentLoader.hpp: No such file or directory - SOLUTION:
This is error caused by types.rdb. The solution is delete your puno source, restart your step from Download & Extract PUNO Source and add this line in your makefile.complement(after new extraction of puno).//find this line -> before
regmerge $@ / $(DKREGISTRYNAME)
regmerge $@ / "<OO_SDK_PATH(minus/sdk)>/program/offapi.rdb"
//for example: regmerge $@ / "/opt/openofffice.org/basis3.0/program/offapi.rdb"
//find this line -> after cppumaker : $(COMPONENT_RDB) $(COMPOENNT_ENV_FLAG)
Build complete.
Install files in PHP module's directory
#make install
Check puno.so Library Dependencies
#ldd <PUNO_SO_LOCATION>
Add extension in PHP.ini
extension=puno.so
Configure WebServer or Shell starting scripts
You must execute these lines before (re)starting the web server or add them to the beginning of the web server's startup script. Sometimes these lines automatically added. For example, i edit my apachectl script.This is required so that your webserver can 'find' OpenOffice.org libraries in order to use the UNO API. Clues for <OOO_SDK_PATH>/linux/lib and <OO_INSTALL_PATH>/program is one of this directory must contain minimum 4 libraries:LD_LIBRARY_PATH=<OOO_SDK_PATH>/linux/lib:$LD_LIBRARY_PATH LD_LIBRARY_PATH=<OO_INSTALL_PATH>/program:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
- connector.uno.so
- remotebridge.uno.so
- bridgefac.uno.so
- uuresolver.uno.so
Restart Webserver
Remember, under ./setsdkenv_unix!#apachectl stop
#apachectl start
FINISH!!
Do not forget to check your phpinfo(); and test some examples.

Possible Errors:
- ERROR:
PHP Notice: Constant fontrelief_none already defined in Unknown on line 0
PHP Notice: Constant fontrelief_embossed already defined in Unknown on line 0
PHP Notice: Constant fontrelief_engraved already defined in Unknown on line 0
- SOLUTION:
I have to say: i am sorry, you have to step backward. Please go to step Download & Extract PUNO Source. This time after you extract the source, open file enumerations.hpp.
Find for:- FontRelief_NONE: line 1492 and 2334
- FontRelief_EMBOSSED: line 1493 and 2335
- FontRelief_ENGRAVED: line 1494 and 23356
- ERROR:
Couldn't open registry file:///.../types.rdb for reading
- SOLUTION:
This error is caused by puno.so can not find registry file types.rdb. File types.rdb which is looked by puno.so is not the original from OOo but from PUNO building process. The easy solution is locate this registry file and then create a link. The link should be placed to the address where PUNO searches. The advanced solution is rebuild puno.so.
Table Comparison
| Test \ OS | Ubuntu7.10 (GustyGibbon) | Ubuntu8.04 (HardyHeron) | Ubuntu8.10 (IntrepidIbex) | Ubuntu9.04 (JauntyJackalope) | Ubuntu9.10 (KarmicKoala) |
|---|---|---|---|---|---|
| OOo version CD default | 2.3.0-1ubuntu5 | 2.4.0-3ubuntu6 | 2.4.1-11ubuntu2 | 3.0.1-9ubuntu3 | 3.1.1-5ubuntu1 |
| using OOo CD default | OK | OK1 | OK | OK1 | OK1 |
| using OOo 2.4.0 | OK | OK | OK | OK | OK |
| using OOo 2.4.1 | OK | OK | OK | OK | OK |
| using OOo 2.4.2 | OK | OK | OK | OK | OK |
| using OOo 2.4.3 | OK | OK | OK | OK | OK |
| using OOo 3.0.0 | OK | OK | OK | OK | OK |
| using OOo 3.0.1 | OK | OK | OK | OK | OK |
| using OOo 3.1.0 | OK | OK | OK | OK | OK |
| using OOo 3.1.1 | OK | OK | OK | OK | OK |
Hi,
Thanks for the tutorial, it helped me install puno.
Everything seems to work fine except the fact that i ran into this error when running a php test file :
~# php test.php
Started at: Mon, 18 Jan 2010 12:05:44 +0100
Fatal error: Uncaught exception ‘Exception’ with message ‘Connector : couldn’t connect to socket (Success)’ in /root/test.php:46
Stack trace:
#0 /root/test.php(46): get_remote_xcomponent(‘uno:socket,host…’, ‘com.sun.star.fr…’)
#1 /root/test.php(7): newDocComponent(’swriter’)
#2 {main}
thrown in /root/test.php on line 46
I ran soffice with this command : /opt/openoffice.org3/program/soffice -norestore -headless -invisible -nofirstwizard “-accept=socket,host=localhost,port=8100,tcpNoDelay=1;urp;” &
But I can’t see anything listening on port 8100 (tried with netstat and fuser).
Any idea ?
Thanks.
@Guillaume
Thank you for asking..
I agree with you, that error is caused by puno can not connect to soffice using specific port.
(usually 8100, check in your program line:get_remote_xcomponent(“uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager”,”com.sun.star.frame.Desktop”); )
And Your command seems fine : /opt/openoffice.org3/program/soffice -norestore -headless -invisible -nofirstwizard “-accept=socket,host=localhost,port=8100,tcpNoDelay=1;urp;” &
With that command, i can run soffice to listen in port 8100.
The problem is why you can see anything listening on port 8100. I can see it.
Usually i check with command : netstat -plaNt as root.
Maybe there is another program running using port 8100.
Or run with simple command first : /opt/openoffice.org3/program/soffice “-accept=socket,host=localhost,port=8100;urp;”
If you can see that soffice is running and opening port 8100, so your problem is in your command that runs soffice.
Hope this helps you..
Also, i notice that :
1.if you have option headless, there is no need to mention invisible.
2.the correct option is -nofirststartwizard, not -nofirstwizard
Hi,
I’ve managed to compile puno and install it into php’s module directory. I’ve also added extension=puno.so in php.ini and set the LD_LIBRARY_PATH in httpd.conf (SetEnv LD_LIBRARY_PATH /opt/openoffice.org/basis3.2/sdk/lib). Despite everything, php is not able to load the extension. The error is : Unable to load dynamic library ‘/usr/lib/php5/20060613+lfs/puno.so’ – libuno_cppuhelpergcc3.so.3 : cannot open shared object file : No such file or directory. However, libuno_cppuhelpergcc3.so.3 is inside the LB_LIBRARY_PATH directory. I am on debian, with apache 2, php 5 and OO3.2.1. Have you an idea ? Thanks.
@sabine
I have sent you my reponse via email (Fri, July 16, 2010).
If you still have problem related to puno, feel free to email me.
Hi,
I’m trying to convert XLS to PDF with headless OpenOffice.
I’ve installed OO-SDK, PUNO is listed as enabled in phpinfo()…
“OpenOffice.org UNO API support - enabled”
I start OpenOffice with the folowing command:
/usr/lib/openoffice “-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager” -nologo -headless -nofirststartwizard
Port 8100 is opened, but
when i run
I get this error:
Fatal error: Uncaught exception ‘Exception’ with message ‘Invalid Resource or Name!’ in /var/www/example01/examNaum.php:2 Stack trace: #0 /var/www/example01/examNaum.php(2): get_remote_xcomponent(‘uno:socket,host…’, ‘com.sun.star.fr…’) #1 {main} thrown in /var/www/example01/examNaum.php on line 2
With tcpdump I see that there is no communication between puno and openoffice, no packets are send to localhost:8100
What am I doing wrong, can you please help me?
Thank you in advance
Hi guys,
I’ve been compiling PUNO for OO 3.2.1 on PHP5/ RHEL 5.5 and it took me more than 3 days of headaches to work around OO 3 changes in merges. OK.
I guess this is not the place, but I face a simple as fundamental problem with PUNO UNO’s representation as PHP Objects. Often an iteration function (such as writer document’s findNext function) returns a sentinel value marking the end of the search. In the SDK doc, they say that is an object with only XInterface. I see no way, not members of it, telling me from PHP that’s the sentinel, PHP type is always Object anyway. In fact this “Do While”’s condition of the SDK Basic example I want to transpose to PHP :
xSearchDescr = xDocument.createSearchDescriptor()
xSearchDescr.SearchString = “search for”
xSearchDescr.SearchCaseSensitive = true
xSearchDescr.SearchWords = true
xFound = xDocument.findFirst( xSearchDescr )
do while not IsNull(xFound)
xFound.CharWeight = com.sun.star.awt.FontWeight.BOLD
xFound = xDocument.findNext( xFound.End, xSearchDescr )
loop
Many many thanks if someone can help me. For the rest I successfully filed a template doc with PUNO, et export it in real time (on demand) in many formats. This then PUNO/OO promised paradise
I give anyone who wants my PUNO package modification for OO 3.2.1/ RHEL 5.5, the SysV service shell script to start / stop OO as a non privileged user account, which service can be invoked from PHP via sudo.
Can’t you do it like : apt-get install puno ?
First, thanks for this. Even though it is a little old now, I used it to get PUNO installed on Ununtu Lucid.
I think I’m nearly there. After successfully installing everything, I tried a php test and I get this error:
———
PHP Fatal error: Uncaught exception ‘Exception’ with message ‘loading component library failed: uuresolver.uno.so’ in test.php:46
Stack trace:
#0 test.php(46): get_remote_xcomponent(‘uno:socket,host…’, ‘com.sun.star.fr…’)
#1 test.php(7): newDocComponent(’swriter’)
#2 {main}
thrown in test.php on line 46
———
Line 46 in test.php looks like this:
———
$x_component_loader=get_remote_xcomponent(“uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager”,”com.sun.star.frame.Desktop”);
———
Any suggestions, anyone? Feels like I’m almost there…
Thanks
@Geoff
I have solved my problem on my own. This article doesn’t make it clear that you should run setsdkenv_unix.sh first (to create the environment vars that puno and the SDK needs) and then start apache. The article does say “Remember, under ./setsdkenv_unix!” but it is not clear what this means, and anyway it’s the wrong script name. The script to run is “setsdkenv_unix.sh”.
I also found another post from Andre here, which was extremely helpful. It describes firstly how to find this script, and secondly how to modify your apache config to automatically run this script every time apache starts.
Thank you very much Andre, your detailed posts have really helped me!!