linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] um: link with -lpthread
@ 2015-12-31 16:06 Vegard Nossum
  2015-12-31 16:21 ` [uml-devel] " Thomas Meyer
  2016-01-10 20:13 ` Richard Weinberger
  0 siblings, 2 replies; 4+ messages in thread
From: Vegard Nossum @ 2015-12-31 16:06 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Lorenzo Colitti, user-mode-linux-devel, linux-kernel,
	Vegard Nossum

Similarly to commit fb1770aa78a43530940d0c2dd161e77bc705bdac, with gcc 5
on Ubuntu and CONFIG_STATIC_LINK=y I was seeing these linker errors:

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/librt.a(timer_create.o): In function `__timer_create_new':
(.text+0xcd): undefined reference to `pthread_once'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/librt.a(timer_create.o): In function `__timer_create_new':
(.text+0x126): undefined reference to `pthread_attr_init'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/librt.a(timer_create.o): In function `__timer_create_new':
(.text+0x168): undefined reference to `pthread_attr_setdetachstate'
[...]

Obviously we also need -lpthread for librt.a.

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
 scripts/link-vmlinux.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index dacf71a..ba6c34e 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -62,7 +62,7 @@ vmlinux_link()
 			-Wl,--start-group                                    \
 				 ${KBUILD_VMLINUX_MAIN}                      \
 			-Wl,--end-group                                      \
-			-lutil -lrt ${1}
+			-lutil -lrt -lpthread ${1}
 		rm -f linux
 	fi
 }
-- 
1.9.1


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

* Re: [uml-devel] [PATCH] um: link with -lpthread
  2015-12-31 16:06 [PATCH] um: link with -lpthread Vegard Nossum
@ 2015-12-31 16:21 ` Thomas Meyer
  2015-12-31 16:41   ` Richard Weinberger
  2016-01-10 20:13 ` Richard Weinberger
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Meyer @ 2015-12-31 16:21 UTC (permalink / raw)
  To: Vegard Nossum; +Cc: linux-kernel, user-mode-linux-devel, Richard Weinberger

Am 31.12.2015 5:06 nachm. schrieb Vegard Nossum <vegard.nossum@oracle.com>:
>
> Similarly to commit fb1770aa78a43530940d0c2dd161e77bc705bdac, with gcc 5 
> on Ubuntu and CONFIG_STATIC_LINK=y I was seeing these linker errors: 

Hi,

Oops, yes this patch looks good to me. Honestly I did never test the static link case. Sorry.

With kind regards
Thomas

>
> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/librt.a(timer_create.o): In function `__timer_create_new': 
> (.text+0xcd): undefined reference to `pthread_once' 
> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/librt.a(timer_create.o): In function `__timer_create_new': 
> (.text+0x126): undefined reference to `pthread_attr_init' 
> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/librt.a(timer_create.o): In function `__timer_create_new': 
> (.text+0x168): undefined reference to `pthread_attr_setdetachstate' 
> [...] 
>
> Obviously we also need -lpthread for librt.a. 
>
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com> 
> --- 
> scripts/link-vmlinux.sh | 2 +- 
> 1 file changed, 1 insertion(+), 1 deletion(-) 
>
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh 
> index dacf71a..ba6c34e 100755 
> --- a/scripts/link-vmlinux.sh 
> +++ b/scripts/link-vmlinux.sh 
> @@ -62,7 +62,7 @@ vmlinux_link() 
> -Wl,--start-group                                    \ 
> ${KBUILD_VMLINUX_MAIN}                      \ 
> -Wl,--end-group                                      \ 
> - -lutil -lrt ${1} 
> + -lutil -lrt -lpthread ${1} 
> rm -f linux 
> fi 
> } 
> -- 
> 1.9.1 
>
>
> ------------------------------------------------------------------------------ 
> _______________________________________________ 
> User-mode-linux-devel mailing list 
> User-mode-linux-devel@lists.sourceforge.net 
> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel 

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

* Re: [uml-devel] [PATCH] um: link with -lpthread
  2015-12-31 16:21 ` [uml-devel] " Thomas Meyer
@ 2015-12-31 16:41   ` Richard Weinberger
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Weinberger @ 2015-12-31 16:41 UTC (permalink / raw)
  To: Thomas Meyer, Vegard Nossum; +Cc: linux-kernel, user-mode-linux-devel

Am 31.12.2015 um 17:21 schrieb Thomas Meyer:
> Am 31.12.2015 5:06 nachm. schrieb Vegard Nossum <vegard.nossum@oracle.com>:
>>
>> Similarly to commit fb1770aa78a43530940d0c2dd161e77bc705bdac, with gcc 5 
>> on Ubuntu and CONFIG_STATIC_LINK=y I was seeing these linker errors: 
> 
> Hi,
> 
> Oops, yes this patch looks good to me. Honestly I did never test the static link case. Sorry.

Thanks for fixing this.
I'm back from being MIA and start collecting patches soon.

Thanks,
//richard

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

* Re: [PATCH] um: link with -lpthread
  2015-12-31 16:06 [PATCH] um: link with -lpthread Vegard Nossum
  2015-12-31 16:21 ` [uml-devel] " Thomas Meyer
@ 2016-01-10 20:13 ` Richard Weinberger
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Weinberger @ 2016-01-10 20:13 UTC (permalink / raw)
  To: Vegard Nossum; +Cc: Lorenzo Colitti, user-mode-linux-devel, linux-kernel

Am 31.12.2015 um 17:06 schrieb Vegard Nossum:
> Similarly to commit fb1770aa78a43530940d0c2dd161e77bc705bdac, with gcc 5
> on Ubuntu and CONFIG_STATIC_LINK=y I was seeing these linker errors:
> 
> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/librt.a(timer_create.o): In function `__timer_create_new':
> (.text+0xcd): undefined reference to `pthread_once'
> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/librt.a(timer_create.o): In function `__timer_create_new':
> (.text+0x126): undefined reference to `pthread_attr_init'
> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/librt.a(timer_create.o): In function `__timer_create_new':
> (.text+0x168): undefined reference to `pthread_attr_setdetachstate'
> [...]
> 
> Obviously we also need -lpthread for librt.a.
> 
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>

Applied!

Thanks,
//richard


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

end of thread, other threads:[~2016-01-10 20:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-31 16:06 [PATCH] um: link with -lpthread Vegard Nossum
2015-12-31 16:21 ` [uml-devel] " Thomas Meyer
2015-12-31 16:41   ` Richard Weinberger
2016-01-10 20:13 ` Richard Weinberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).