Issue 65394

Summary: -pthreads option enables profiling in vcl
Product: porting Reporter: it46 <aep.it46>
Component: codeAssignee: hjs <hans-joachim.lankenau>
Status: CLOSED NOT_AN_OOO_ISSUE QA Contact: issues@porting <issues>
Severity: Trivial    
Priority: P3 CC: issues, jens-heiner.rechtien
Version: OOo 2.0.2   
Target Milestone: ---   
Hardware: PC   
OS: Solaris   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
pkgconfig .pc for gthread
none
solenv pkg_config (to disable gcc related flags) none

Description it46 2006-05-15 13:54:12 UTC
Building the gtk plug-in (vcl) in Solaris x86 and Sun Studio 10, the flag
"-pthread" creates "profiling code" as the compiler beleives is the option "-p"
 (profiling). 

The result is that the vcl_dflt_version.o object contains the symbol _mcount
that will result in an unresolved symbol during linking.

Have not find out the way to disable this option, removing -pthread solves the
problem. 

Same problem takes place when compiling the following files:
./unxsoli4.pro/misc/vcl_dflt_version.c
./unxsoli4.pro/misc/vclplug_gen_dflt_version.c
./unxsoli4.pro/misc/vclplug_dummy_dflt_version.c
./unxsoli4.pro/misc/vclplug_gtk_dflt_version.c

---

*****-pthreads*****  is marked. 
cc  -c -temp=/tmp -I.  -I. -I../inc -I../inc -I../unx/inc -I../unxsoli4.pro/inc
-I. -I/o3/BuildDir/ooo_OOB680_m5_src/solver/680/unxsoli4.pro/inc/dont_use_stl
-I/o3/BuildDir/ooo_OOB680_m5_src/solver/680/unxsoli4.pro/inc/external
-I/o3/BuildDir/ooo_OOB680_m5_src/solver/680/unxsoli4.pro/inc
-I/o3/BuildDir/ooo_OOB680_m5_src/solenv/unxsoli4/inc
-I/o3/BuildDir/ooo_OOB680_m5_src/solenv/inc -I/o3/BuildDir/ooo_OOB680_m5_src/res
-I/o3/BuildDir/ooo_OOB680_m5_src/solver/680/unxsoli4.pro/inc/dont_use_stl
-I/include -I/o3/BuildDir/ooo_OOB680_m5_src/solenv/inc/Xp31
-I/usr/jdk/j2sdk1.4.2_08/include -I/usr/jdk/j2sdk1.4.2_08/include/solaris
-I/usr/jdk/j2sdk1.4.2_08/include/native_threads/include     -I. -I../res -I.
-xarch=generic -xO3 -xspace   -xldscope=hidden -D_REENTRANT
-D_POSIX_PTHREAD_SEMANTICS *****-pthreads***** -I/usr/include/gtk-2.0
-I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo
-I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-xCC  -g -xs -KPIC -DSOLARIS -DUNX -DVCL -DC52 -DC52 -DINTEL -DCVER=C52
-D_USE_NAMESPACE -mt -D_PTHREADS -DSYSV -DSUN -DSUN4 -D_REENTRANT
-D_POSIX_PTHREAD_SEMANTICS -DSTLPORT_VERSION=400 -D__DMAKE -DUNIX
-DCPPU_ENV=sunpro5 -DSUPD=680 -DPRODUCT -DNDEBUG -DPRODUCT_FULL
-DOSL_DEBUG_LEVEL=0 -DOPTIMIZE -DEXCEPTIONS_OFF -DCUI -DSOLAR_JAVA
-DOOB680=OOB680 -DUSE_BUILTIN_RASTERIZER  -DVCL_DLLIMPLEMENTATION -DSHAREDLIB
-D_DLL_   -o ../unxsoli4.pro/slo/vcl_dflt_version.o
../unxsoli4.pro/misc/vcl_dflt_version.c
Comment 1 it46 2006-05-15 13:56:05 UTC
it46->hr
Adding hr, bug as part of the port to OpenSolaris
Comment 2 joachim.lingner 2006-05-15 15:13:08 UTC
.
Comment 3 philipp.lohmann 2006-05-15 15:25:49 UTC
pl->hjs: could you please have a look at this ? the -lpthread is not in vcl, i
guess it comes from unxsols4.mk or so.

