Simultaneous pic and non-pic convenience libs [Was: [RFC] New library "type" needed?]

2007-03-31 Thread Charles Wilson

Charles Wilson wrote:



I'd still like to be able to build my convenience library as both pic 
and non-pic tho.  And I still want to prevent libiberty.a(non-pic) from 
getting the --whole-archive treatment when it comes to libbfd.a.

...

Several systems simply don't allow to mix PIC and non-PIC symbols.
On w32 this warning is pathetic, but on others we would have a problem
here.  (I can see why, on w32, you'd want to kill the warning here.)


No, you're missing the point of my statement: I *know* you don't want to 
mix pic and non-pic. 


After doing a bit of reading, the statements above are a little too 
strong.  It's not that you can't mix pic and non-pic (or at least, it's 
not obviously the case; we'll dig deeper -- see below).  At the surface 
level, it is simply that where -fpic/-fPIC makes a difference, you 
cannot include non-pic in a shared library.  However, there's no reason 
you can't include pic in a static library: you just lose a little 
efficiency (from the AutoBook)


"In practice, you can link PIC objects into a static archive for a small 
overhead in execution and load speed..."


e.g. shared << pic only
 static << pic and non-pic ok

Which I guess is why:  if pic available, libtool defaults to using pic 
objects in the convenience lib, unless specifically directed otherwise. 
 And yet, that same, single, convenience lib (which is pic) will be 
used when creating both static and shared libraries that depend on it.


Digging deeper:

On cygwin/mingw *at present*, the only difference between pic and 
non-pic is that the former objects were compiled with "-DPIC 
-DDLL_EXPORT".  This could cause trouble for convenience libs that are 
sensitive to DLL_EXPORT (and isn't that the point? otherwise, why bother 
to -D it?) -- because while the machine code is more-or-less the same 
(that is, gcc doesn't generate machine instructions differently _on its 
own_) -- some packages might behave differently _at the source code 
level_ due to the different -Ddefines


One example is libltdl itself, as we discovered a few months ago:

#if !defined(LT_SCOPE)
#  if defined(__WINDOWS__) || defined(__CYGWIN__)
#if defined(DLL_EXPORT)
#  define LT_SCOPE  extern __declspec(dllexport)
#endif
#if defined(LIBLTDL_DLL_IMPORT)
#  define LT_SCOPE  extern __declspec(dllimport)
#endif
#  endif
#  if !defined(LT_SCOPE)
#define LT_SCOPEextern
#  endif
#endif

So, we come full circle: now it's clear that the libtool assumption of 
"hey, if pic available, then just always use pic when building 
convenience libs (unless instructed otherwise via no-pic/--without-pic); 
that way, the result is "safe" for use regardless", breaks down on 
cygwin/mingw!


So, perhaps it really is time to revisit this assumption...see

Alexandre Oliva, February 2001 [ignoring the bits about "installable 
convenience libraries (??!!)]

http://sources.redhat.com/ml/automake/2001-02/msg00304.html
"And I wish convenience libraries could still come
in PIC and non-PIC versions, just like object files.  Currently, every
time you create a convenience archive, you don't get the non-PIC
objects, unless the PIC objects aren't available."

There's still some issues with convenience libs themselves (where the 
following discussion ignores ALL of the above, no new library types, no 
new -exclude-lib option), like:

 (a) we should build a pic version and stuff it inside .libs/ if
 -enable-shared, and put a regular version in . if -enable-static

...

 (b) When linking a shared lib where a convenience lib appears in the
 deps, use the one in the .libs/ directory
 (c) ??? when linking a PIE executable where a convenience lib appears
 in the deps, use the one in the .libs/ directory
 (d) when creating a static lib where a convenience lib appears in the
 deps, use the one in the . directory when doing the explode-and-
 incorporate thing.
 (e) when creating a next-level convenience lib that has THIS
 convenienece lib as a dep, again, create a pic version in .libs and
 a non-pic version in .  In each case, use the "matching" version of
 the dependency when doing the explode-and-incorporate thing.
 (f) In all other cases, use the "regular" lib

[replace 'explode-and-incorporate thing' with 'partial linking thing' if 
your platform supports it]


These improvements to "regular" convenience libraries are, IMO, 
necessary for proper operation where pic/no-pic makes a difference. 


And, as detailed above w.r.t. "-DDLL_EXPORT", even when -fpic itself 
makes no difference.


I tried to figure out what it would take to do the above, but the maze 
of twisty little passages all the same made my head hurt.  It *looks* 
like the build-a-convenience-lib codeflow "borrows" the "build an oldlib 
(e.g. static archive)" machinery, but jiggers with the list-of-objects. 
 If so, then this task will be rather tricky (I think), because the 
build-a-convenience-lib codeflow will need to be disentangled, so that 
it ha

Re: library versioning problem

2007-03-31 Thread Gary V. Vaughan

Hi Lucien,

On 30 Mar 2007, at 16:59, Lucien GENTIS wrote:

Gary V. Vaughan a écrit :

On 29 Mar 2007, at 15:48, Lucien GENTIS wrote:

Gary V. Vaughan a écrit :

On 26 Mar 2007, at 12:47, [EMAIL PROTECTED] wrote:

Quoting "Gary V. Vaughan" <[EMAIL PROTECTED]>:

On 25 Mar 2007, at 16:50, Lucien GENTIS wrote:

That means:
CURRENT is replaced by CURRENT - AGE  (69 - 38 = 31)
REVISION is replaced by AGE
AGE is replaced by REVISION


http://www.gnu.org/software/libtool/manual.html#Libtool- 
versioning


First thanks for your answer


No problem.

I've already red this doc, but it doesn't explain why current,  
revision and age number are changed


Sure it does.

You are confusing the *library* version with the *interface*  
version.  C:R:A
allows a developer to describe the interface version and  
compatibility details
for their library.  The soname and filename of the eventual  
library is an
implementation detail that depends how *library* versions work  
on the
particular OS you build on -- and will be different on Linux vs  
Windows vs

AIX vs HPUX etc

So under Linux, if Major=C-A, Minor=A, Micro=R, say I develope a  
library starting with 0.0.0:
According paragraph 6.3 of http://www.gnu.org/software/libtool/ 
manual.html,

Interfaces and library versions progress as follow:

[[snip]]

but Changing an interface modifies library version from 0.3.1 to  
1.3.0
and removing an interface modifies library version from 2.3.0 to  
6.0.0


Aren't library versions increasing a little too fast ?


Too fast for what?  Are you worried about running out of numbers? ;-)


