Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis 7.2 undefined symbol: RedisModule_TryCalloc + my fix #67

Open
fcbry opened this issue Aug 12, 2024 · 0 comments
Open

Redis 7.2 undefined symbol: RedisModule_TryCalloc + my fix #67

fcbry opened this issue Aug 12, 2024 · 0 comments

Comments

@fcbry
Copy link

fcbry commented Aug 12, 2024

If I use this repository as so :

export RM_INCLUDE_DIR=$(pwd)/7.0
make clean 
make 
make run

I get the following output/error :

root@cd9eedca996e:~/RedisModulesSDK# make
make -C ./example
make[1]: Entering directory '/root/RedisModulesSDK/example'
make -C ../rmutil
make[2]: Entering directory '/root/RedisModulesSDK/rmutil'
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I/root/RedisModulesSDK/7.0   -c -o util.o util.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I/root/RedisModulesSDK/7.0   -c -o strings.o strings.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I/root/RedisModulesSDK/7.0   -c -o sds.o sds.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I/root/RedisModulesSDK/7.0   -c -o vector.o vector.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I/root/RedisModulesSDK/7.0   -c -o alloc.o alloc.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I/root/RedisModulesSDK/7.0   -c -o periodic.o periodic.c
ar rcs librmutil.a util.o strings.o sds.o vector.o alloc.o periodic.o
make[2]: Leaving directory '/root/RedisModulesSDK/rmutil'
gcc -I/root/RedisModulesSDK/7.0 -Wall -g -fPIC -lc -lm -std=gnu99     -c -o module.o module.c
ld -o module.so module.o -shared -Bsymbolic  -L../rmutil -lrmutil -lc
make[1]: Leaving directory '/root/RedisModulesSDK/example'
cp ./example/module.so .
root@cd9eedca996e:~/RedisModulesSDK# make run
redis-server --loadmodule ./module.so
4775:C 12 Aug 2024 17:11:11.052 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
4775:C 12 Aug 2024 17:11:11.052 * Redis version=7.2.5, bits=64, commit=00000000, modified=0, pid=4775, just started
4775:C 12 Aug 2024 17:11:11.052 * Configuration loaded
4775:M 12 Aug 2024 17:11:11.052 * monotonic clock: POSIX clock_gettime
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 7.2.5 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 4775
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           https://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

4775:M 12 Aug 2024 17:11:11.053 # Module ./module.so failed to load: ./module.so: undefined symbol: RedisModule_TryCalloc
4775:M 12 Aug 2024 17:11:11.053 # Can't load module from ./module.so: server aborting
make: *** [Makefile:27: run] Error 1

But, If I download the redismodule.h file from the redis repo 7.2 branch, everything works fine, solving my problem.

root@cd9eedca996e:~/RedisModulesSDK# curl  https://raw.githubusercontent.com/redis/redis/7.2/src/redismodule.h
-O
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 99677  100 99677    0     0   555k      0 --:--:-- --:--:-- --:--:--  556k
root@cd9eedca996e:~/RedisModulesSDK# make clean
rm -rf *.xo *.so *.o
rm -rf ./example/*.xo ./example/*.so ./example/*.o
rm -rf ./rmutil/*.so ./rmutil/*.o ./rmutil/*.a
root@cd9eedca996e:~/RedisModulesSDK# make
make -C ./example
make[1]: Entering directory '/root/RedisModulesSDK/example'
make -C ../rmutil
make[2]: Entering directory '/root/RedisModulesSDK/rmutil'
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I/root/RedisModulesSDK/7.0   -c -o util.o util.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I/root/RedisModulesSDK/7.0   -c -o strings.o strings.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I/root/RedisModulesSDK/7.0   -c -o sds.o sds.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I/root/RedisModulesSDK/7.0   -c -o vector.o vector.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I/root/RedisModulesSDK/7.0   -c -o alloc.o alloc.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I/root/RedisModulesSDK/7.0   -c -o periodic.o periodic.c
ar rcs librmutil.a util.o strings.o sds.o vector.o alloc.o periodic.o
make[2]: Leaving directory '/root/RedisModulesSDK/rmutil'
gcc -I/root/RedisModulesSDK/7.0 -Wall -g -fPIC -lc -lm -std=gnu99     -c -o module.o module.c
ld -o module.so module.o -shared -Bsymbolic  -L../rmutil -lrmutil -lc
make[1]: Leaving directory '/root/RedisModulesSDK/example'
cp ./example/module.so .

root@cd9eedca996e:~/RedisModulesSDK# make run
redis-server --loadmodule ./module.so
4920:C 12 Aug 2024 17:15:19.514 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
4920:C 12 Aug 2024 17:15:19.514 * Redis version=7.2.5, bits=64, commit=00000000, modified=0, pid=4920, just started
4920:C 12 Aug 2024 17:15:19.514 * Configuration loaded
4920:M 12 Aug 2024 17:15:19.514 * monotonic clock: POSIX clock_gettime
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 7.2.5 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 4920
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           https://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

4920:M 12 Aug 2024 17:15:19.515 * Module 'example' loaded from ./module.so
4920:M 12 Aug 2024 17:15:19.515 * Server initialized
4920:M 12 Aug 2024 17:15:19.515 * Loading RDB produced by version 7.2.5
4920:M 12 Aug 2024 17:15:19.515 * RDB age 12 seconds
4920:M 12 Aug 2024 17:15:19.515 * RDB memory usage when created 0.84 Mb
4920:M 12 Aug 2024 17:15:19.515 * Done loading RDB, keys loaded: 0, keys expired: 0.
4920:M 12 Aug 2024 17:15:19.515 * DB loaded from disk: 0.000 seconds
4920:M 12 Aug 2024 17:15:19.515 * Ready to accept connections tcp

I'd give you a PR but:

  1. I don't fully understand your intent/release matching pattern
  2. I'm very basic in the c space.

Best of luck

Bryan

fcbry added a commit to fcbry/RedisModulesSDK that referenced this issue Aug 12, 2024
RedisLabsModules#67

Signed-off-by: fcbry <bryan.hunt@foodsconnected.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant