Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 595290

Summary: sys-fs/squashfs-tools with gcc-5: git/squashfs-tools/mksquashfs.c:897: undefined reference to `get_inode_no'
Product: Gentoo Linux Reporter: ncahill_alt
Component: Current packagesAssignee: Gentoo LiveCD Package Maintainers <livecd>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 536984    

Description ncahill_alt 2016-09-27 15:44:19 UTC
sys-fs/squashfs-tools fails to build with gcc-5.  The fault seems to be that gcc now defaults to -std=gnu11 rather than C99.  I've found a patch online, here it is slightly modified but it worked for me just fine.  To use it, run patch -p1 < squashfs-tools-gcc5.patch.

Original patch was here: http://lists.openembedded.org/pipermail/openembedded-core/2015-September/110406.html

Thanks.  
Neil Cahill

squashfs-tools-gcc5.patch
diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
index d221c35..6bba1d2 100644
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -828,13 +828,13 @@ char *subpathname(struct dir_ent *dir_ent)
 }
 
 
-inline unsigned int get_inode_no(struct inode_info *inode)
+static inline unsigned int get_inode_no(struct inode_info *inode)
 {
 	return inode->inode_number;
 }
 
 
-inline unsigned int get_parent_no(struct dir_info *dir)
+static inline unsigned int get_parent_no(struct dir_info *dir)
 {
 	return dir->depth ? get_inode_no(dir->dir_ent->inode) : inode_no;
 }
@@ -2027,7 +2027,7 @@ struct file_info *duplicate(long long file_size, long long bytes,
 }
 
 
-inline int is_fragment(struct inode_info *inode)
+static inline int is_fragment(struct inode_info *inode)
 {
 	off_t file_size = inode->buf.st_size;
 
@@ -2996,13 +2996,13 @@ struct inode_info *lookup_inode2(struct stat *buf, int pseudo, int id)
 }
 
 
-inline struct inode_info *lookup_inode(struct stat *buf)
+static inline struct inode_info *lookup_inode(struct stat *buf)
 {
 	return lookup_inode2(buf, 0, 0);
 }
 
 
-inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this)
+static inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this)
 {
 	if (inode->inode_number == 0) {
 		inode->inode_number = use_this ? : inode_no ++;
@@ -3013,7 +3013,7 @@ inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this)
 }
 
 
-inline struct dir_ent *create_dir_entry(char *name, char *source_name,
+static inline struct dir_ent *create_dir_entry(char *name, char *source_name,
 	char *nonstandard_pathname, struct dir_info *dir)
 {
 	struct dir_ent *dir_ent = malloc(sizeof(struct dir_ent));
@@ -3031,7 +3031,7 @@ inline struct dir_ent *create_dir_entry(char *name, char *source_name,
 }
 
 
-inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir,
+static inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir,
 	struct inode_info *inode_info)
 {
 	struct dir_info *dir = dir_ent->our_dir;
@@ -3047,7 +3047,7 @@ inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir,
 }
 
 
-inline void add_dir_entry2(char *name, char *source_name,
+static inline void add_dir_entry2(char *name, char *source_name,
 	char *nonstandard_pathname, struct dir_info *sub_dir,
 	struct inode_info *inode_info, struct dir_info *dir)
 {
@@ -3059,7 +3059,7 @@ inline void add_dir_entry2(char *name, char *source_name,
 }
 
 
-inline void free_dir_entry(struct dir_ent *dir_ent)
+static inline void free_dir_entry(struct dir_ent *dir_ent)
 {
 	if(dir_ent->name)
 		free(dir_ent->name);
@@ -3080,7 +3080,7 @@ inline void free_dir_entry(struct dir_ent *dir_ent)
 }
 
 
-inline void add_excluded(struct dir_info *dir)
+static inline void add_excluded(struct dir_info *dir)
 {
 	dir->excluded ++;
 }
-- 
1.9.1


Reproducible: Always
Comment 1 Adrian 2016-12-07 00:25:43 UTC
This bug occurs on my machine as well, and is resolved by the patch provided by Neil Cahill.

As mentioned in the link to the original patch, this only occurs when compiling with -O0, so setting eg. -O2 is a possible work around while the patch is being assessed.
Comment 3 David Seifert gentoo-dev 2016-12-20 21:36:15 UTC
commit dad0ac9a3fe3d4a2ad54b8e31e74cc6101ce78dc
Author: David Seifert <soap@gentoo.org>
Date:   Tue Dec 20 22:34:07 2016 +0100

    sys-fs/squashfs-tools: Fix building with GCC 5
    
    Gentoo-bug: 595290