Issue 24142 - FreeBSD support in ODK
Summary: FreeBSD support in ODK
Status: CLOSED FIXED
Alias: None
Product: porting
Classification: Code
Component: code (show other issues)
Version: current
Hardware: Other FreeBSD
: P3 Trivial (vote)
Target Milestone: OOo 2.0
Assignee: jsc
QA Contact: issues@porting
URL:
Keywords:
Depends on:
Blocks: 18060 40187
  Show dependency tree
 
Reported: 2004-01-06 17:33 UTC by pavel
Modified: 2005-02-15 15:27 UTC (History)
2 users (show)

See Also:
Issue Type: TASK
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
draft of patch-odk+settings+settings.mk (1.77 KB, patch)
2004-01-19 15:32 UTC, maho.nakata
no flags Details | Diff
Add FreeBSD case to setsdk... (1.10 KB, patch)
2004-01-25 17:44 UTC, pavel
no flags Details | Diff
support thread related flags for settings.mk (1.82 KB, patch)
2004-02-02 12:09 UTC, maho.nakata
no flags Details | Diff
better FreeBSD support. actually working. (2.48 KB, patch)
2005-01-20 06:53 UTC, maho.nakata
no flags Details | Diff
the place if ] is wrong. a white space is needed (578 bytes, patch)
2005-01-23 09:57 UTC, maho.nakata
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description pavel 2004-01-06 17:33:13 UTC
Fix odk/settings/settings.mk to add FreeBSD case.
Comment 1 maho.nakata 2004-01-19 15:32:43 UTC
Created attachment 12572 [details]
draft of patch-odk+settings+settings.mk
Comment 2 pavel 2004-01-25 17:39:40 UTC
maho: this is probably not enough, because:

- I need to add -pthread to

pavel@leda:~/OpenOffice.org1.1_SDK/examples/cpp/DocumentLoader> gcc -Wl
-L../../../FREEBSDexample.out/lib -L../../../FreeBSD/lib
-L/home/pavel/OpenOffice.org1.1.1/program -o
../../../FREEBSDexample.out/bin/DocumentLoader
../../../FREEBSDexample.out/obj/DocumentLoader/DocumentLoader.o  
-lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc

- setsdkenv_unix.in does not contain FreeBSD case, see odk/
setsdkenv_unix.in

Otherwise SDK works perfectly. How do we solve PTHREAD issue? Something similar
like in configure.in?
Comment 3 pavel 2004-01-25 17:44:30 UTC
Created attachment 12715 [details]
Add FreeBSD case to setsdk...
Comment 4 maho.nakata 2004-01-26 12:16:07 UTC
thanks pjanik,

for thread safty, we need -pthread or -lc_r when linking.
please see /usr/ports/Mk/bsd.port.mk

.if ${OSVERSION} < 500016
PTHREAD_CFLAGS= -D_THREAD_SAFE
PTHREAD_LIBS=           -pthread
.else
PTHREAD_CFLAGS= -D_THREAD_SAFE
PTHREAD_LIBS=           -lc_r
.endif

we pass this when configureing:
CONFIGURE_ENV=          PTHREAD_CFLAGS=${PTHREAD_CFLAGS} \
                        PTHREAD_LIBS=${PTHREAD_LIBS}
Comment 5 pavel 2004-02-01 10:21:38 UTC
So we should add those settings to patch-odk+settings+settings.mk. Will you do that?
Comment 6 maho.nakata 2004-02-01 23:03:43 UTC
Thanks pjanik, how are you?
anyway I cannot commit by myself, so please do it...
Comment 7 maho.nakata 2004-02-02 12:09:02 UTC
Created attachment 12835 [details]
support thread related flags for settings.mk
Comment 8 maho.nakata 2004-02-02 12:09:47 UTC
sorry i misunderstood.
attached improved patch.
thanks.
Comment 9 pavel 2004-02-02 18:07:08 UTC
Thanks for updated patch, but please consider that SDK is used separately out of
the solver - thus you muset define PTHREADS_* first:

pavel@leda:~/OpenOffice.org1.1_SDK> grep -r PTHREAD_CFLAGS *
pavel@leda:~/OpenOffice.org1.1_SDK> 
Comment 10 pavel 2004-03-22 21:37:36 UTC
Maho: are patches complete? I'd like to merge them in early 1.1.2 cws.
Comment 11 maho.nakata 2004-03-28 11:54:16 UTC
maho->pjanik
No. in FreeBSD port, I manually replace using sed...
Comment 12 pavel 2004-06-05 21:29:26 UTC
Please provide full patch. I currently do not have working FreeBSD machine to test.
Comment 13 maho.nakata 2004-06-08 12:56:09 UTC
pjanik:
would you please give me some clue, how to pass pthread related
flags (PTHREAD_CFLAGS) to odk/settings/settings.mk?
in the frame work of ports, we hardcode these flags
according to PTHREAD_FLAGS defined at /usr/ports/Mk/bsd.port.mk

thank you very much
Comment 14 pavel 2004-06-10 18:57:21 UTC
jsc: for you. I do not know how to solve this.
Comment 15 jsc 2004-06-15 08:37:11 UTC
i would like to add an additonal section like the following in the settings.mk

.if ${OSVERSION} < 500016
PTHREAD_CFLAGS= -D_THREAD_SAFE
PTHREAD_LIBS=           -pthread
PTHREAD_LIBPATH= -L$(PTHREAD_HOME)/....
.else
PTHREAD_CFLAGS= -D_THREAD_SAFE
PTHREAD_LIBS=           -lc_r
PTHREAD_LIBPATH= -L$(PTHREAD_HOME)/....
.endif

PTHREAD_HOME should be configured during the configure procedure of the SDK. So
there are two open questions.
- Which call is used to get the OSVERSION?
- When i have the pthread home directory, in which sub directory can i find the
necessary libraries?
Comment 16 jsc 2004-06-15 08:47:57 UTC
accepted
Comment 17 maho.nakata 2004-06-15 10:08:33 UTC
it is not a good idea to add .if ${OSVERSION} < 500016
in settings.mk since PTHREAD related flags are given at configure.
we have to maintain settings.mk as well, it makes situation a little bit
complicated.

o OSVERSION
in /usr/ports/Mk/bsd.port.subdir.mk 
.if !defined(OSVERSION)
.if exists(/sbin/sysctl)
OSVERSION!= /sbin/sysctl -n kern.osreldate
.else
OSVERSION!= /usr/sbin/sysctl -n kern.osreldate
.endif
.endif

o PTHREAD flags
.if ${OSVERSION} < 500016
PTHREAD_CFLAGS?=        -D_THREAD_SAFE
PTHREAD_LIBS?=          -pthread
.elif ${OSVERSION} < 502102
PTHREAD_CFLAGS?=        -D_THREAD_SAFE
PTHREAD_LIBS?=          -lc_r
.else
PTHREAD_CFLAGS?=
PTHREAD_LIBS?=          -lpthread
.endif

(so it is also double effort that this section exists at
${SRCROOT}/config_office/configure.in
        "FreeBSD")
                test_x=yes
                test_gtk=yes
                AC_MSG_CHECKING([the FreeBSD operating system release])
                if test -n "$with_os_version"; then
                        OSVERSION="$with_os_version"
                else
                        OSVERSION=`/sbin/sysctl -n kern.osreldate`
                fi
                AC_MSG_RESULT([found OSVERSION=$OSVERSION])
                PTHREAD_CFLAGS="-D_THREAD_SAFE"
                if test "$OSVERSION" -lt "500016"; then
                        PTHREAD_LIBS="-pthread"
                elif test "$OSVERSION" -lt "502102"; then
                        PTHREAD_LIBS="-lc_r"
                else 
                        PTHREAD_LIBS="-lpthread"
                fi
)
o When i have the pthread home directory
don't worry about -lpthread (/usr/lib) and -pthread (just a flag) -lc_r (/usr/lib)
Comment 18 jsc 2004-06-15 13:29:21 UTC
I need this info in the SKD because the SDK env is completely independent from
the normal office env.
Does it mean that i don't need the pthread home directory and that i don't need
a -L option?
Comment 19 maho.nakata 2004-06-15 13:38:18 UTC
> Does it mean that i don't need the pthread home directory and that i don't need
a -L option?

