Difference between revisions of "SDKInstallation"

From Apache OpenOffice Wiki
Jump to: navigation, search
 
(Installing with the free MS Visual C++ Toolkit 2003)
Line 49: Line 49:
 
I have downloaded the free Visual C++ Toolkit 2003 here :
 
I have downloaded the free Visual C++ Toolkit 2003 here :
 
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&displaylang=en
 
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&displaylang=en
 +
 
and then I have installed it.
 
and then I have installed it.
  
 
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat
 
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat
 
which asks any questions :
 
which asks any questions :
 +
<pre>
 +
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK
 +
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0
 +
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin
 +
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin
 +
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03
 +
</pre>
 +
 +
and I am ready to launch setsdkenv_windows.bat
 +
 +
I have modified the following file :
 +
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx
 +
to change the port accordingly to what OOo is listening.
 +
 +
I have modified the makefile :
 +
added :
 +
<pre>
 +
CC_INCLUDES = -I"C:\Program Files\Microsoft Visual C++ Toolkit 2003\include" \
 +
              -I"C:\openoffice\OpenOffice.org2.0_SDK\include"
 +
</pre>
 +
 +
and added libraries too :
 +
 +
<pre>
 +
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)
 +
-$(MKDIR) $(subst /,$(PS),$(@D))
 +
-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
 +
ifeq "$(OS)" "WIN"
 +
$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \
 +
$< $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\
 +
      "C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib" \
 +
      "C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib" \
 +
      "C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib" \
 +
"C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib"
 +
else
 +
$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $< \
 +
  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)
 +
endif
 +
</pre>
 +
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++.
 +
 +
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :
 +
Put :
 +
<pre>
 +
REM Set environment for C++ compiler tools, if necessary.
 +
if defined OO_SDK_CPP_HOME call "C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat"
 +
</pre>
 +
 +
instead of :
 +
<pre>
 +
REM Set environment for C++ compiler tools, if necessary.
 +
if defined OO_SDK_CPP_HOME call "%OO_SDK_CPP_HOME%\VCVARS32.bat"
 +
</pre>
 +
I think
 +
<pre>
 +
%OO_SDK_CPP_HOME%\..\VCVARS32.bat
 +
</pre>
 +
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME%
 +
("C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin" for me).

Revision as of 14:53, 13 May 2006

How to install the SDK and compile the C++ examples

For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:

  • you need to have OpenOffice.org 1.1.0 or higher installed (SDK won't run without it)
  • you need to install the SDK into a directory other than the one of the OOo application

Installation under LINUX

The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0

The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. Even if you don't plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK) Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential. When ready, launch :

tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz

and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :

  • where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted <Ooo> later)
  • Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)

Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automate this is not a problem under UNIX.

From now on, we will always note the SDK directory installation as : <OpenOffice.org1.1_SDK>. Please don't confuse with <Ooo> which is the openoffice.org /program/ directory.

You can find a little complement of this chapter in <OpenOffice.org1.1_SDK>/docs/install.html

Installation under Windows

You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows). The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK. If that has been done you have already installed everything, but *wait* one very important thing you should still know of: Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be "Shell prepared for SDK". Happy coding, compiling and building now (I tell you it's easy from now on!). GanescuCarmen describes some problems he encounter when trying SDK examples under Windows : “I also use the 1.1 OO version.

I had a lots of problems. Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. It was very hard to understand what it means registry(the rdb file not the Registry itself).

I was expecting to register something in Registry but it wasn't like this. And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. I had to modify a file and to add some code for 8100 port.

But I did it and it works now.”

Installing with the free MS Visual C++ Toolkit 2003

I have installed DevCpp to have a make executable file. I have downloaded the free Visual C++ Toolkit 2003 here : http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&displaylang=en

and then I have installed it.

I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat which asks any questions :

set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03

and I am ready to launch setsdkenv_windows.bat

I have modified the following file : C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx to change the port accordingly to what OOo is listening.

I have modified the makefile : added :

CC_INCLUDES = -I"C:\Program Files\Microsoft Visual C++ Toolkit 2003\include" \
              -I"C:\openoffice\OpenOffice.org2.0_SDK\include"

and added libraries too :

$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)
	-$(MKDIR) $(subst /,$(PS),$(@D))
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
ifeq "$(OS)" "WIN"
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \
	 $< $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\
       "C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib" \
       "C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib" \
       "C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib" \
	 "C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib" 
else
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $< \
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)
endif

I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++.

I find a solution of the previous problem three weeks later. My problem comes in fact from a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications : Put :

REM Set environment for C++ compiler tools, if necessary.
if defined OO_SDK_CPP_HOME call "C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat"

instead of :

REM Set environment for C++ compiler tools, if necessary.
if defined OO_SDK_CPP_HOME call "%OO_SDK_CPP_HOME%\VCVARS32.bat"

I think

 
%OO_SDK_CPP_HOME%\..\VCVARS32.bat

could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% ("C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin" for me).

Personal tools