On Tue, 06/10 12:23, Rainer Müller wrote: > 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?
Good question. $(extract-libs) and $(expand-objs) are always used together, so I think we can drop it, together with the sort, hoping it works this time: diff --git a/rules.mak b/rules.mak index b12d312..1513b0f 100644 --- a/rules.mak +++ b/rules.mak @@ -23,8 +23,7 @@ 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))) expand-objs = $(strip $(sort $(filter %.o,$1)) \ $(foreach o,$(filter %.mo,$1),$($o-objs)) \ $(filter-out %.o %.mo,$1))