ruby-packer icon indicating copy to clipboard operation
ruby-packer copied to clipboard

Implicit declaration in C99 error when packing a rails project using Ruby 2.4.10

Open dennislysenko opened this issue 4 years ago • 3 comments

Hey @pmq20 first of all, I'm really glad you decided to work on a library like this as it's something I've been looking for for a long time.

I'm having an issue compiling a base project made by just installing ruby 2.4.10 via rvm, generating a base rails project (rails new testproject), and packing that project using rubyc -r .. Same issue in ruby 2.5.

Relevant log lines:

squash_dir.c:479:2: error: implicit declaration of function 'free' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        free(path0);
        ^
1 error generated.
make: *** [squash_dir.o] Error 1
Failed running [{"CI"=>"true", "ENCLOSE_IO_USE_ORIGINAL_RUBY"=>"1", "CFLAGS"=>" -fPIC -O3 -fno-fast-math -ggdb3 -Os -fdata-sections -ffunction-sections -pipe  -I/var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/zlib  -I/var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/openssl/include  -I/var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/gdbm/build/include  -I/var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/yaml/build/include  -I/var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/libffi/build/lib/libffi-3.2.1/include  -I/var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/ncurses/build/include  -I/var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/readline/build/include ", "LDFLAGS"=>" -L/var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/zlib /var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/zlib/libz.a  -L/var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/openssl  -L/var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/gdbm/build/lib  -L/var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/yaml/build/lib  -L/var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/libffi/build/lib  -L/var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/ncurses/build/lib  -L/var/folders/ts/g6q5nn2x3sv4xnz3f7wzyd840000gn/T/rubyc/readline/build/lib ", "ENCLOSE_IO_RUBYC_1ST_PASS"=>"1", "ENCLOSE_IO_RUBYC_2ND_PASS"=>nil}, "make -j4 -j1"]

More logs at https://pastebin.com/VZGqqtst

I'm guessing this is some sort of issue with my system setup but I'm not really sure where to start. Any ideas? Should I be using another ruby version?

dennislysenko avatar Feb 11 '21 19:02 dennislysenko

Are you able to solve this issue @dennislysenko? I am also having the same issue. Can you please post the answer if you got the solution?

tasdendu avatar Mar 18 '21 10:03 tasdendu

With help of @CAMOBAP on macOS this error disappeared with:

env CC="xcrun clang -mmacosx-version-min=10.10 -Wno-implicit-function-declaration" bin/rubyc --clean-tmp bin/rubyc -o rubyc-darwin-x64

alexeymorozov avatar Apr 22 '21 14:04 alexeymorozov

I'm getting a similar issue trying to build an executable gem (see issue #170). Would something like this solution help you think?

soumyaray avatar Nov 12 '22 15:11 soumyaray