I just thought about publishing "mylib-85.0.0"  (seems not very  
serious ;-))


Are you updating C:R:A every time you change/remove/add an  
interface?  In

that case you will get through numbers *very* quickly unless your API is
extremely stable.  The libtool documentation recommends that you only  
update

C:R:A just before each release.

Cheers,
Gary
--
  ())_.  Email me: [EMAIL PROTECTED]
  ( '/   Read my blog: http://blog.azazil.net
  / )= ...and my book: http://sources.redhat.com/autobook
`(_~)_ Join my AGLOCO Network: http://www.agloco.com/r/BBBS7912






PGP.sig
Description: This is a digitally signed message part
___
Bug-libtool mailing list
Bug-libtool@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-libtool


Re: Link error for blahS.c when used in multiple GCC environment.

2007-03-31 Thread Albert Chin
On Sat, Mar 31, 2007 at 11:53:12AM +1000, Brendon Costa wrote:
> Development GCC that i compile from GCC 4.0.1 sources:
> Version: 4.0.1
> Prefix: /home/bcosta/build/install_gcc
> libstdc++: /home/bcosta/build/install_gcc/lib/libstdc++.so
>   (libstdc++ version: 6.5)
> 
> When i want to build using the development GCC i do the following:
> 
> export PATH="/home/bcosta/build/install_gcc/bin:$PATH"
> export LD_LIBRARY_PATH="/home/bcosta/build/install_gcc/lib:$LD_LIBRARY_PATH"

What if you also set LDFLAGS="-L/home/bcosta/build/install_gcc/lib"?

-- 
albert chin ([EMAIL PROTECTED])


___
http://lists.gnu.org/mailman/listinfo/libtool