yes.
Comment 20 jsc 2004-06-15 14:45:25 UTC
see man gcc
-Ldir
Add directory dir to the list of directories to be searched for -l
Comment 21 maho.nakata 2004-06-15 14:53:10 UTC
sorry, this is japanese style of yes/no.
I mean we don't need -L option.
Comment 22 jsc 2004-06-15 15:09:39 UTC
sorry, it was my mistake. Your answer was clear but my last comment was
nonsense. I read and put my own comment in the wrong context ;-)
Comment 23 jsc 2004-06-16 12:38:56 UTC
fixed on cws sdksample. I can't really check it because i haven't a FreeBSD
machne. But i  have integrated your patch and have checked the used conditions.
So please test it if the cws is available in the master and let me know if
everything works.
Comment 24 jsc 2004-12-22 16:59:57 UTC
integrate patch
Comment 25 maho.nakata 2004-12-24 02:26:27 UTC
jsc:
what does it mean?
cws is nominated?
Comment 26 maho.nakata 2005-01-18 02:32:49 UTC
patch was confirmed on sdksample.
I'll test it (some fixes might be needed, though)
thank you very much
Comment 27 maho.nakata 2005-01-20 06:52:07 UTC
reopen.
souce with cws_src680_sdksample
doesn't work for FreeBSD. better patch is supplied against cws_src680_sdksample
thanks
Comment 28 maho.nakata 2005-01-20 06:53:50 UTC
Created attachment 21702 [details]
better FreeBSD support. actually working.
Comment 29 jsc 2005-01-20 08:18:19 UTC
integrate patch -> fixed

maho can you please verify this because i have no FreeBSD environment, thanks
Comment 30 maho.nakata 2005-01-20 08:39:45 UTC
jsc:
Index: odk/settings/settings.mk
===================================================================
RCS file: /cvs/api/odk/settings/settings.mk,v
retrieving revision 1.9.14.17
diff -u -r1.9.14.17 settings.mk
--- odk/settings/settings.mk    20 Jan 2005 08:20:31 -0000      1.9.14.17
+++ odk/settings/settings.mk    20 Jan 2005 08:39:25 -0000
@@ -477,9 +477,9 @@

 # -O is necessary for inlining (see gcc documentation)
 ifeq "$(DEBUG)" "yes"
-CC_FLAGS=-c -g -fpic -DPIC $(PTHREAD_CFLAGS)
+CC_FLAGS=-c -g -fPIC -DPIC $(PTHREAD_CFLAGS)
 else
-CC_FLAGS=-c -O -fpic -DPIC $(PTHREAD_CFLAGS)
+CC_FLAGS=-c -O -fPIC -DPIC $(PTHREAD_CFLAGS)
 endif

 SDK_JAVA_INCLUDES = -I$(OO_SDK_JAVA_HOME)/include
-I$(OO_SDK_JAVA_HOME)/include/freebsd

this part is missing. please commit.
thanks a lot.
Comment 31 maho.nakata 2005-01-23 09:56:33 UTC
reopen.
still
-    if [ $OSVERSION -lt 500016]
+    if [ $OSVERSION -lt 500016 ]
is not applied.
thanks!
Comment 32 maho.nakata 2005-01-23 09:57:33 UTC
Created attachment 21779 [details]
the place if ] is wrong. a white space is needed
Comment 33 maho.nakata 2005-01-23 09:58:15 UTC
opps, this is not reopened...
reopend.
Comment 34 jsc 2005-01-27 08:50:25 UTC
integrate patch -> fixed

maho can you please verify again
Comment 35 jsc 2005-01-31 13:58:30 UTC
set to verified,  the patches are integrated and i got the ok for this fix per
mail. We have two follow up task 41142 and 41147 which will be fixed independently
Comment 36 maho.nakata 2005-02-01 09:42:08 UTC
verified in cws sdksample
thank you very much!
Comment 37 jsc 2005-02-15 15:27:30 UTC
checked on master m78