All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix static linking
@ 2015-12-08 14:40 Riku Voipio
  2015-12-11 19:50 ` Zdenek Kabelac
  0 siblings, 1 reply; 2+ messages in thread
From: Riku Voipio @ 2015-12-08 14:40 UTC (permalink / raw)
  To: lvm-devel

Static linking fails currently, as -lm and -lpthread are missing:

gcc -O2  -fPIC -O2  -L../libdm -L../lib -L../libdaemon/client -static
-L../libdm/ioctl \
      -o dmsetup.static dmsetup.o -ldevmapper    -lrt
../libdm/ioctl/libdevmapper.a(libdm-stats.o): In function
`dm_stats_create_region':
libdm-stats.c:(.text+0x2d69): undefined reference to `log10'
libdm-stats.c:(.text+0x2d6e): undefined reference to `lround'
../libdm/ioctl/libdevmapper.a(pool.o): In function `dm_pool_create':
pool.c:(.text+0x134): undefined reference to `pthread_mutex_lock'
pool.c:(.text+0x14f): undefined reference to `pthread_mutex_unlock'

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
 tools/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/Makefile.in b/tools/Makefile.in
index d6e54f0..518a21a 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -130,7 +130,7 @@ dmsetup: dmsetup.o $(top_builddir)/libdm/libdevmapper.$(LIB_SUFFIX)
 
 dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
 	$(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \
-	      -o $@ dmsetup.o -ldevmapper $(STATIC_LIBS) $(LIBS)
+	      -o $@ dmsetup.o -ldevmapper $(M_LIBS) $(PTHREAD_LIBS) $(STATIC_LIBS) $(LIBS)
 
 all: device-mapper
 
-- 
2.6.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] fix static linking
  2015-12-08 14:40 [PATCH] fix static linking Riku Voipio
@ 2015-12-11 19:50 ` Zdenek Kabelac
  0 siblings, 0 replies; 2+ messages in thread
From: Zdenek Kabelac @ 2015-12-11 19:50 UTC (permalink / raw)
  To: lvm-devel

Dne 8.12.2015 v 15:40 Riku Voipio napsal(a):
> Static linking fails currently, as -lm and -lpthread are missing:
>
> gcc -O2  -fPIC -O2  -L../libdm -L../lib -L../libdaemon/client -static
> -L../libdm/ioctl \
>        -o dmsetup.static dmsetup.o -ldevmapper    -lrt
> ../libdm/ioctl/libdevmapper.a(libdm-stats.o): In function
> `dm_stats_create_region':
> libdm-stats.c:(.text+0x2d69): undefined reference to `log10'
> libdm-stats.c:(.text+0x2d6e): undefined reference to `lround'
> ../libdm/ioctl/libdevmapper.a(pool.o): In function `dm_pool_create':
> pool.c:(.text+0x134): undefined reference to `pthread_mutex_lock'
> pool.c:(.text+0x14f): undefined reference to `pthread_mutex_unlock'
>
> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
> ---
>   tools/Makefile.in | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/Makefile.in b/tools/Makefile.in
> index d6e54f0..518a21a 100644
> --- a/tools/Makefile.in
> +++ b/tools/Makefile.in
> @@ -130,7 +130,7 @@ dmsetup: dmsetup.o $(top_builddir)/libdm/libdevmapper.$(LIB_SUFFIX)
>
>   dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
>   	$(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \
> -	      -o $@ dmsetup.o -ldevmapper $(STATIC_LIBS) $(LIBS)
> +	      -o $@ dmsetup.o -ldevmapper $(M_LIBS) $(PTHREAD_LIBS) $(STATIC_LIBS) $(LIBS)
>
>   all: device-mapper


Hi

Thanks for the patch.

I've pushed to upstream, but it's worth to note - static linking is currently 
not really supported - for many packages it's getting a bit complex to do 
linking right.

So for a very limited 'subset' of linked libs this may work, but ATM we
cannot really provide static linking for all combination of options.

I assume however you just need 'static'  dmsetup right ?

Regards

Zdenek



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-11 19:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-08 14:40 [PATCH] fix static linking Riku Voipio
2015-12-11 19:50 ` Zdenek Kabelac

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.