Hello Pedro,

On Sun, Nov 06, 2011 at 02:48:26PM -0800, Pedro Giffuni wrote:
> Ugh.. I'm still struggling with the BSD build, and
> apparently it should be simple but perhaps someone
> that knows well the build structure can give me a good hint:
> 
> =============
> Building module vcl
> =============
> 
> Entering /usr/ports/editors/openoffice.org-3-devel/work/ooo/main/vcl/prj
> 
> cd .. && gmake -s -r -j1 
> [ build LNK ] Library/libvcl.so

it would be useful to see the command g++ is invoked with to link the
library (remove the -s for silent).

Some background on what an "undefined reference" when linking means:

1) the linker was not told which libraries to link against 
   In this case:
   -licuuc --> libicuuc.so
   -licule --> libicule.so
   This is not the case, because this libraries are added in
   Library_vcl.mk gb_Library_add_linked_libs

2) the linker was not told where to find the libraries it links against,
     this is done with the -L option, like -L/usr/lib64

3) both (1) and (2) are needed at build time, at runtime the runtime
   linker must know the path where to search the libraries (see -rpath
   and -rpath-link in man ld)


> Going verbose just shows a lot of objects being linked
> but not ICU which is the missing piece.
> 
> Part of the problem is that I have to use some external
> libraries and this ends up catching the external ICU,
> but in any case there is --with-system-icu so this
> should be OK.
> 
> So ... how can I fix this?

if the external library is only used in one module, you can do it in
that module's makefile. See ENABLE_DBUS in vcl/Library_vclplug_gtk.mk

According to opengrok icu is used in vcl, sw, editeng, svx, svtools
fixing this per module is not reliable, so you have to tweak a more
general solution.

A possible solution is modifying gb_LinkTarget_LDFLAGS in
gbuild/platform/freebsd.mk (now that I read this file, there is an
issue: it assumes the default -rpath-link to be /lib:/usr/lib , this
will not work on 64 bit platforms, where it should be /lib64:/usr/lib64).
Fixing this may solve your problem *only if* icu libs are in /usr/lib64
on your system. You need also -L/usr/lib64 in that case.
Use icu-config to get the required flags for your system.

But notice that this is rather suboptimal, it will set that LDFLAGS for 
every module, even those that do not link against icu.

The optimal solution seems to be in cws gnumake4, see:
http://hg.services.openoffice.org/cws/gnumake4/rev/e86f5a26e982
http://hg.services.openoffice.org/cws/gnumake4/file/b3086537b169/RepositoryExternal.mk#l286

it introduces a function gb_Library_use_externals and a 
RepositoryExternal.mk
But AFAIK this cws was not ready for QA.

Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Attachment: pgpTAzhf74DbS.pgp
Description: PGP signature

Reply via email to