q9f / eth.rb

a straightforward library to build, sign, and broadcast ethereum transactions anywhere you can run ruby.
https://q9f.github.io/eth.rb
Apache License 2.0
196 stars 85 forks source link

unable to build with clang: ./warnp.c:39:9: error: call to undeclared function 'strdup' #259

Closed dpblnt closed 3 months ago

dpblnt commented 6 months ago
ERROR:  Error installing eth:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib64/ruby/gems/3.1.0/gems/scrypt-3.0.7/ext/scrypt
/usr/bin/ruby31 -I/usr/lib64/ruby/site_ruby/3.1.0 -rrubygems /usr/local/lib64/ruby/gems/3.1.0/gems/rake-13.1.0/exe/rake RUBYARCHDIR\=/usr/local/lib64/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/scrypt-3.0.7 RUBYLIBDIR\=/usr/local/lib64/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/scrypt-3.0.7
/usr/bin/ruby31 -I/usr/local/lib64/ruby/gems/3.1.0/gems/ffi-compiler-1.0.1/lib/ffi-compiler/fake_ffi -I../../lib/scrypt /usr/local/lib64/ruby/gems/3.1.0/gems/ffi-compiler-1.0.1/lib/ffi-compiler/exporter.rb ../../lib/scrypt/scrypt_ext.rb ./scrypt_ext.h
mkdir -p x86_64-linux
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -std=c99 -msse -msse2 -D_POSIX_C_SOURCE=199309L -fPIC   -o x86_64-linux/crypto_scrypt.o -c ./crypto_scrypt.c
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -std=c99 -msse -msse2 -D_POSIX_C_SOURCE=199309L -fPIC   -o x86_64-linux/crypto_scrypt_smix.o -c ./crypto_scrypt_smix.c
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -std=c99 -msse -msse2 -D_POSIX_C_SOURCE=199309L -fPIC   -o x86_64-linux/crypto_scrypt_smix_sse2.o -c ./crypto_scrypt_smix_sse2.c
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -std=c99 -msse -msse2 -D_POSIX_C_SOURCE=199309L -fPIC   -o x86_64-linux/insecure_memzero.o -c ./insecure_memzero.c
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -std=c99 -msse -msse2 -D_POSIX_C_SOURCE=199309L -fPIC   -o x86_64-linux/memlimit.o -c ./memlimit.c
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -std=c99 -msse -msse2 -D_POSIX_C_SOURCE=199309L -fPIC   -o x86_64-linux/scrypt_calibrate.o -c ./scrypt_calibrate.c
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -std=c99 -msse -msse2 -D_POSIX_C_SOURCE=199309L -fPIC   -o x86_64-linux/scrypt_ext.o -c ./scrypt_ext.c
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -std=c99 -msse -msse2 -D_POSIX_C_SOURCE=199309L -fPIC   -o x86_64-linux/scryptenc_cpuperf.o -c ./scryptenc_cpuperf.c
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -std=c99 -msse -msse2 -D_POSIX_C_SOURCE=199309L -fPIC   -o x86_64-linux/sha256.o -c ./sha256.c
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -std=c99 -msse -msse2 -D_POSIX_C_SOURCE=199309L -fPIC   -o x86_64-linux/warnp.o -c ./warnp.c
./warnp.c:39:9: error: call to undeclared function 'strdup'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   39 |         name = strdup(p);
      |                ^
./warnp.c:39:9: note: did you mean 'strcmp'?
/usr/include/string.h:156:12: note: 'strcmp' declared here
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |            ^
./warnp.c:39:7: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
   39 |         name = strdup(p);
      |              ^ ~~~~~~~~~
2 errors generated.
rake aborted!
Command failed with status (1): [clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -std=c99 -msse -msse2 -D_POSIX_C_SOURCE=199309L -fPIC   -o x86_64-linux/warnp.o -c ./warnp.c]
/usr/local/lib64/ruby/gems/3.1.0/gems/ffi-compiler-1.0.1/lib/ffi-compiler/compile_task.rb:133:in `block (2 levels) in define_task!'
/usr/local/lib64/ruby/gems/3.1.0/gems/rake-13.1.0/exe/rake:27:in `<main>'
Tasks: TOP => default => x86_64-linux/libscrypt_ext.so => x86_64-linux/warnp.o
(See full trace by running task with --trace)
q9f commented 3 months ago

this is an issue with scrypt not eth.

it works for me (tm). please share more details about your setup and what you are doing, so we can investigate!