git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Minor portability issues + fixes

From
Daniel Richard G. <skunk@iskunk.org>
Date
May 19, 2020, 01:15 UTC
Message-ID
<7422404e-7fc8-4961-aae4-3f0adb71bb3a@www.fastmail.com>
Hello list,

I am building Git 2.26.2 on AIX. A few compilation errors arose, but they are resolvable with a few minor changes that will improve overall portability.

There were a few errors of this form:
    sha1-file.c: In function 'mmap_limit_check':
    sha1-file.c:940:12: error: 'SIZE_MAX' undeclared (first use in this function)
    sha1-file.c:940:12: note: each undeclared identifier is reported only once for each function it appears in

SIZE_MAX is defined in stdint.h, and adding that #include fixes this. It is likely that this header is being pulled in on other platforms due to transitive dependencies, but that does not occur on AIX.

The following files need #include<stdint.h>:
    sha1-file.c
    utf8.c
    vcs-svn/svndiff.c
    wrapper.c

(I am not sure of the correct place to add a header like this; I have only verified that adding it to the .c file directly solves the problem.)

Then, at link time, I saw this:
    rm -f xdiff/lib.a && ar rcs xdiff/lib.a xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o xdiff/xmerge.o xdiff/xpatience.o xdiff/xhistogram.o
    gcc  -D_ALL_SOURCE -D_THREAD_SAFE   -I. -D_LARGE_FILES -DGIT_HOST_CPU="\"00XXXXXXXXXX\"" -I/nfs/freeport/arch/aix32/include -DNO_CURL -I/nfs/freeport/arch/aix32/include -DNO_OPENSSL -DNO_D_TYPE_IN_DIRENT -DNO_NSEC -Dsockaddr_storage=sockaddr_in6 -DNO_ICONV -DOLD_ICONV -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK -DNO_PTHREADS -DHAVE_PATHS_H -DHAVE_STRINGS_H -DHAVE_CLOCK_GETTIME  -DSNPRINTF_RETURNS_BOGUS -DFREAD_READS_DIRECTORIES -DNO_STRCASESTR -DNO_STRLCPY -DNO_STRTOUMAX -DNO_SETENV -DNO_MKDTEMP -DNO_UNSETENV -DNO_PREAD -DNO_MEMMEM -DINTERNAL_QSORT -Icompat/regex -DFILENO_IS_A_MACRO -DNEED_ACCESS_ROOT_HANDLER -DDEFAULT_EDITOR='"nano"' -DDEFAULT_PAGER='"more"' -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"' -o git-credential-store   credential-store.o common-main.o libgit.a xdiff/lib.a  -L/nfs/freeport/arch/aix32/lib /nfs/freeport/arch/aix32/lib -L/nfs/freeport/arch/aix32/lib /nfs/freeport/arch/aix32/lib -lz -lintl
    ld: 0711-168 SEVERE ERROR: Input file: /nfs/freeport/arch/aix32/lib
            Input files must be regular files.
    collect2: error: ld returned 12 exit status
    Makefile:2456: recipe for target 'git-credential-store' failed
    gmake: *** [git-credential-store] Error 1

After some investigation, I found that this resulted from the following configure-time determination:

    configure:4774: WARNING: linker does not support runtime path to dynamic libraries
    (from line 488 of configure.ac)

The problem is, in this case, CC_LD_DYNPATH is set to an empty value--- which is incorrect, in light of how it is used in the Makefile. Here is a typical example:

    ifdef ZLIB_PATH
            BASIC_CFLAGS += -I$(ZLIB_PATH)/include
            EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
    endif
    EXTLIBS += -lz

Setting that variable to an empty value causes a bare directory to be passed to the linker, which of course then errors out. I would suggest setting it to "-L" instead.

(The libraries I am using are all static archives, so I am not hampered by a lack of runtime library paths.)

--Daniel
-- 
Daniel Richard G. || skunk@iSKUNK.ORG
My ASCII-art .sig got a bad case of Times New Roman.
Next: Jeff King
Message 1 of 8 in “Minor portability issues + fixes”
  1. Daniel Richard G.May 19, 2020
  2. Jeff KingMay 19, 2020
  3. Daniel Richard G.May 19, 2020
  4. Jeff KingMay 20, 2020
  5. Daniel Richard G.May 21, 2020
  6. Jeff KingMay 22, 2020
  7. Carlo Marcelo Arenas BelónMay 19, 2020
  8. Daniel Richard G.May 19, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.