public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* `strip: X.so could not create temporary file to hold stripped copy: cause of error unknown`
@ 2023-02-21 20:43 Paul Naidoo
  2023-02-22  0:02 ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Naidoo @ 2023-02-21 20:43 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1509 bytes --]

Hi there,

I am trying to run a singularity container on a CentOS7 host, which 
contains an application with Qt5 dependencies.

I am experiencing an error where |libQt5Core.so.5| can not be used 
because of an incompatibility with the linux kernel version for CentOS7:

|uname -r 3.10.0-1160.76.1.el7.x86_64 |

The error given is: |
error while loading shared libraries: libQt5Core.so.5: cannot open 
shared object file: No such file or directory|.

Searching online, various posts (e.g. 
<https://askubuntu.com/a/1163268/1041180>) conclude the solution is to 
execute the following command in order to impose compatibility with 
older kernels:

|strip --remove-section=.note.ABI-tag 
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5|

However executing the command returns the error: |strip: 
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: could not create temporary 
file to hold stripped copy: cause of error unknown|

I have confirmed:

  * the container works on systems with a newer kernel
  * I am running the container with the |--writable| flag, and as |sudo|
  * I have the correct path:
      o

        |whereis libQt5Core.so.5||
        libQt5Core.so.5: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5|

I am at a dead end as to why the strip command is not working. I have 
been unable to find a solution online.  As strip is a part of the 
binutils suite, I was hoping that someone might be able to point me 
towards a solution, or at least a line of investigation?

Sincerest thanks in advance!

Cheers,
Paul

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

* Re: `strip: X.so could not create temporary file to hold stripped copy: cause of error unknown`
  2023-02-21 20:43 `strip: X.so could not create temporary file to hold stripped copy: cause of error unknown` Paul Naidoo
@ 2023-02-22  0:02 ` Alan Modra
  2023-02-22  0:24   ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Modra @ 2023-02-22  0:02 UTC (permalink / raw)
  To: Paul Naidoo; +Cc: binutils

On Tue, Feb 21, 2023 at 08:43:56PM +0000, Paul Naidoo wrote:
> |strip --remove-section=.note.ABI-tag
> /usr/lib/x86_64-linux-gnu/libQt5Core.so.5|
> 
> However executing the command returns the error: |strip:
> /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: could not create temporary file
> to hold stripped copy: cause of error unknown|

You don't have write access in /usr/lib/x86_64-linux-gnu/.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: `strip: X.so could not create temporary file to hold stripped copy: cause of error unknown`
  2023-02-22  0:02 ` Alan Modra
@ 2023-02-22  0:24   ` Andreas Schwab
  2023-02-22  1:35     ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2023-02-22  0:24 UTC (permalink / raw)
  To: Alan Modra via Binutils; +Cc: Paul Naidoo, Alan Modra

On Feb 22 2023, Alan Modra via Binutils wrote:

> On Tue, Feb 21, 2023 at 08:43:56PM +0000, Paul Naidoo wrote:
>> |strip --remove-section=.note.ABI-tag
>> /usr/lib/x86_64-linux-gnu/libQt5Core.so.5|
>> 
>> However executing the command returns the error: |strip:
>> /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: could not create temporary file
>> to hold stripped copy: cause of error unknown|
>
> You don't have write access in /usr/lib/x86_64-linux-gnu/.

I think this will improve the error message:

diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index cf830442b3c..98c567bd955 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -4884,6 +4884,7 @@ strip_main (int argc, char *argv[])
 
       if (tmpname == NULL)
 	{
+	  bfd_set_error (bfd_error_system_call);
 	  bfd_nonfatal_message (argv[i], NULL, NULL,
 				_("could not create temporary file to hold stripped copy"));
 	  status = 1;
-- 
2.39.1

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

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

* Re: `strip: X.so could not create temporary file to hold stripped copy: cause of error unknown`
  2023-02-22  0:24   ` Andreas Schwab
@ 2023-02-22  1:35     ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2023-02-22  1:35 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Alan Modra via Binutils, Paul Naidoo

On Wed, Feb 22, 2023 at 01:24:57AM +0100, Andreas Schwab wrote:
> On Feb 22 2023, Alan Modra via Binutils wrote:
> 
> > On Tue, Feb 21, 2023 at 08:43:56PM +0000, Paul Naidoo wrote:
> >> |strip --remove-section=.note.ABI-tag
> >> /usr/lib/x86_64-linux-gnu/libQt5Core.so.5|
> >> 
> >> However executing the command returns the error: |strip:
> >> /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: could not create temporary file
> >> to hold stripped copy: cause of error unknown|
> >
> > You don't have write access in /usr/lib/x86_64-linux-gnu/.
> 
> I think this will improve the error message:
> 
> diff --git a/binutils/objcopy.c b/binutils/objcopy.c
> index cf830442b3c..98c567bd955 100644
> --- a/binutils/objcopy.c
> +++ b/binutils/objcopy.c
> @@ -4884,6 +4884,7 @@ strip_main (int argc, char *argv[])
>  
>        if (tmpname == NULL)
>  	{
> +	  bfd_set_error (bfd_error_system_call);
>  	  bfd_nonfatal_message (argv[i], NULL, NULL,
>  				_("could not create temporary file to hold stripped copy"));
>  	  status = 1;

Yes, or even better:

	* bucomm.c (make_tempname, make_tempdir): Set bfd_error on error.

diff --git a/binutils/bucomm.c b/binutils/bucomm.c
index df60ce06547..c268fd3d913 100644
--- a/binutils/bucomm.c
+++ b/binutils/bucomm.c
@@ -555,6 +555,7 @@ make_tempname (const char *filename, int *ofd)
   if (fd == -1)
     {
       free (tmpname);
+      bfd_set_error (bfd_error_system_call);
       return NULL;
     }
   *ofd = fd;
@@ -583,7 +584,10 @@ make_tempdir (const char *filename)
 #endif
 #endif
   if (ret == NULL)
-    free (tmpname);
+    {
+      free (tmpname);
+      bfd_set_error (bfd_error_system_call);
+    }
   return ret;
 }
 

-- 
Alan Modra
Australia Development Lab, IBM

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

end of thread, other threads:[~2023-02-22  1:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-21 20:43 `strip: X.so could not create temporary file to hold stripped copy: cause of error unknown` Paul Naidoo
2023-02-22  0:02 ` Alan Modra
2023-02-22  0:24   ` Andreas Schwab
2023-02-22  1:35     ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).