Skip to content

Build fails on Ubuntu 20.04 (kernel 5.4.0-205-generic) #48

@toreanderson

Description

@toreanderson

The module does not build on a fully updated Ubuntu 20.04 host:

ubuntu@ubuntu-20:~/nat46/nat46/modules$ make
make -C /lib/modules/5.4.0-205-generic/build M=/home/ubuntu/nat46/nat46/modules modules
make[1]: Entering directory '/usr/src/linux-headers-5.4.0-205-generic'
  CC [M]  /home/ubuntu/nat46/nat46/modules/nat46-netdev.o
  CC [M]  /home/ubuntu/nat46/nat46/modules/nat46-module.o
/home/ubuntu/nat46/nat46/modules/nat46-module.c: In function ‘nat46_init’:
/home/ubuntu/nat46/nat46/modules/nat46-module.c:254:49: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]
  254 |  printk("nat46: module (version %s) loaded.\n", NAT46_VERSION);
      |                                                 ^~~~~~~~~~~~~
/home/ubuntu/nat46/nat46/modules/nat46-module.c:54:23: error: macro "__TIME__" might prevent reproducible builds [-Werror=date-time]
   54 | #define NAT46_VERSION __DATE__ " " __TIME__
      |                       ^~~~~~~~
/home/ubuntu/nat46/nat46/modules/nat46-module.c:254:49: note: in expansion of macro ‘NAT46_VERSION’
  254 |  printk("nat46: module (version %s) loaded.\n", NAT46_VERSION);
      |                                                 ^~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:270: /home/ubuntu/nat46/nat46/modules/nat46-module.o] Error 1
make[1]: *** [Makefile:1778: /home/ubuntu/nat46/nat46/modules] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-205-generic'
make: *** [Makefile:6: all] Error 2

Something like this fixes it:

diff --git a/nat46/modules/nat46-module.c b/nat46/modules/nat46-module.c
index f4720d4..b402f37 100644
--- a/nat46/modules/nat46-module.c
+++ b/nat46/modules/nat46-module.c
@@ -51,7 +51,7 @@
 #define NAT46_CONTROL_PROC_NAME "control"
 
 #ifndef NAT46_VERSION
-#define NAT46_VERSION __DATE__ " " __TIME__
+#define NAT46_VERSION "1.0"
 #endif
 
 MODULE_LICENSE("GPL");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions