Error: eudev-1.7 won’t compile with gcc 7.1 & glibc-2.25

When compiling eudev with gcc 7.1 and glibc 2.25 (x64) you may get a this error wich will not let you compile/install:

883 CC mtd_probe.o
884 In file included from mtd_probe.c:24:0:
885 mtd_probe.h:24:9: error: unknown type name 'uint32_t'
886 uint32_t reserved;
887 ^~~~~~~~
888 mtd_probe.h:25:9: error: unknown type name 'uint8_t'
889 uint8_t data_status;
890 ^~~~~~~
891 mtd_probe.h:26:9: error: unknown type name 'uint8_t'
892 uint8_t block_status;
893 ^~~~~~~
894 mtd_probe.h:27:9: error: unknown type name 'uint8_t'
895 uint8_t lba_copy1[2];
896 ^~~~~~~
897 mtd_probe.h:28:9: error: unknown type name 'uint8_t'
898 uint8_t ecc2[3];
899 ^~~~~~~
900 mtd_probe.h:29:9: error: unknown type name 'uint8_t'
901 uint8_t lba_copy2[2];
902 ^~~~~~~
903 mtd_probe.h:30:9: error: unknown type name 'uint8_t'
904 uint8_t ecc1[3];
905 ^~~~~~~
906 make[3]: *** [Makefile:440: mtd_probe.o] Error 1
907 make[3]: Leaving directory '/root/cctools4/eudev-1.7/src/mtd_probe'
908 make[2]: *** [Makefile:400: all-recursive] Error 1
909 make[2]: Leaving directory '/root/cctools4/eudev-1.7/src'
910 make[1]: *** [Makefile:446: all-recursive] Error 1
911 make[1]: Leaving directory '/root/cctools4/eudev-1.7'
912 make: *** [Makefile:377: all] Error 2
913 GGQ:MakeOutput For (eudev-1.7) is (2)

This is caused because in prior gcc versions the nested header file was ‘included’, but the C standard does not guarantee this, so with new versions this ‘feature’ was removed, its not strictly an error but you need this change to make it work:

How to fix:

Add this into eudev-1.7/src/mtd_probe/mtd_probe.h file:

(...)
* Boston, MA 02110-1301 USA
*/

+#if defined __UINT32_MAX__ || UINT32_MAX
+ #include <inttypes.h>
+ #else
+ typedef unsigned char uint8_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned long uint32_t;
+ typedef unsigned long long uint64_t;
+#endif
+
#include <mtd/mtd-user.h>

/* Full oob structure as written on the flash */
(...)

Im including the patch for an easy deploy: eudev.gonza.cl.patch
Please rename it to .patch extension after download.

Filed under Uncategorized · Tagged with

Comments: