Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZFS kernel built-in failure during compilation. #3546

Closed
reaperx7 opened this issue Jul 2, 2015 · 6 comments
Closed

ZFS kernel built-in failure during compilation. #3546

reaperx7 opened this issue Jul 2, 2015 · 6 comments
Labels
Type: Building Indicates an issue related to building binaries
Milestone

Comments

@reaperx7
Copy link

reaperx7 commented Jul 2, 2015

OS: LinuxFromScratch-SVN-20150630
Compiler: GCC-5.1.0
Kernel: 4.1.1
SPL: 0.6.4.2
ZFS: 0.6.4.2

I was trying to build a kernel for my system with ZFS built-in when I got this error during the kernel build phase. I was using make with -j1 to avoid any issues with the build if at all possible. Here's the error readout:

CC fs/zfs/zfs/trace.o
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_acl.h:160,
from fs/zfs/zfs/trace.c:40:
include/trace/ftrace.h:25:23: error: redefinition of 'str__zfs__trace_system_name'
#define app(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace.h:66,
from fs/zfs/zfs/trace.c:39:
include/trace/ftrace.h:25:23: note: previous definition of 'str__zfs__trace_system_name' was here
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_arc.h:426,
from fs/zfs/zfs/trace.c:41:
include/trace/ftrace.h:25:23: error: redefinition of 'str__zfs__trace_system_name'
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_acl.h:160,
from fs/zfs/zfs/trace.c:40:
include/trace/ftrace.h:25:23: note: previous definition of 'str__zfs__trace_system_name' was here
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_dbuf.h:97,
from fs/zfs/zfs/trace.c:42:
include/trace/ftrace.h:25:23: error: redefinition of 'str__zfs__trace_system_name'
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_arc.h:426,
from fs/zfs/zfs/trace.c:41:
include/trace/ftrace.h:25:23: note: previous definition of 'str__zfs__trace_system_name' was here
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_dmu.h:115,
from fs/zfs/zfs/trace.c:43:
include/trace/ftrace.h:25:23: error: redefinition of 'str__zfs__trace_system_name'
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_dbuf.h:97,
from fs/zfs/zfs/trace.c:42:
include/trace/ftrace.h:25:23: note: previous definition of 'str__zfs__trace_system_name' was here
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_dnode.h:115,
from fs/zfs/zfs/trace.c:44:
include/trace/ftrace.h:25:23: error: redefinition of 'str__zfs__trace_system_name'
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_dmu.h:115,
from fs/zfs/zfs/trace.c:43:
include/trace/ftrace.h:25:23: note: previous definition of 'str__zfs__trace_system_name' was here
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_txg.h:70,
from fs/zfs/zfs/trace.c:45:
include/trace/ftrace.h:25:23: error: redefinition of 'str__zfs__trace_system_name'
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_dnode.h:115,
from fs/zfs/zfs/trace.c:44:
include/trace/ftrace.h:25:23: note: previous definition of 'str__zfs__trace_system_name' was here
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_zil.h:125,
from fs/zfs/zfs/trace.c:46:
include/trace/ftrace.h:25:23: error: redefinition of 'str__zfs__trace_system_name'
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_txg.h:70,
from fs/zfs/zfs/trace.c:45:
include/trace/ftrace.h:25:23: note: previous definition of 'str__zfs__trace_system_name' was here
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_zrlock.h:82,
from fs/zfs/zfs/trace.c:47:
include/trace/ftrace.h:25:23: error: redefinition of 'str__zfs__trace_system_name'
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro 'app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
In file included from include/trace/define_trace.h:90:0,
from ./include/zfs/sys/trace_zil.h:125,
from fs/zfs/zfs/trace.c:46:
include/trace/ftrace.h:25:23: note: previous definition of 'str__zfs__trace_system_name' was here
#define __app
(x, y) str__##x##y
^
include/trace/ftrace.h:26:21: note: in expansion of macro 'app'
#define app(x, y) __app(x, y)
^
include/trace/ftrace.h:28:29: note: in expansion of macro '__app'
#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
^
include/trace/ftrace.h:31:20: note: in expansion of macro 'TRACE_SYSTEM_STRING'
static const char TRACE_SYSTEM_STRING[] =
^
include/trace/ftrace.h:34:1: note: in expansion of macro 'TRACE_MAKE_SYSTEM_STR'
TRACE_MAKE_SYSTEM_STR();
^
scripts/Makefile.build:258: recipe for target 'fs/zfs/zfs/trace.o' failed
make[3]: *** [fs/zfs/zfs/trace.o] Error 1
scripts/Makefile.build:403: recipe for target 'fs/zfs/zfs' failed
make[2]: *** [fs/zfs/zfs] Error 2
scripts/Makefile.build:403: recipe for target 'fs/zfs' failed
make[1]: *** [fs/zfs] Error 2
Makefile:946: recipe for target 'fs' failed
make: *** [fs] Error 2

Is this a problem with GCC-5.1.0 and can this be patched? If any further information is needed, please let me know.

Thanks,
Jim

@dracwyrm
Copy link

dracwyrm commented Jul 2, 2015

Not a problem with GCC v5.1 as I have this same error with GCC v4.9.2 on Kernel v4.1.1. Using nornal compile as always. I have built in the module for the v4.0.x series of kernels no problem.

@dracwyrm
Copy link

dracwyrm commented Jul 2, 2015

Since I said earlier that it worked on the 4.0.x kernels. I looked at all commits of ZFS and the kernel. Nothing changes for ZFS in dealing with Trace, but ftrace.h has this patch that is not even in the latest stable 4.0.7 kernel:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/trace/ftrace.h?id=acd388fd3af350ab24c6ab6f19b83fc4a4f3aa60

Looks like code depending on this header needs to take this into account. Read more here:
http://marc.info/?l=linux-kernel&m=142802551605928

@reaperx7
Copy link
Author

reaperx7 commented Jul 2, 2015

I thought as much. Guess I can rebuild LFS against an older kernel to double check.

Sent from my Windows Phone


From: Jonathan Scruggsmailto:notifications@github.com
Sent: ‎7/‎1/‎2015 9:59 PM
To: zfsonlinux/zfsmailto:zfs@noreply.github.com
Cc: James Powellmailto:james4591@hotmail.com
Subject: Re: [zfs] ZFS kernel built-in failure during compilation. (#3546)

Not a problem with GCC v5.1 as I have this same error with GCC v4.9.2 on Kernel v4.1.1. Using nornal compile as always. I have built in the module for the v4.0.x series of kernels no problem.


Reply to this email directly or view it on GitHub:
#3546 (comment)

@reaperx7
Copy link
Author

reaperx7 commented Jul 2, 2015

I'll see about using it to make a patch to see if it fixes things. Thanks again.

Sent from my Windows Phone


From: Jonathan Scruggsmailto:notifications@github.com
Sent: ‎7/‎1/‎2015 10:07 PM
To: zfsonlinux/zfsmailto:zfs@noreply.github.com
Cc: James Powellmailto:james4591@hotmail.com
Subject: Re: [zfs] ZFS kernel built-in failure during compilation. (#3546)

Since I said earlier that it worked on the 4.0.x kernels. I looked at all commits of ZFS and the kernel. Nothing changes for ZFS in dealing with Trace, but ftrace.h has this patch that is not even in the latest stable 4.0.7 kernel:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/trace/ftrace.h?id=acd388fd3af350ab24c6ab6f19b83fc4a4f3aa60

That patch is what is breaking this. Either code depending on this header file need to somehow take this into account, or this is a bug upstream in the kernel.


Reply to this email directly or view it on GitHub:
#3546 (comment)

@dracwyrm
Copy link

dracwyrm commented Jul 2, 2015

@reaperx7 I updated my comment as it's now correct information in it. :) Also, it works if you compile outside the kernel as a module, but I too want it built in to the kernel.

Also, heads up: the ftrace.h has been renamed to trace_events.h in kernel 4.2.

@behlendorf behlendorf added the Type: Building Indicates an issue related to building binaries label Jul 3, 2015
@fvanniere
Copy link
Contributor

The issue is that there are several includes in fs/zfs/zfs/trace.c, each header included includes also trace/define_trace.h which includes trace/ftrace.h
Since linux 4.1, in trace/ftrace.h there is this new code

#ifndef TRACE_SYSTEM_VAR
#define TRACE_SYSTEM_VAR TRACE_SYSTEM
#endif

#define __app__(x, y) str__##x##y
#define __app(x, y) __app__(x, y)

#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)

#define TRACE_MAKE_SYSTEM_STR()                         \
        static const char TRACE_SYSTEM_STRING[] =       \
                __stringify(TRACE_SYSTEM)

TRACE_MAKE_SYSTEM_STR();

#undef TRACE_DEFINE_ENUM
#define TRACE_DEFINE_ENUM(a)                            \
        static struct trace_enum_map __used __initdata  \
        __##TRACE_SYSTEM##_##a =                        \
        {                                               \
                .system = TRACE_SYSTEM_STRING,          \
                .enum_string = #a,                      \
                .enum_value = a                         \
        };                                              \
        static struct trace_enum_map __used             \
        __attribute__((section("_ftrace_enum_map")))    \
        *TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a

Because ZFS module includes it several times, the function str__zfs__trace_system_name is defined several times. It comes from https://lkml.org/lkml/2015/3/27/832

The solution (see pull request), is to add 2 lines in each include/zfs/sys/trace_xxx.h

#undef TRACE_SYSTEM
#define TRACE_SYSTEM zfs

+#undef TRACE_SYSTEM_VAR
+#define TRACE_SYSTEM_VAR zfs_xxx

problem solved.

@behlendorf behlendorf added this to the 0.6.5 milestone Jul 29, 2015
chrisrd added a commit to chrisrd/zfs that referenced this issue Aug 9, 2015
See also openzfs#3546, @c1718e9

Signed-off-by: Chris Dunlop <chris@onthe.net.au>
behlendorf pushed a commit to behlendorf/zfs that referenced this issue Aug 18, 2015
See also openzfs#3546, commit c1718e9

Signed-off-by: Chris Dunlop <chris@onthe.net.au>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#3673
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Building Indicates an issue related to building binaries
Projects
None yet
Development

No branches or pull requests

4 participants