Git dependency errors when using Composer with private VCS repository on IBM i

3

More details below, but I'm running into the following error when I issue a composer install or composer update command on a project which uses a custom VCS repository for an included project. This is on an IBM i v7r3 system via SSH session. I've run out of ideas on how to troubleshoot further, so here I am. Has anyone ever seen this error or have any ideas on how to troubleshoot further?

Error:

bash-4.4$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 113 installs, 0 updates, 0 removals
  - Installing sshUser/myPackage (v1.0.26): Cloning a2db0666b1


  [RuntimeException]
  Failed to clone gitUser:/opt/git/myPackage.git, git was not found, check that
   it is installed and in your PATH env.

  Could not load program git:
        Dependent module /usr/local/zendphp7/lib/libz.so.1(shr_64.o) could not be loaded.

        File /usr/local/zendphp7/lib/libz.so.1 is not an

          archive or the file could not be read properly.

  System error: Exec format error

I have a remote IBM i server which has two users. The first user "gitUser" is used for my private Git repositories (headless). I then have another user "sshUser" which is used to SSH in with and do my typical work. I have SSH keys configured to simplify connections for both users and the "gitUser" ssh key doesn't require a password, so I can use it for automated scripting.

I have a private VCS repository included in my composer.json file for a project. So long as I have the entry in the "repository" section I'm getting the above error. This occurs even if I'm not requireing a package from the repository.

Repository Entry:

"repositories": [
    {
        "type": "vcs",
        "url":  "gitUser:/opt/git/myPackage.git"
    }
]

Composer on the IBM i is up to date at 1.7.2.

It's clear the issue lies with git and the inability to find a dependency in libz.so.1.

However, if I follow the chain of dependencies for the version of Git in my path, all the appropriate files exist with adequate permissions:

bash-4.4$ which git                                                   
/QOpenSys/pkgs/bin/git                                                
bash-4.4$ dump -X64 -H /QOpenSys/pkgs/bin/git                         

/QOpenSys/pkgs/bin/git:                                               

                        ***Loader Section***                          
                      Loader Header Information                       
VERSION#         #SYMtableENT     #RELOCent        LENidSTR           
0x00000001       0x000000df       0x0000433f       0x0000009d         

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL          
0x00000006       0x00044910       0x00000a18       0x000449ad         


                        ***Import File Strings***                     
INDEX  PATH                          BASE                MEMBER       
0      /QOpenSys/pkgs/lib:/QOpenSys/usr/lib                           
1                                    libz.so.1           shr_64.o     
2                                    libiconv.so.2       shr_64.o     
3                                    libcrypto.so.1.0.0  shr_64.o     
4                                    libpthread.a        shr_xpg5_64.o
5                                    libc.a              shr_64.o     
bash-4.4$                                                             

I can confirm there are no permission failures through out all of this. So this doesn't seem to be the result of inadequate permissions. Also, I do not think the issue lies within the user profile gitUser as if I issue a composer install or composer update from another machine (with appropriate keys), everything works flawlessly. So it seems to be specific to the IBM i and the sshUser profile.

I'm starting to think Composer is using a different git executable and the dependencies of that executable do not exist. Though I assume Composer would just use my path.

Note*: I tried specifying my LIBPATH in my ./.profile with the following. But it doesn't seem to make any difference:

LIBPATH=/usr/local/zendphp7/lib
LIBPATH=$LIBPATH:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib
export LIBPATH

When echoing:

bash-4.4$ echo $LIBPATH
/usr/local/zendphp7/lib:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib
bash-4.4$

If I don't add the above to my ./.profile, then echo $LIBPATH prints a blank line to screen.

Solution: I just changed the symlink in the ZENDPHP7 directory structure to the repo version. Alternatively you can manipulate your library path, but I couldn't figure out the proper way to do it on IBM i.

bash-4.4$ pwd
/usr/local/zendphp7/lib
bash-4.4$ ln -s /QOpenSys/pkgs/lib/libz.so.1 ./libz.so.1
bash-4.4$ ls -la /usr/local/zendphp7/lib/libz.so.1
lrwxrwxrwx 1 dl 0 56 Oct 11 14:21 /usr/local/zendphp7/lib/libz.so.1 -> /QOpenSys/pkgs/lib/libz.so.1
bash-4.4$
bash
git
composer-php
ibm-midrange
asked on Stack Overflow Oct 10, 2018 by d.lanza38 • edited Oct 11, 2018 by d.lanza38

1 Answer

2

I'm guessing something is off with your path when you do the install. Is it maybe looking at the Zend PHP libraries rather than the expected ones in /usr/lib?

Notice that the errors shows a path of /usr/local/zendphp7/lib/ libz.so.1(shr_64.o) while your git dump instead shows /QOpenSys/pkgs/lib:/QOpenSys/usr/lib.

answered on Stack Overflow Oct 10, 2018 by Player1st

User contributions licensed under CC BY-SA 3.0