Bug 63331 - Fix Makefile.am _DEPENDENCIES for better parallel make support
Summary: Fix Makefile.am _DEPENDENCIES for better parallel make support
Status: RESOLVED WORKSFORME
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL: http://forums.gentoo.org/viewtopic-t-...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-09 18:04 UTC by Samuli Suominen
Modified: 2013-07-16 03:36 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
This patch works for me. (30.25 KB, text/plain)
2013-04-09 18:04 UTC, Samuli Suominen
Details

Description Samuli Suominen 2013-04-09 18:04:35 UTC
Created attachment 77683 [details]
This patch works for me.

Makefile.am doesn't have enough dependencies which makes the build racy when built using `make -j9` or other -j value. 

It's very hard to reproduce these. But they appear in _both_, full build and they appear even more if you build separate targets from Makefile, like if you want to build only some helper.

libtool: link: ( cd ".libs" && rm -f "libsystemd-id128-internal.la" && ln -s
"../libsystemd-id128-internal.la" "libsystemd-id128-internal.la" )
/bin/sh ./libtool  --tag=CC   --mode=link i686-pc-linux-gnu-gcc -std=gnu99
-pipe -Wall -Wextra -Wno-inline -Wundef -Wformat=2 -Wformat-security
-Wformat-nonliteral -Wlogical-op -Wsign-compare -Wmissing-include-dirs
-Wold-style-definition -Wpointer-arith -Winit-self
-Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes
-Wstrict-prototypes -Wredundant-decls -Wmissing-declarations
-Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing=2
-Wwrite-strings -Wno-long-long -Wno-overlength-strings -Wno-unused-parameter
-Wno-missing-field-initializers -Wno-unused-result -Werror=overflow
-ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing
-fvisibility=hidden -ffunction-sections -fdata-sections -fstack-protector
--param=ssp-buffer-size=4 -O2 -march=native -Wl,--as-needed -Wl,--gc-sections
-Wl,-z,relro -Wl,-z,now -Wl,-O1 -Wl,--as-needed -o collect
src/udev/collect/collect.o libudev-private.la -ldl -lrt
libtool: link: cannot find the library `libudev-private.la' or unhandled
argument `libudev-private.la'

or

libtool: link: x86_64-pc-linux-gnu-gcc -std=gnu99 -pipe -Wall -Wextra
-Wno-inline -Wundef -Wformat=2 -Wformat-security -Wformat-nonliteral
-Wlogical-op -Wsign-compare -Wmissing-include-dirs -Wold-style-definition
-Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal
-Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls
-Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align
-Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long -Wno-overlength-strings
-Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result
-Werror=overflow -ffast-math -fno-common -fdiagnostics-show-option
-fno-strict-aliasing -fvisibility=hidden -ffunction-sections -fdata-sections
-fstack-protector --param=ssp-buffer-size=4 -O2 -pipe -march=nocona
-Wl,--gc-sections -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-O1 -o ata_id
src/udev/ata_id/ata_id.o  -Wl,--as-needed ./.libs/libudev-private.a
./.libs/libsystemd-shared.a -ldl -lrt
libtool: link: cannot find the library `libudev.la' or unhandled argument
`libudev.la'
make: *** [v4l_id] Ошибка 1

So I ended up rereading the GNU automake manual about _DEPENDENCIES and this is the patch I came up with. It works for me and can be applied on today's git.
Comment 1 Samuli Suominen 2013-04-09 19:18:02 UTC
_DEPENDENCIES is _LDADD but without external deps like $(QRENCODE_LIBS)

and for the record, I'm using patched make and it doesn't make a difference:

http://lists.freedesktop.org/archives/systemd-devel/2013-February/008751.html

If the patch is wrong, what's wrong with it? 
How else does one specify "libfoobar.la must be built before bar_example_id"? Someone said this should have been automatic from _LDADD, but that's not what I'm seeing and many others either.

And reproducing can really be PITA, I can't reproduce any on this main box x86_64 with -j9 but I can with x86 using -j5, both using same GNU make with same patches
Comment 2 Zbigniew Jedrzejewski-Szmek 2013-04-10 00:59:16 UTC
I have (without your patch) in Makefile:
collect_DEPENDENCIES = libudev-private.la
...
collect$(EXEEXT): $(collect_OBJECTS) $(collect_DEPENDENCIES) $(EXTRA_collect_DEPENDENCIES) 
        @rm -f collect$(EXEEXT)
        $(AM_V_CCLD)$(LINK) $(collect_OBJECTS) $(collect_LDADD) $(LIBS)

What does your Makefile say?

Zbyszek
Comment 3 Zbigniew Jedrzejewski-Szmek 2013-04-10 01:44:59 UTC
Actually, it looks exactly the same in Makefile.in, so if the patch fixes things for you, then the problem must be somewhere in the automake step. What automake version are you using?
Comment 4 Zbigniew Jedrzejewski-Szmek 2013-07-16 03:25:35 UTC
Nobody seems to be reporting such issues now, and we often build with -j, so I'm assuming that this must have been bad luck or a bug somewhere else.
Comment 5 Samuli Suominen 2013-07-16 03:35:38 UTC
(In reply to comment #4)
> Nobody seems to be reporting such issues now, and we often build with -j, so
> I'm assuming that this must have been bad luck or a bug somewhere else.

sorry for the delay.   indeed, you are right, the patch in this bug is not required and doesn't solve anything.  my bad.

however i'm still having issues, which i've worked around by building some of the make targets separately early enough.   

it always boils down to the udev helpers, like v4l_id building before required libudev-private.la (or same with different udev helper and different internal library).

however, i don't have anything wise to say here now, like more info, so lets keep this closed.   sorry for the noise (for now :-)


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.