adrianlopezroche / fdupes

FDUPES is a program for identifying or deleting duplicate files residing within specified directories.
2.48k stars 186 forks source link

AIX build broken due to missing of endian.h #185

Closed shubhamhii closed 2 months ago

shubhamhii commented 7 months ago

In AIX, endian.h file isn't present, hence we are facing build issue.

gcc -DHAVE_CONFIG_H -I. -maix64 -O2 -I/opt/freeware/include/ncurses -MT md5/md5.o -MD -MP -MF $depbase.Tpo -c -o md5/md5.o md5/md5.c &&\ mv -f $depbase.Tpo $depbase.Po md5/md5.c:54:11: fatal error: endian.h: No such file or directory 54 | # include | ^~~~~~ compilation terminated. gmake[1]: *** [Makefile:545: md5/md5.o] Error 1

jbruchon commented 7 months ago

Grab endian.h from here: https://github.com/lattera/glibc/blob/master/string%2Fendian.h

Delete everything before the last section that defines the functions based on __BYTE_ORDER. Manually #define __BYTE_ORDER above the section to match big endian (my research shows AIX on POWER is big-endian) and replace the #include with that code. You should then get a working build.

I don't have access to AIX. How commonly used is it these days? It seems like IBM is trying to migrate people to Linux and isn't as big on AIX now.

shubhamhii commented 7 months ago

In the md5.c file, we have __BYTE_ORDER checks. All the checks are failing in AIX and in the later part of the code as mentioned below

#ifndef ARCH_IS_BIG_ENDIAN
# define ARCH_IS_BIG_ENDIAN 1   /* slower, default implementation */
#endif
#if ARCH_IS_BIG_ENDIAN

It automatically assumes the platform is BIG ENDIAN. The only fix required is to skip that inclusion of endian.h on AIX platform. So I'll be raising a PR for the same.

adrianlopezroche commented 2 months ago

Fixed by 83b005c7ccb73e29f6b94b3f474d6cc98104941b.