As a side note: -I/o3/BuildDir/ooo_OOB680_m5_src/solenv/inc/Xp31 is out of date
since OOo 1.0, so i guess one can safely remove that one nowadays :-)
Comment 4 hjs 2006-05-15 17:32:35 UTC
-pthread is a gcc option. i couldn't find any usage of it for the sun compiler
in the OOB680 sources/environment. you may check "/usr/lib/pkgconfig/*" on your
machine for it. might be a compiler (gcc) switch taken from the package info for
gtk - of cause not really matching your compiler.
Comment 5 it46 2006-05-15 17:55:21 UTC
it46->hjs

Confirmed, the C flag is introduced by: 
Name: GThread
Description: Thread support for GLib
Requires: glib-2.0
Version: 2.10.2
Libs: -L${libdir} -lgthread-2.0 -pthreads -lrt
Cflags: -pthreads <------- Cflags

What is the best way to create a patch for this?

----------------
Commenting the Cflags solve the problem:

CC  -c -temp=/tmp -I.  -I. -I../inc -I../inc -I../unx/inc -I../unxsoli4.pro/inc
-I. -I/o3/BuildDir/ooo_OOB680_m5_src/solver/680/unxsoli4.pro/inc/stl
-I/o3/BuildDir/ooo_OOB680_m5_src/solver/680/unxsoli4.pro/inc/external
-I/o3/BuildDir/ooo_OOB680_m5_src/solver/680/unxsoli4.pro/inc
-I/o3/BuildDir/ooo_OOB680_m5_src/solenv/unxsoli4/inc
-I/o3/BuildDir/ooo_OOB680_m5_src/solenv/inc -I/o3/BuildDir/ooo_OOB680_m5_src/res
-I/o3/BuildDir/ooo_OOB680_m5_src/solver/680/unxsoli4.pro/inc/stl -I/include
-I/o3/BuildDir/ooo_OOB680_m5_src/solenv/inc/Xp31
-I/usr/jdk/j2sdk1.4.2_08/include -I/usr/jdk/j2sdk1.4.2_08/include/solaris
-I/usr/jdk/j2sdk1.4.2_08/include/native_threads/include     -I. -I../res -I.
-xarch=generic -xO3 -xspace   -xldscope=hidden -D_REENTRANT
-D_POSIX_PTHREAD_SEMANTICS -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -features=no%altspell
-library=no%Cstd  -g0 -xs -noex   -KPIC -DSOLARIS -DUNX -DVCL -DC52 -DC52
-DINTEL -DCVER=C52 -D_USE_NAMESPACE -mt -D_PTHREADS -DSYSV -DSUN -DSUN4
-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DSTLPORT_VERSION=400 -D__DMAKE -DUNIX
-DCPPU_ENV=sunpro5 -DSUPD=680 -DPRODUCT -DNDEBUG -DPRODUCT_FULL
-DOSL_DEBUG_LEVEL=0 -DOPTIMIZE -DEXCEPTIONS_OFF -DCUI -DSOLAR_JAVA
-DOOB680=OOB680 -DUSE_BUILTIN_RASTERIZER  -DVCL_DLLIMPLEMENTATION -DSHAREDLIB
-D_DLL_ -DMULTITHREAD  -o ../unxsoli4.pro/slo/vcl_dflt_description.o
../unxsoli4.pro/misc/vcl_dflt_description.cxx
adjustvisibility -p ../unxsoli4.pro/slo/vcl_dflt_description.o
Comment 6 hjs 2006-05-16 11:55:37 UTC
i'm not sure. one place could be "solenv/inc/pkg_config.mk" to filter out gcc
related switches for the sun compiler. would you mind to attach the related
packageinof file?
Comment 7 it46 2006-05-16 12:13:10 UTC
it46->hjs
In my distro 
/usr/lib/pkgconfig/gthread-2.0.pc is provided by libglib2.0-dev

Two files attached, the pkgconfig .pc for gthread and solenv/inc/pkg_config.mk
Not sure if that is the files you refer to
Comment 8 it46 2006-05-16 12:19:23 UTC
Created attachment 36517 [details]
pkgconfig .pc for gthread
Comment 9 it46 2006-05-16 12:20:23 UTC
Created attachment 36518 [details]
solenv pkg_config (to disable gcc related flags)
Comment 10 hjs 2006-05-16 12:56:39 UTC
"solenv/inc/pkg_config.mk" is the place where the workaround (filtering switches).

e.g.

.IF <your_special case>
CFLAGS+=$(PKGCONFIG_CFLAGS:s/string_to_filter//)
.ELSE
CFLAGS+=...
.ENDIF

anyway i'm not sure if the problem of "incompatible" packageinfo is solvable
this way in the long run.
Comment 11 hjs 2006-05-23 12:41:16 UTC
not an OOo code problem
Comment 12 hjs 2006-05-23 12:41:51 UTC
.