mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Wangnan (F)" <wangnan0@huawei.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: <acme@kernel.org>, <jolsa@kernel.org>, <namhyung@kernel.or>,
	<lizefan@huawei.com>, <pi3orama@163.com>,
	<linux-kernel@vger.kernel.org>,
	Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config
Date: Mon, 11 Jan 2016 17:50:21 +0800	[thread overview]
Message-ID: <56937ADD.3050006@huawei.com> (raw)
In-Reply-To: <56937977.1040203@huawei.com>



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.

  reply	other threads:[~2016-01-11  9:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08 14:23 [PATCH 0/6] perf tools: Improve 'make build-test' Wang Nan
2016-01-08 14:23 ` [PATCH 1/6] perf tools: Add -lutil in python lib list for broken python-config Wang Nan
2016-01-11  9:28   ` Jiri Olsa
2016-01-11  9:44     ` Wangnan (F)
2016-01-11  9:50       ` Wangnan (F) [this message]
2016-01-12  9:41         ` Jiri Olsa
2016-01-08 14:23 ` [PATCH 2/6] perf tools: Add missing headers in perf's MANIFEST Wang Nan
2016-01-09 16:37   ` [tip:perf/core] perf tools: Add missing headers in perf' s MANIFEST tip-bot for Wang Nan
2016-01-11  9:43   ` [PATCH] perf tools: Add missing sources in perf's MANIFEST Jiri Olsa
2016-01-11  9:46     ` Wangnan (F)
2016-01-11 14:12       ` Arnaldo Carvalho de Melo
2016-01-08 14:23 ` [PATCH 3/6] perf tools: Fix phony build target for build-test Wang Nan
2016-01-11  9:29   ` Jiri Olsa
2016-01-08 14:23 ` [PATCH 4/6] perf tools: Set parallel making options build-test Wang Nan
2016-01-11  9:38   ` Jiri Olsa
2016-01-08 14:24 ` [PATCH 5/6] perf tools: Pass O option to Makefile.perf in build-test Wang Nan
2016-01-08 14:24 ` [PATCH 6/6] perf tools: Test correct path of perf " Wang Nan
2016-01-08 14:32 ` [PATCH 0/6] perf tools: Improve 'make build-test' Arnaldo Carvalho de Melo
2016-01-11  2:55   ` Wangnan (F)
2016-01-11  8:46     ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56937ADD.3050006@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=acme@kernel.org \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=namhyung@kernel.or \
    --cc=namhyung@kernel.org \
    --cc=pi3orama@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome