All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] ustr: Makefile fixes for link failures
@ 2016-05-25 14:52 Clayton Shotwell
  2016-05-25 15:16 ` Thomas Petazzoni
  0 siblings, 1 reply; 4+ messages in thread
From: Clayton Shotwell @ 2016-05-25 14:52 UTC (permalink / raw)
  To: buildroot

The ustr package is failing sometimes in the autobuilder at a target
install link step. This is an attempt to fix the issue by not allowing
make to ignore a failed remove call to remove the link before it is
created.

http://autobuild.buildroot.org/results/9e1/9e13c9779a84312bcb094604acfa6ec626697aa7
http://autobuild.buildroot.org/results/ceb/cebfd7e29a6521ae7ba4c229586a3ef662aa9de1

Signed-off-by: Clayton Shotwell <clayton.shotwell@rockwellcollins.com>
---
 package/ustr/0001-Makefile-force-removes.patch | 39 ++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 package/ustr/0001-Makefile-force-removes.patch

diff --git a/package/ustr/0001-Makefile-force-removes.patch b/package/ustr/0001-Makefile-force-removes.patch
new file mode 100644
index 0000000..f244ca7
--- /dev/null
+++ b/package/ustr/0001-Makefile-force-removes.patch
@@ -0,0 +1,39 @@
+Allowing the makefile to ignore remove failures is masking an issues on some
+builds that causes the subsequent link call to fail. This patch makes the
+remove a required step in an attempt to uncover the real issue. Either way
+the removes should be required since they should never fail with the -f flag.
+
+Signed-off-by: Clayton Shotwell <clayton.shotwell@rockwellcollins.com>
+
+--- a/Makefile.in	2016-05-23 08:46:46.337481574 -0500
++++ b/Makefile.in	2016-05-23 08:45:12.327380457 -0500
+@@ -425,11 +425,11 @@
+ 		@echo Installing files
+ 		install -m 644 -t $(DESTDIR)$(libdir) $(OPT_LIB_STATIC)
+ 		install -m 755 -t $(DESTDIR)$(libdir) $(OPT_LIB_SHARED)
+-		-rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHARED_NAME)
++		rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHARED_NAME)
+ 		ln -s $(OPT_LIB_SHARED) $(DESTDIR)$(libdir)/$(OPT_LIB_SHARED_NAME)
+-		-rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHAREDEV)
++		rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHAREDEV)
+ 		ln -s $(OPT_LIB_SHARED_NAME) $(DESTDIR)$(libdir)/$(OPT_LIB_SHAREDEV)
+-		-rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHAREDEV_BSO)
++		rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHAREDEV_BSO)
+ 		ln -s $(OPT_LIB_SHARED_NAME) $(DESTDIR)$(libdir)/$(OPT_LIB_SHAREDEV_BSO)
+ 		$(LDCONFIG) -n $(DESTDIR)$(libdir)
+ 		install -pm 644 -t $(DESTDIR)$(libdir)/pkgconfig ustr.pc
+@@ -438,11 +438,11 @@
+ 		@echo Installing files
+ 		install -m 644 -t $(DESTDIR)$(libdir) $(DBG_LIB_STATIC)
+ 		install -m 755 -t $(DESTDIR)$(libdir) $(DBG_LIB_SHARED)
+-		-rm -f $(DESTDIR)$(libdir)/$(DBG_LIB_SHARED_NAME)
++		rm -f $(DESTDIR)$(libdir)/$(DBG_LIB_SHARED_NAME)
+ 		ln -s $(DBG_LIB_SHARED) $(DESTDIR)$(libdir)/$(DBG_LIB_SHARED_NAME)
+-		-rm -f $(DESTDIR)$(libdir)/$(DBG_LIB_SHAREDEV)
++		rm -f $(DESTDIR)$(libdir)/$(DBG_LIB_SHAREDEV)
+ 		ln -s $(DBG_LIB_SHARED_NAME) $(DESTDIR)$(libdir)/$(DBG_LIB_SHAREDEV)
+-		-rm -f $(DESTDIR)$(libdir)/$(DBG_LIB_SHAREDEV_BSO)
++		rm -f $(DESTDIR)$(libdir)/$(DBG_LIB_SHAREDEV_BSO)
+ 		ln -s $(DBG_LIB_SHARED_NAME) $(DESTDIR)$(libdir)/$(DBG_LIB_SHAREDEV_BSO)
+ 		$(LDCONFIG) -n $(DESTDIR)$(libdir)
+ 		install -pm 644 -t $(DESTDIR)$(libdir)/pkgconfig ustr-debug.pc
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] ustr: Makefile fixes for link failures
  2016-05-25 14:52 [Buildroot] [PATCH] ustr: Makefile fixes for link failures Clayton Shotwell
@ 2016-05-25 15:16 ` Thomas Petazzoni
  2016-05-25 15:44   ` Clayton Shotwell
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2016-05-25 15:16 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 25 May 2016 09:52:53 -0500, Clayton Shotwell wrote:

> +--- a/Makefile.in	2016-05-23 08:46:46.337481574 -0500
> ++++ b/Makefile.in	2016-05-23 08:45:12.327380457 -0500
> +@@ -425,11 +425,11 @@
> + 		@echo Installing files
> + 		install -m 644 -t $(DESTDIR)$(libdir) $(OPT_LIB_STATIC)
> + 		install -m 755 -t $(DESTDIR)$(libdir) $(OPT_LIB_SHARED)
> +-		-rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHARED_NAME)
> ++		rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHARED_NAME)

Just changing this cannot fix the failures. The "-" at the beginning of
the line is not about whether is mandatory or not, it is about ignoring
the return value or not.

Normally, make aborts as soon as one command returns a non-zero value.
When you prefix the command with "-", it will ignore the return value
and continue executing the rest.

But like you said, since the command is "rm -f", it returns 0
regardless of whether the file to be removed existed or not, or if the
removal was possible or not.

Hence, I believe your patch is a no-op and cannot fix the original
problem.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] ustr: Makefile fixes for link failures
  2016-05-25 15:16 ` Thomas Petazzoni
@ 2016-05-25 15:44   ` Clayton Shotwell
  2016-05-25 16:09     ` Thomas Petazzoni
  0 siblings, 1 reply; 4+ messages in thread
From: Clayton Shotwell @ 2016-05-25 15:44 UTC (permalink / raw)
  To: buildroot

Thomas,

On Wed, May 25, 2016 at 10:16 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Hello,
>
> On Wed, 25 May 2016 09:52:53 -0500, Clayton Shotwell wrote:
>
>> +--- a/Makefile.in    2016-05-23 08:46:46.337481574 -0500
>> ++++ b/Makefile.in    2016-05-23 08:45:12.327380457 -0500
>> +@@ -425,11 +425,11 @@
>> +             @echo Installing files
>> +             install -m 644 -t $(DESTDIR)$(libdir) $(OPT_LIB_STATIC)
>> +             install -m 755 -t $(DESTDIR)$(libdir) $(OPT_LIB_SHARED)
>> +-            -rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHARED_NAME)
>> ++            rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHARED_NAME)
>
> Just changing this cannot fix the failures. The "-" at the beginning of
> the line is not about whether is mandatory or not, it is about ignoring
> the return value or not.
>
> Normally, make aborts as soon as one command returns a non-zero value.
> When you prefix the command with "-", it will ignore the return value
> and continue executing the rest.
>
> But like you said, since the command is "rm -f", it returns 0
> regardless of whether the file to be removed existed or not, or if the
> removal was possible or not.
>
> Hence, I believe your patch is a no-op and cannot fix the original
> problem.

I completely agree with your assessment but I am unfortunately out of
ideas on what could be causing the build failures.

Thanks,
Clayton

Clayton Shotwell
Senior Software Engineer, Rockwell Collins
clayton.shotwell at rockwellcollins.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] ustr: Makefile fixes for link failures
  2016-05-25 15:44   ` Clayton Shotwell
@ 2016-05-25 16:09     ` Thomas Petazzoni
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2016-05-25 16:09 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 25 May 2016 10:44:57 -0500, Clayton Shotwell wrote:

> I completely agree with your assessment but I am unfortunately out of
> ideas on what could be causing the build failures.

Inspecting the log and looking at the makefile, I believe I have a
possible interpretation.

Here is the relevant part of the Makefile:

"""
install: install-opt install-dbg

install-opt: install-dirs install-opt-lib install-common

install-dbg: install-dirs install-dbg-lib install-common

install-opt-lib: $(OPT_LIB_STATIC) $(OPT_LIB_SHARED) ustr.pc
                @echo Installing files
                install -m 644 -t $(DESTDIR)$(libdir) $(OPT_LIB_STATIC)
                install -m 755 -t $(DESTDIR)$(libdir) $(OPT_LIB_SHARED)
                -rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHARED_NAME)
                ln -s $(OPT_LIB_SHARED) $(DESTDIR)$(libdir)/$(OPT_LIB_SHARED_NAME)
                -rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHAREDEV)
                ln -s $(OPT_LIB_SHARED_NAME) $(DESTDIR)$(libdir)/$(OPT_LIB_SHAREDEV)
                -rm -f $(DESTDIR)$(libdir)/$(OPT_LIB_SHAREDEV_BSO)
                ln -s $(OPT_LIB_SHARED_NAME) $(DESTDIR)$(libdir)/$(OPT_LIB_SHAREDEV_BSO)
                $(LDCONFIG) -n $(DESTDIR)$(libdir)
                install -pm 644 -t $(DESTDIR)$(libdir)/pkgconfig ustr.pc

install-dbg-lib: $(DBG_LIB_STATIC) $(DBG_LIB_SHARED) ustr-debug.pc
                @echo Installing files
                install -m 644 -t $(DESTDIR)$(libdir) $(DBG_LIB_STATIC)
                install -m 755 -t $(DESTDIR)$(libdir) $(DBG_LIB_SHARED)
                -rm -f $(DESTDIR)$(libdir)/$(DBG_LIB_SHARED_NAME)
                ln -s $(DBG_LIB_SHARED) $(DESTDIR)$(libdir)/$(DBG_LIB_SHARED_NAME)
                -rm -f $(DESTDIR)$(libdir)/$(DBG_LIB_SHAREDEV)
                ln -s $(DBG_LIB_SHARED_NAME) $(DESTDIR)$(libdir)/$(DBG_LIB_SHAREDEV)
                -rm -f $(DESTDIR)$(libdir)/$(DBG_LIB_SHAREDEV_BSO)
                ln -s $(DBG_LIB_SHARED_NAME) $(DESTDIR)$(libdir)/$(DBG_LIB_SHAREDEV_BSO)
                $(LDCONFIG) -n $(DESTDIR)$(libdir)
                install -pm 644 -t $(DESTDIR)$(libdir)/pkgconfig ustr-debug.pc
"""

Since install-opt-lib and install-dbg-lib don't have any dependency on
each other, they can execute concurrently.

What is important to realize is that $(LDCONFIG) -n $(DESTDIR)$(libdir)
will create the symbolic links to the libraries if they don't exist.
So, if you have the following sequence of step:

 [1] The install-dbg-lib installs its libraries and removes its
     symbolic link:

     install -m 644 -t $(DESTDIR)$(libdir) $(DBG_LIB_STATIC)
     install -m 755 -t $(DESTDIR)$(libdir) $(DBG_LIB_SHARED)
     -rm -f $(DESTDIR)$(libdir)/$(DBG_LIB_SHARED_NAME)

 [2] The install-opt-lib runs its LDCONFIG

     $(LDCONFIG) -n $(DESTDIR)$(libdir)

 [3] The install-dbg-lib continues its work and creates symlinks:

     ln -s $(DBG_LIB_SHARED) $(DESTDIR)$(libdir)/$(DBG_LIB_SHARED_NAME)

Then, when [3] will run, the symbolic link will already have been
created by step [2], and [3] will therefore fail. Of course, there is
only a very short window of time between the "rm" and the "ln", but it
might be sufficient for the ldconfig to create the symbolic link during
this, causing the failure.

Possible solutions:

 (1) Get rid of ldconfig by passing LDCONFIG=/bin/true in the
     environment. Probably the easiest.

 (2) Add -f in the option to ln to not fail if the link already exists.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-25 16:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-25 14:52 [Buildroot] [PATCH] ustr: Makefile fixes for link failures Clayton Shotwell
2016-05-25 15:16 ` Thomas Petazzoni
2016-05-25 15:44   ` Clayton Shotwell
2016-05-25 16:09     ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.