Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1304603 > unrolled thread
| Started by | Wang Nan <wangnan0@huawei.com> |
|---|---|
| First post | 2016-01-08 15:30 +0100 |
| Last post | 2016-01-12 10:50 +0100 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config Wang Nan <wangnan0@huawei.com> - 2016-01-08 15:30 +0100
Re: [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config Jiri Olsa <jolsa@redhat.com> - 2016-01-11 10:30 +0100
Re: [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config "Wangnan (F)" <wangnan0@huawei.com> - 2016-01-11 10:50 +0100
Re: [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config "Wangnan (F)" <wangnan0@huawei.com> - 2016-01-11 11:00 +0100
Re: [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config Jiri Olsa <jolsa@redhat.com> - 2016-01-12 10:50 +0100
| From | Wang Nan <wangnan0@huawei.com> |
|---|---|
| Date | 2016-01-08 15:30 +0100 |
| Subject | [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config |
| Message-ID | <qOGdc-7Wi-11@gated-at.bofh.it> |
On some system the perf-config is broken, causes link failure like this:
/usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_forkpty':
/opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3816: undefined reference to `forkpty'
/usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_openpty':
/opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3756: undefined reference to `openpty'
collect2: error: ld returned 1 exit status
make[1]: *** [/home/wangnan/kernel-hydrogen/tools/perf/out/perf] Error 1
make: *** [all] Error 2
$ python-config --libs
-lpthread -ldl -lpthread -lutil -lm -lpython2.7
In this case a '-lutil' should be appended to -lpython2.7.
(I know we have --start-group and --end-group. I can see them in
command line of collect2 by strace. However it doesn't work. Seems
I have a broken environment?)
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/config/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 18b2f96..603ddb4 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -493,7 +493,7 @@ else
PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
- PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
+ PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
--
1.8.3.4
[toc] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2016-01-11 10:30 +0100 |
| Subject | Re: [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config |
| Message-ID | <qPGXw-mu-11@gated-at.bofh.it> |
| In reply to | #1304603 |
On Fri, Jan 08, 2016 at 02:23:56PM +0000, Wang Nan wrote: > On some system the perf-config is broken, causes link failure like this: > > /usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_forkpty': > /opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3816: undefined reference to `forkpty' > /usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_openpty': > /opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3756: undefined reference to `openpty' > collect2: error: ld returned 1 exit status > make[1]: *** [/home/wangnan/kernel-hydrogen/tools/perf/out/perf] Error 1 > make: *** [all] Error 2 > > $ python-config --libs > -lpthread -ldl -lpthread -lutil -lm -lpython2.7 so your 'python-config --libs' shows -lutil and you still get the build failure? after your fix I can see double -lutil in PYTHON_EMBED_LIBADD, which is probably not a problem but could be ommited I think > > In this case a '-lutil' should be appended to -lpython2.7. > > (I know we have --start-group and --end-group. I can see them in > command line of collect2 by strace. However it doesn't work. Seems > I have a broken environment?) hum, how is this related to start/end -group options? thanks, jirka
[toc] | [prev] | [next] | [standalone]
| From | "Wangnan (F)" <wangnan0@huawei.com> |
|---|---|
| Date | 2016-01-11 10:50 +0100 |
| Subject | Re: [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config |
| Message-ID | <qPHgS-v6-33@gated-at.bofh.it> |
| In reply to | #1305974 |
On 2016/1/11 17:28, Jiri Olsa wrote:
> On Fri, Jan 08, 2016 at 02:23:56PM +0000, Wang Nan wrote:
>> On some system the perf-config is broken, causes link failure like this:
>>
>> /usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_forkpty':
>> /opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3816: undefined reference to `forkpty'
>> /usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_openpty':
>> /opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3756: undefined reference to `openpty'
>> collect2: error: ld returned 1 exit status
>> make[1]: *** [/home/wangnan/kernel-hydrogen/tools/perf/out/perf] Error 1
>> make: *** [all] Error 2
>>
>> $ python-config --libs
>> -lpthread -ldl -lpthread -lutil -lm -lpython2.7
> so your 'python-config --libs' shows -lutil and you still get the build failure?
>
> after your fix I can see double -lutil in PYTHON_EMBED_LIBADD,
> which is probably not a problem but could be ommited I think
In my python-config:
# python-config
-lpthread -ldl -lpthread -lutil -lm -lpython2.7
There are multiple -lpthread already. In fact multiple '-l' options is not
a problem at all. Please see below.
>> In this case a '-lutil' should be appended to -lpython2.7.
>>
>> (I know we have --start-group and --end-group. I can see them in
>> command line of collect2 by strace. However it doesn't work. Seems
>> I have a broken environment?)
> hum, how is this related to start/end -group options?
Please check man page of ld:
<quote>
--start-group archives --end-group
The archives should be a list of archive files. They may be either
explicit file names, or -l options.
The specified archives are searched repeatedly until no new
undefined references are created. Normally, an archive is searched only
once in the order that it is specified on the command line. If a symbol
in that archive is needed to resolve an undefined symbol referred to by
an object in an archive that appears later on the command line, the
linker would not be able to resolve that reference. By grouping the
archives, they all be searched repeatedly until all possible references
are resolved.
Using this option has a significant performance cost. It is best to
use it only when there are unavoidable circular references between two
or more archives.
</quote>
Without --start/end-group, if we provide -l in this order:
... -la -lb -lc ...
and libb.a requires a symbol in liba.a, link would fail. The simplest way
to avoid this is to add another -la after -lb:
... -la -lb -la -lc ...
In my environment it works as if we don't provide -Wl--start-group and
-Wl,--end-group.
I don't know why.
Thank you.
[toc] | [prev] | [next] | [standalone]
| From | "Wangnan (F)" <wangnan0@huawei.com> |
|---|---|
| Date | 2016-01-11 11:00 +0100 |
| Subject | Re: [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config |
| Message-ID | <qPHqA-yo-43@gated-at.bofh.it> |
| In reply to | #1305981 |
On 2016/1/11 17:44, Wangnan (F) wrote: > > > On 2016/1/11 17:28, Jiri Olsa wrote: >> On Fri, Jan 08, 2016 at 02:23:56PM +0000, Wang Nan wrote: >>> On some system the perf-config is broken, causes link failure like >>> this: >>> >>> /usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In >>> function `posix_forkpty': >>> /opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3816: >>> undefined reference to `forkpty' >>> /usr/lib64/python2.7/config/libpython2.7.a(posixmodule.o): In >>> function `posix_openpty': >>> /opt/wangnan/yocto-build/tmp-eglibc/work/x86_64-oe-linux/python/2.7.3-r0.3.1/Python-2.7.3/./Modules/posixmodule.c:3756: >>> undefined reference to `openpty' >>> collect2: error: ld returned 1 exit status >>> make[1]: *** [/home/wangnan/kernel-hydrogen/tools/perf/out/perf] >>> Error 1 >>> make: *** [all] Error 2 >>> >>> $ python-config --libs >>> -lpthread -ldl -lpthread -lutil -lm -lpython2.7 >> so your 'python-config --libs' shows -lutil and you still get the >> build failure? >> >> after your fix I can see double -lutil in PYTHON_EMBED_LIBADD, >> which is probably not a problem but could be ommited I think > > In my python-config: > > # python-config > -lpthread -ldl -lpthread -lutil -lm -lpython2.7 > > There are multiple -lpthread already. In fact multiple '-l' options is > not > a problem at all. Please see below. > >>> In this case a '-lutil' should be appended to -lpython2.7. >>> >>> (I know we have --start-group and --end-group. I can see them in >>> command line of collect2 by strace. However it doesn't work. Seems >>> I have a broken environment?) >> hum, how is this related to start/end -group options? > > Please check man page of ld: > > <quote> > --start-group archives --end-group > The archives should be a list of archive files. They may be either > explicit file names, or -l options. > > The specified archives are searched repeatedly until no new > undefined references are created. Normally, an archive is searched > only once in the order that it is specified on the command line. If a > symbol in that archive is needed to resolve an undefined symbol > referred to by an object in an archive that appears later on the > command line, the linker would not be able to resolve that reference. > By grouping the archives, they all be searched repeatedly until all > possible references are resolved. > > Using this option has a significant performance cost. It is best > to use it only when there are unavoidable circular references between > two or more archives. > </quote> > > Without --start/end-group, if we provide -l in this order: > > ... -la -lb -lc ... > > and libb.a requires a symbol in liba.a, link would fail. The simplest way > to avoid this is to add another -la after -lb: > > ... -la -lb -la -lc ... > > In my environment it works as if we don't provide -Wl,--start-group > and -Wl,--end-group. > I don't know why. > I mean the python case before I add -lutil after python libs. -Wl,--start-group and -Wl,--end-group seems not work for me. They are issued, I confirm this in strace output. Thank you. > Thank you.
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2016-01-12 10:50 +0100 |
| Subject | Re: [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config |
| Message-ID | <qQ3Kr-7vj-35@gated-at.bofh.it> |
| In reply to | #1306002 |
On Mon, Jan 11, 2016 at 05:50:21PM +0800, Wangnan (F) wrote: SNIP > > > > Using this option has a significant performance cost. It is best to > >use it only when there are unavoidable circular references between two or > >more archives. > ></quote> > > > >Without --start/end-group, if we provide -l in this order: > > > > ... -la -lb -lc ... > > > >and libb.a requires a symbol in liba.a, link would fail. The simplest way > >to avoid this is to add another -la after -lb: > > > > ... -la -lb -la -lc ... > > > >In my environment it works as if we don't provide -Wl,--start-group and > >-Wl,--end-group. > >I don't know why. > > > > I mean the python case before I add -lutil after python libs. > -Wl,--start-group and -Wl,--end-group > seems not work for me. They are issued, I confirm this in strace output. ok, got it.. I'm ok with the patch, there's no harm with extra lib, however I think you should report this to gcc folks also please resubmit the patch with the above comment, to make it clear why it's there thanks, jirka
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web