Hiredis: undefined reference to `hi_malloc(unsigned long)'

Created on 27 Feb 2020  路  8Comments  路  Source: redis/hiredis

I recently used hiredis in a project and made it into a docker image, the docker image was used in the project and worked fine, this was 2 months ago 17th of December. I recently changed a flag for OpenCV in the original Dockerfile and recreated a new image, I now seem to have a error as seen, below. I believe this may be because my Dockerfile clones the current hiredis repo with the new changes, and a new change may have caused this bug/error. Please note I get this error when just importing redis and not even using it.

/tmp/ccd0E4XK.o: In function `redisLibevAttach(ev_loop*, redisAsyncContext*)':
/usr/local/include/hiredis/adapters/libev.h:122: undefined reference to `hi_malloc(unsigned long)'

Most helpful comment

@michael-grunder

Hey, Just to help out whoever runs into this -- We're running into this issue, as well. We encountered it, while doing an OS upgrade, and discovered that the workaround was to a manual install from git/source: details below.

From (works)

Ubuntu 16.04.6, GCC 5.4.0, CMake 3.5.1, libhiredis 0.13 (via apt get)

To (broken)

Ubuntu 20.04.0, GCC 9.3.0, CMake 3.16.3, libhiredis 0.14.0 (via apt get)

To (works)

Ubuntu 20.04.0, GCC 9.3.0, CMake 3.16.3, libhiredis 0.14.1 (manual install)

  1. $ git clone https://github.com/redis/hiredis.git
  2. $ cd hiredis
  3. $ git checkout v0.14.1 *
  4. $ make
  5. # make install
  6. (link in our application)

edit: * fixed minor version number -- thanks @ptalus

All 8 comments

Can you try again? I merged a few housekeeping fixes that are likely related to your issue.

Hi Michael thanks for the reply and changes although, I am still having the issue with the latest commit. Thanks.

Perhaps it's attempting to link to an older version of hiredis? I bumped the version to 0.15.0 in this repo as we'll need to do that before any official release.

It's hard to say for sure without a Dockerfile that lets me replicate the problem, but this error is _exactly_ what I would expect when attempting to link to an older version of libhiredis.so.0.14.

If you can provide a Dockerfile to replicate the issue I'm happy to help.

@DoctorUSB Are you still having issues?

I'm going to close the issue because there hasn't been any activity but if you're still running into problems please reopen and let me know.

@michael-grunder

Hey, Just to help out whoever runs into this -- We're running into this issue, as well. We encountered it, while doing an OS upgrade, and discovered that the workaround was to a manual install from git/source: details below.

From (works)

Ubuntu 16.04.6, GCC 5.4.0, CMake 3.5.1, libhiredis 0.13 (via apt get)

To (broken)

Ubuntu 20.04.0, GCC 9.3.0, CMake 3.16.3, libhiredis 0.14.0 (via apt get)

To (works)

Ubuntu 20.04.0, GCC 9.3.0, CMake 3.16.3, libhiredis 0.14.1 (manual install)

  1. $ git clone https://github.com/redis/hiredis.git
  2. $ cd hiredis
  3. $ git checkout v0.14.1 *
  4. $ make
  5. # make install
  6. (link in our application)

edit: * fixed minor version number -- thanks @ptalus

3. `$ git co v0.14.0`

`$ git checkout v0.14.1

my temporary fix:

// wsl2 you suck...
void *hi_malloc(unsigned long size){
return malloc(size);
}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ShePastAway0 picture ShePastAway0  路  7Comments

gameyin picture gameyin  路  6Comments

lmcd picture lmcd  路  17Comments

yudataguy picture yudataguy  路  10Comments

guotie picture guotie  路  8Comments