diff mbox

Problems compiling HEAD on Mac OS X 10.9.2

Message ID 20140606020418.GF10963@T430.nay.redhat.com
State New
Headers show

Commit Message

Fam Zheng June 6, 2014, 2:04 a.m. UTC
On Thu, 06/05 17:11, Peter Maydell wrote:
> On 5 June 2014 14:38, Rainer Müller <raimue@codingfarm.de> wrote:
> > On 2014-03-14 13:29, Paolo Bonzini wrote:
> >> Il 13/03/2014 19:48, Peter Maydell ha scritto:
> >>> Yep, here we are:
> >>> LIBSSH2_LIBS=-L/opt/local/lib -lssh2 -Wl,-headerpad_max_install_names
> >>> -arch x86_64
> >>> CURL_LIBS=-L/opt/local/lib -lcurl
> >>>
> >>> rules.mak is incorrectly reordering the contents of
> >>> these and generating a non-working mess.
> >>
> >> Fam,
> >>
> >> is the $(sort) actually necessary in extract-libs?  It is required in
> >> expand-objs, but duplicate -l options should be harmless.
> >
> > The current master still contains this bug and sorts "-arch x86_64"
> > separately. I doubt the $(sort) does anything useful.
> 
> Ugh. This was supposed to be fixed by commit 6295b98d7b767c.
> Fam, can you re-check your fix, please?
> 

I don't understand that fix now, looks like it was moved onto a wrong list.

Rainer, does this below patch work for you? (we can't duplicate object, so sort
is required there).

Fam

---

Comments

Rainer Müller June 10, 2014, 10:23 a.m. UTC | #1
On 2014-06-06 04:04, Fam Zheng wrote:
>> Ugh. This was supposed to be fixed by commit 6295b98d7b767c.
>> Fam, can you re-check your fix, please?
>>
> 
> I don't understand that fix now, looks like it was moved onto a wrong list.
> 
> Rainer, does this below patch work for you? (we can't duplicate object, so sort
> is required there).

No, unfortunately this does not work. With this patch, I end up with:

$ make V=1 qemu-img
...
... qemu-img.o qemu-io-cmds.o qemu-timer.o thread-pool.o libqemuutil.a libqemustub.a  -lz -L/opt/local/lib -lcurl -L/opt/local/lib -lssh2 -Wl,-headerpad_max_install_names -arch x86_64 -L/opt/local/lib -Wl,-headerpad_max_install_names -arch -lcurl -lssh2 -lz x86_64 -L/opt/local/lib -lgthread-2.0 -lglib-2.0 -lintl   -lz -lz
clang: error: no such file or directory: 'x86_64'
clang: error: invalid arch name '-arch -lcurl'
make: *** [qemu-img] Error 1


You really can't just sort the words as their order is important, at 
least for some options such as "-arch" and its argument.

From config-host.mak:

  LIBSSH2_LIBS=-L/opt/local/lib -lssh2 -Wl,-headerpad_max_install_names -arch x86_64

I don't understand the make function $(extract-libs) here. First the 
contents of $o-libs is added as-is, but then it is added again filtered 
through $(expand-objs). What is the purpose of adding it twice?

Regarding your proposed patch, it doesn't matter whether you sort the 
first list or the second list. Both lists include the problematic 
"-arch x86_64" linker option.

Rainer
Paolo Bonzini June 10, 2014, 11:19 a.m. UTC | #2
Il 10/06/2014 12:23, Rainer Müller ha scritto:
> You really can't just sort the words as their order is important, at
> least for some options such as "-arch" and its argument.
>
> From config-host.mak:
>
>   LIBSSH2_LIBS=-L/opt/local/lib -lssh2 -Wl,-headerpad_max_install_names -arch x86_64

While we should fix it in QEMU, this is a bug in MacPorts.

https://trac.macports.org/ticket/22747

You probably should report it and/or rebuild libssh2.

Paolo
diff mbox

Patch

diff --git a/rules.mak b/rules.mak
index b12d312..b895859 100644
--- a/rules.mak
+++ b/rules.mak
@@ -23,8 +23,8 @@  QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
 QEMU_INCLUDES += -I$(<D) -I$(@D)

 maybe-add = $(filter-out $1, $2) $1
-extract-libs = $(strip $(sort $(foreach o,$1,$($o-libs))) \
-                  $(foreach o,$(call expand-objs,$1),$($o-libs)))
+extract-libs = $(strip $(foreach o,$1,$($o-libs)) \
+                  $(sort $(foreach o,$(call expand-objs,$1),$($o-libs))))
 expand-objs = $(strip $(sort $(filter %.o,$1)) \
                   $(foreach o,$(filter %.mo,$1),$($o-objs)) \
                   $(filter-out %.o %.mo,$1))