Skip to contentSkip to conversation

05/06: package.bbclass: Include dbgsrc for static libs

oe-commits Martin Jansa 2 participants 3 messages Apr 20, 2018 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

I haven't dig around this much, but some of my builds are now failing with:

ERROR: libsdl2-webos-2.0.4-86-r22 do_package: dwarfsrcfiles failed with exit code 1 (cmd was 'dwarfsrcfiles' 'libsdl2-webos/2.0.4-86-r22/ package/usr/lib/libSDL2main.a'):
dwarfsrcfiles: libsdl2-webos/2.0.4-86-r22/package/usr/lib/libSDL2main.a:
not a valid ELF file
ERROR: libsdl2-webos-2.0.4-86-r22 do_package: Function failed:
split_and_strip_files

It's different version of libsdl2 than what's in oe-core now and the recipe for it might be a bit broken.

$ file package/usr/lib/libSDL2main.a
package/usr/lib/libSDL2main.a: current ar archive
$ recipe-sysroot-native/usr/bin/dwarfsrcfiles package/usr/lib/libSDL2main.a
dwarfsrcfiles: package/usr/lib/libSDL2main.a: not a valid ELF file
$ ar x ../package/usr/lib/libSDL2main.a

contains only:
SDL_dummy_main.lo

Should we try a bit harder to check if the .a contains static library? In the meantime I'll check what's going on in libsdl2-webos build and if the same happens in oe-core libsdl2.

Regards,

Quoted 139 lines · On Thu, Apr 19, 2018 at 3:45 PM, <[email protected]> wrote:

This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit eefa5ba35663fabe1f3f8cf7f1ff126d51240613
Author: Ola x Nilsson <[email protected]>
AuthorDate: Thu Apr 19 13:17:30 2018 +0200

package.bbclass: Include dbgsrc for static libs

The debugsource must be added from the package providing the static lib, because any package using that lib does not have access to the source code.

Fixes [YOCTO #12558]

---
 meta/classes/package.bbclass | 44 ++++++++++++++++++++++++++++++
++------------
 1 file changed, 32 insertions(+), 12 deletions(-)
meta/classes/package.bbclass +0 -0
index 7978307..fff7ceb 100644
@@ -344,6 +344,20 @@ def parse_debugsources_from_dwarfs

rcfiles_output(dwarfsrcfiles_output):

return debugfiles.keys()

meta/classes/package.bbclass +4 -0
+def append_source_info(file, sourcefile, d):
+    cmd = "'dwarfsrcfiles' '%s'" % (file)
+    (retval, output) = oe.utils.getstatusoutput(cmd)
+    # 255 means a specific file wasn't fully parsed to get the debug file

list, which is not a fatal failure

meta/classes/package.bbclass +2 -0
+    if retval != 0 and retval != 255:
+        bb.fatal("dwarfsrcfiles failed with exit code %s (cmd was %s)%s"

% (retval, cmd, ":\n%s" % output if output else ""))

meta/classes/package.bbclass +3 -0
+
+    debugsources = parse_debugsources_from_dwarfsrcfiles_output(output)
+    # filenames are null-separated - this is an artefact of the previous

use
+ # of rpm's debugedit, which was writing them out that way, and the
code elsewhere

meta/classes/package.bbclass +4 -0
+    # is still assuming that.
+    debuglistoutput = '\0'.join(debugsources) + '\0'
+    open(sourcefile, 'a').write(debuglistoutput)
+
 
 def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
     # Function to split a single file into two components, one is the

stripped

meta/classes/package.bbclass +0 -0
@@ -369,18 +383,7 @@ def splitdebuginfo(file, debugfile, debugsrcdir,

sourcefile, d):

# We need to extract the debug src information here... if debugsrcdir:

meta/classes/package.bbclass +0 -3
-        cmd = "'dwarfsrcfiles' '%s'" % (file)
-        (retval, output) = oe.utils.getstatusoutput(cmd)
-        # 255 means a specific file wasn't fully parsed to get the debug

file list, which is not a fatal failure

meta/classes/package.bbclass +0 -2
-        if retval != 0 and retval != 255:
-            bb.fatal("dwarfsrcfiles failed with exit code %s (cmd was

%s)%s" % (retval, cmd, ":\n%s" % output if output else ""))

meta/classes/package.bbclass +0 -2
-
-        debugsources = parse_debugsources_from_dwarfs

rcfiles_output(output)
- # filenames are null-separated - this is an artefact of the
previous use
- # of rpm's debugedit, which was writing them out that way, and
the code elsewhere

meta/classes/package.bbclass +10 -3
-        # is still assuming that.
-        debuglistoutput = '\0'.join(debugsources) + '\0'
-        open(sourcefile, 'a').write(debuglistoutput)
+        append_source_info(file, sourcefile, d)
 
     bb.utils.mkdirhier(os.path.dirname(debugfile))
@@ -936,6 +939,15 @@ python split_and_strip_files () {
                 type |= 8
         return type
 
+    def isStaticLib(path):
+        if path.endswith('.a') and not os.path.islink(path):
+            with open(path, 'rb') as fh:
+                # The magic must include the first slash to avoid
+                # matching golang static libraries
+                magic = b'!<arch>\x0a/'
+                start = fh.read(len(magic))
+                return start == magic
+        return False
 
     #
     # First lets figure out all of the files we may have to process ...

do this only once!

meta/classes/package.bbclass +4 -1
@@ -943,6 +955,7 @@ python split_and_strip_files () {
     elffiles = {}
     symlinks = {}
     kernmods = []
+    staticlibs = []
     inodes = {}
     libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir"))
     baselibdir = os.path.abspath(dvar + os.sep + d.getVar("base_libdir"))
@@ -955,6 +968,9 @@ python split_and_strip_files () {
                 if file.endswith(".ko") and file.find("/lib/modules/") !=
-1:
                     kernmods.append(file)
                     continue
+                if isStaticLib(file):
+                    staticlibs.append(file)
+                    continue
 
                 # Skip debug files
                 if debugappend and file.endswith(debugappend):
@@ -1033,6 +1049,10 @@ python split_and_strip_files () {
             # Only store off the hard link reference if we successfully

split!
splitdebuginfo(file, fpath, debugsrcdir, sourcefile, d)

meta/classes/package.bbclass +4 -1
+        if debugsrcdir:
+            for file in staticlibs:
+                append_source_info(file, sourcefile, d)
+
         # Hardlink our debug symbols to the other hardlink copies
         for ref in inodes:
             if len(inodes[ref]) == 1:
 
--

To stop receiving notification emails like this one, please contact the administrator of this repository.
--
_______________________________________________
Openembedded-commits mailing list [email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-commits

#3 lore raw

FWIW, libsdl2 builds fine for me with current sumo branch.

Ross

Quoted 176 lines · Martin Jansa

I haven't dig around this much, but some of my builds are now failing with:

ERROR: libsdl2-webos-2.0.4-86-r22 do_package: dwarfsrcfiles failed with exit code 1 (cmd was 'dwarfsrcfiles' 'libsdl2-webos/2.0.4-86-r22/ package/usr/lib/libSDL2main.a'):
dwarfsrcfiles: libsdl2-webos/2.0.4-86-r22/package/usr/lib/libSDL2main.a:
not a valid ELF file
ERROR: libsdl2-webos-2.0.4-86-r22 do_package: Function failed:
split_and_strip_files

It's different version of libsdl2 than what's in oe-core now and the recipe for it might be a bit broken.

$ file package/usr/lib/libSDL2main.a
package/usr/lib/libSDL2main.a: current ar archive
$ recipe-sysroot-native/usr/bin/dwarfsrcfiles package/usr/lib/libSDL2main.a
dwarfsrcfiles: package/usr/lib/libSDL2main.a: not a valid ELF file
$ ar x ../package/usr/lib/libSDL2main.a

contains only:
SDL_dummy_main.lo

Should we try a bit harder to check if the .a contains static library? In the meantime I'll check what's going on in libsdl2-webos build and if the same happens in oe-core libsdl2.

Regards,

Quoted 131 lines · On Thu, Apr 19, 2018 at 3:45 PM, <[email protected]> wrote:

This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit eefa5ba35663fabe1f3f8cf7f1ff126d51240613
Author: Ola x Nilsson <[email protected]>
AuthorDate: Thu Apr 19 13:17:30 2018 +0200

package.bbclass: Include dbgsrc for static libs

The debugsource must be added from the package providing the static lib, because any package using that lib does not have access to the source code.

Fixes [YOCTO #12558]

---
 meta/classes/package.bbclass | 44 ++++++++++++++++++++++++++++++
++------------
 1 file changed, 32 insertions(+), 12 deletions(-)
meta/classes/package.bbclass +0 -0
index 7978307..fff7ceb 100644
@@ -344,6 +344,20 @@ def parse_debugsources_from_dwarfs

rcfiles_output(dwarfsrcfiles_output):

return debugfiles.keys()

meta/classes/package.bbclass +4 -0
+def append_source_info(file, sourcefile, d):
+    cmd = "'dwarfsrcfiles' '%s'" % (file)
+    (retval, output) = oe.utils.getstatusoutput(cmd)
+    # 255 means a specific file wasn't fully parsed to get the debug file

list, which is not a fatal failure

meta/classes/package.bbclass +2 -0
+    if retval != 0 and retval != 255:
+        bb.fatal("dwarfsrcfiles failed with exit code %s (cmd was %s)%s"

% (retval, cmd, ":\n%s" % output if output else ""))

meta/classes/package.bbclass +3 -0
+
+    debugsources = parse_debugsources_from_dwarfsrcfiles_output(output)
+    # filenames are null-separated - this is an artefact of the previous

use
+ # of rpm's debugedit, which was writing them out that way, and the
code elsewhere

meta/classes/package.bbclass +4 -0
+    # is still assuming that.
+    debuglistoutput = '\0'.join(debugsources) + '\0'
+    open(sourcefile, 'a').write(debuglistoutput)
+
 
 def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
     # Function to split a single file into two components, one is the

stripped

meta/classes/package.bbclass +0 -0
@@ -369,18 +383,7 @@ def splitdebuginfo(file, debugfile, debugsrcdir,

sourcefile, d):

# We need to extract the debug src information here... if debugsrcdir:

meta/classes/package.bbclass +0 -3
-        cmd = "'dwarfsrcfiles' '%s'" % (file)
-        (retval, output) = oe.utils.getstatusoutput(cmd)
-        # 255 means a specific file wasn't fully parsed to get the debug

file list, which is not a fatal failure

meta/classes/package.bbclass +0 -2
-        if retval != 0 and retval != 255:
-            bb.fatal("dwarfsrcfiles failed with exit code %s (cmd was

%s)%s" % (retval, cmd, ":\n%s" % output if output else ""))

meta/classes/package.bbclass +0 -2
-
-        debugsources = parse_debugsources_from_dwarfs

rcfiles_output(output)
- # filenames are null-separated - this is an artefact of the
previous use
- # of rpm's debugedit, which was writing them out that way, and
the code elsewhere

meta/classes/package.bbclass +10 -3
-        # is still assuming that.
-        debuglistoutput = '\0'.join(debugsources) + '\0'
-        open(sourcefile, 'a').write(debuglistoutput)
+        append_source_info(file, sourcefile, d)
 
     bb.utils.mkdirhier(os.path.dirname(debugfile))
@@ -936,6 +939,15 @@ python split_and_strip_files () {
                 type |= 8
         return type
 
+    def isStaticLib(path):
+        if path.endswith('.a') and not os.path.islink(path):
+            with open(path, 'rb') as fh:
+                # The magic must include the first slash to avoid
+                # matching golang static libraries
+                magic = b'!<arch>\x0a/'
+                start = fh.read(len(magic))
+                return start == magic
+        return False
 
     #
     # First lets figure out all of the files we may have to process ...

do this only once!

meta/classes/package.bbclass +4 -1
@@ -943,6 +955,7 @@ python split_and_strip_files () {
     elffiles = {}
     symlinks = {}
     kernmods = []
+    staticlibs = []
     inodes = {}
     libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir"))
     baselibdir = os.path.abspath(dvar + os.sep + d.getVar("base_libdir"))
@@ -955,6 +968,9 @@ python split_and_strip_files () {
                 if file.endswith(".ko") and file.find("/lib/modules/") !=
-1:
                     kernmods.append(file)
                     continue
+                if isStaticLib(file):
+                    staticlibs.append(file)
+                    continue
 
                 # Skip debug files
                 if debugappend and file.endswith(debugappend):
@@ -1033,6 +1049,10 @@ python split_and_strip_files () {
             # Only store off the hard link reference if we successfully

split!
splitdebuginfo(file, fpath, debugsrcdir, sourcefile, d)

meta/classes/package.bbclass +4 -1
+        if debugsrcdir:
+            for file in staticlibs:
+                append_source_info(file, sourcefile, d)
+
         # Hardlink our debug symbols to the other hardlink copies
         for ref in inodes:
             if len(inodes[ref]) == 1:
 
--
Quoted 8 lines

To stop receiving notification emails like this one, please contact the administrator of this repository.
--
_______________________________________________
Openembedded-commits mailing list [email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-commits

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#4 lore raw

Yes, builds fine here as well, because libSDL2main.a and libSDL2_test.a built by oe-core version of libsdl2 contain the actual object files:

SDL_dummy_main.o

and

./SDL_test_fuzzer.o
./SDL_test_imageBlitBlend.o
./SDL_test_compare.o
./SDL_test_common.o
./SDL_test_imagePrimitives.o
./SDL_test_font.o
./SDL_test_imageFace.o
./SDL_test_memory.o
./SDL_test_assert.o
./SDL_test_md5.o
./SDL_test_log.o
./SDL_test_random.o
./SDL_test_crc32.o
./SDL_test_imagePrimitivesBlend.o
./SDL_test_imageBlit.o
./SDL_test_harness.o

not the libtool object files like this:
SDL_dummy_main.lo

# build/SDL_dummy_main.lo - a libtool object file
# Generated by libtool (GNU libtool) 2.4.2
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# Name of the PIC object.
pic_object='.libs/SDL_dummy_main.o'

# Name of the non-PIC object
non_pic_object=none

I'll fix our version of libsdl2, the point of this tread was more about probably checking a bit harder if the .a file is not only the ar archive, but also contains some ELF binaries.

Quoted 192 lines · Ross

FWIW, libsdl2 builds fine for me with current sumo branch.

Ross

Quoted 1 line · Martin Jansa

I haven't dig around this much, but some of my builds are now failing

with:

Quoted 10 lines

ERROR: libsdl2-webos-2.0.4-86-r22 do_package: dwarfsrcfiles failed with exit code 1 (cmd was 'dwarfsrcfiles' 'libsdl2-webos/2.0.4-86-r22/ package/usr/lib/libSDL2main.a'):
dwarfsrcfiles: libsdl2-webos/2.0.4-86-r22/package/usr/lib/libSDL2main.a:
not a valid ELF file
ERROR: libsdl2-webos-2.0.4-86-r22 do_package: Function failed:
split_and_strip_files

It's different version of libsdl2 than what's in oe-core now and the

recipe

Quoted 6 lines

for it might be a bit broken.

$ file package/usr/lib/libSDL2main.a
package/usr/lib/libSDL2main.a: current ar archive
$ recipe-sysroot-native/usr/bin/dwarfsrcfiles

package/usr/lib/libSDL2main.a

Quoted 46 lines

dwarfsrcfiles: package/usr/lib/libSDL2main.a: not a valid ELF file

$ ar x ../package/usr/lib/libSDL2main.a

contains only:
SDL_dummy_main.lo

Should we try a bit harder to check if the .a contains static library? In the meantime I'll check what's going on in libsdl2-webos build and if the same happens in oe-core libsdl2.

Regards,

Quoted 31 lines · On Thu, Apr 19, 2018 at 3:45 PM, <[email protected]> wrote:

This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit eefa5ba35663fabe1f3f8cf7f1ff126d51240613
Author: Ola x Nilsson <[email protected]>
AuthorDate: Thu Apr 19 13:17:30 2018 +0200

package.bbclass: Include dbgsrc for static libs

The debugsource must be added from the package providing the static lib, because any package using that lib does not have access to the source code.

Fixes [YOCTO #12558]

---
 meta/classes/package.bbclass | 44 ++++++++++++++++++++++++++++++
++------------
 1 file changed, 32 insertions(+), 12 deletions(-)
meta/classes/package.bbclass +0 -0
index 7978307..fff7ceb 100644
@@ -344,6 +344,20 @@ def parse_debugsources_from_dwarfs

rcfiles_output(dwarfsrcfiles_output):

Quoted 6 lines

meta/classes/package.bbclass

Quoted 6 lines

return debugfiles.keys()

meta/classes/package.bbclass +4 -0
+def append_source_info(file, sourcefile, d):
+    cmd = "'dwarfsrcfiles' '%s'" % (file)
+    (retval, output) = oe.utils.getstatusoutput(cmd)
+    # 255 means a specific file wasn't fully parsed to get the debug

file

Quoted 3 lines

meta/classes/package.bbclass

Quoted 3 lines

list, which is not a fatal failure

meta/classes/package.bbclass +2 -0
+    if retval != 0 and retval != 255:
+        bb.fatal("dwarfsrcfiles failed with exit code %s (cmd was

%s)%s"

Quoted 3 lines

meta/classes/package.bbclass

Quoted 3 lines

% (retval, cmd, ":\n%s" % output if output else ""))

meta/classes/package.bbclass +2 -0
+
+    debugsources = parse_debugsources_from_

dwarfsrcfiles_output(output)

Quoted 1 line
Quoted 1 line

+ # filenames are null-separated - this is an artefact of the

previous

Quoted 14 lines
Quoted 14 lines

use
+ # of rpm's debugedit, which was writing them out that way, and the
code elsewhere

meta/classes/package.bbclass +4 -0
+    # is still assuming that.
+    debuglistoutput = '\0'.join(debugsources) + '\0'
+    open(sourcefile, 'a').write(debuglistoutput)
+
 
 def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
     # Function to split a single file into two components, one is the

stripped

meta/classes/package.bbclass +0 -0
@@ -369,18 +383,7 @@ def splitdebuginfo(file, debugfile, debugsrcdir,

sourcefile, d):

Quoted 5 lines

meta/classes/package.bbclass

Quoted 5 lines

# We need to extract the debug src information here... if debugsrcdir:

meta/classes/package.bbclass +0 -3
-        cmd = "'dwarfsrcfiles' '%s'" % (file)
-        (retval, output) = oe.utils.getstatusoutput(cmd)
-        # 255 means a specific file wasn't fully parsed to get the

debug

Quoted 32 lines
Quoted 32 lines

file list, which is not a fatal failure

meta/classes/package.bbclass +0 -2
-        if retval != 0 and retval != 255:
-            bb.fatal("dwarfsrcfiles failed with exit code %s (cmd was

%s)%s" % (retval, cmd, ":\n%s" % output if output else ""))

meta/classes/package.bbclass +0 -2
-
-        debugsources = parse_debugsources_from_dwarfs

rcfiles_output(output)
- # filenames are null-separated - this is an artefact of the
previous use
- # of rpm's debugedit, which was writing them out that way, and
the code elsewhere

meta/classes/package.bbclass +10 -3
-        # is still assuming that.
-        debuglistoutput = '\0'.join(debugsources) + '\0'
-        open(sourcefile, 'a').write(debuglistoutput)
+        append_source_info(file, sourcefile, d)
 
     bb.utils.mkdirhier(os.path.dirname(debugfile))
@@ -936,6 +939,15 @@ python split_and_strip_files () {
                 type |= 8
         return type
 
+    def isStaticLib(path):
+        if path.endswith('.a') and not os.path.islink(path):
+            with open(path, 'rb') as fh:
+                # The magic must include the first slash to avoid
+                # matching golang static libraries
+                magic = b'!<arch>\x0a/'
+                start = fh.read(len(magic))
+                return start == magic
+        return False
 
Quoted 11 lines

meta/classes/package.bbclass python split_and_strip_files () { · line 961

Quoted 11 lines
meta/classes/package.bbclass +0 -0
     #
     # First lets figure out all of the files we may have to process ...

do this only once!

meta/classes/package.bbclass +1 -0
@@ -943,6 +955,7 @@ python split_and_strip_files () {
     elffiles = {}
     symlinks = {}
     kernmods = []
+    staticlibs = []
     inodes = {}
     libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir"))
     baselibdir = os.path.abspath(dvar + os.sep +

d.getVar("base_libdir"))

Quoted 2 lines

meta/classes/package.bbclass python split_and_strip_files () { · line 968

Quoted 2 lines
meta/classes/package.bbclass +0 -0
@@ -955,6 +968,9 @@ python split_and_strip_files () {
                 if file.endswith(".ko") and file.find("/lib/modules/")

!=

Quoted 36 lines
Quoted 23 lines
meta/classes/package.bbclass +3 -1
-1:
                     kernmods.append(file)
                     continue
+                if isStaticLib(file):
+                    staticlibs.append(file)
+                    continue
 
                 # Skip debug files
                 if debugappend and file.endswith(debugappend):
@@ -1033,6 +1049,10 @@ python split_and_strip_files () {
             # Only store off the hard link reference if we successfully

split!
splitdebuginfo(file, fpath, debugsrcdir, sourcefile, d)

meta/classes/package.bbclass +4 -1
+        if debugsrcdir:
+            for file in staticlibs:
+                append_source_info(file, sourcefile, d)
+
         # Hardlink our debug symbols to the other hardlink copies
         for ref in inodes:
             if len(inodes[ref]) == 1:
 
--
Quoted 8 lines

To stop receiving notification emails like this one, please contact the administrator of this repository.
--
_______________________________________________
Openembedded-commits mailing list [email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-commits

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel