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

sassc v2.4.0 failed to build gem native extension #2352

Closed
CaptainAwesomeDi opened this issue May 19, 2021 · 3 comments
Closed

sassc v2.4.0 failed to build gem native extension #2352

CaptainAwesomeDi opened this issue May 19, 2021 · 3 comments
Assignees
Milestone

Comments

@CaptainAwesomeDi
Copy link

Hi, I'm trying to TruffleRuby out on my local machine for my project.
but it failed to bundle install on several gem's that requires native extension, one of them being sassc which sassc-rails was depending on.

Unrelated Question: I have other two errors on building native extension for gem eventmachine and unf_ext should i also open issue here?

Hope this is helpful,
Di

My Environment:

MacOS 11.3.1 Big Sur (13 inch 2017 Macbook Pro) 16GB RAM
rails v5.2.5
truffleruby 21.2.0-dev-a28e3da1, like ruby 2.7.3, GraalVM CE Native [x86_64-darwin]

Error Output:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/gems/gems/sassc-2.4.0/ext
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/bin/truffleruby -I /Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/mri -r ./siteconf20210519-44795-5t50r5.rb
extconf.rb
creating Makefile

current directory: /Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/gems/gems/sassc-2.4.0/ext
make "DESTDIR=" clean

current directory: /Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/gems/gems/sassc-2.4.0/ext
make "DESTDIR="
compiling ./libsass/src/ast.cpp
In file included from ./libsass/src/ast.cpp:3:
In file included from ./libsass/src/sass.hpp:52:
./libsass/include/sass/base.h:76:40: error: unknown type name 'size_t'
ADDAPI void* ADDCALL sass_alloc_memory(size_t size);
                                       ^
In file included from ./libsass/src/ast.cpp:3:
In file included from ./libsass/src/sass.hpp:55:
In file included from ./libsass/src/memory.hpp:8:
In file included from ./libsass/src/memory/allocator.hpp:6:
./libsass/src/memory/../MurmurHash2.hpp:32:8: error: unknown type name 'uint32_t'
inline uint32_t MurmurHash2 ( const void * key, int len, uint32_t seed )
       ^
./libsass/src/memory/../MurmurHash2.hpp:32:58: error: unknown type name 'uint32_t'
inline uint32_t MurmurHash2 ( const void * key, int len, uint32_t seed )
                                                         ^
./libsass/src/memory/../MurmurHash2.hpp:37:9: error: unknown type name 'uint32_t'
  const uint32_t m = 0x5bd1e995;
        ^
./libsass/src/memory/../MurmurHash2.hpp:42:3: error: unknown type name 'uint32_t'
  uint32_t h = seed ^ len;
  ^
./libsass/src/memory/../MurmurHash2.hpp:50:5: error: unknown type name 'uint32_t'
    uint32_t k = *(uint32_t*)data;
    ^
./libsass/src/memory/../MurmurHash2.hpp:50:20: error: use of undeclared identifier 'uint32_t'
    uint32_t k = *(uint32_t*)data;
                   ^
./libsass/src/memory/../MurmurHash2.hpp:50:29: error: expected expression
    uint32_t k = *(uint32_t*)data;
                            ^
In file included from ./libsass/src/ast.cpp:3:
In file included from ./libsass/src/sass.hpp:55:
In file included from ./libsass/src/memory.hpp:8:
In file included from ./libsass/src/memory/allocator.hpp:8:
In file included from /Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/vector:273:
In file included from /Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/iosfwd:95:
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/wchar.h:136:77: error: use of undeclared identifier 'wcschr'
wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcschr(__s, __c);}
                                                                            ^
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/wchar.h:143:87: error: use of undeclared identifier 'wcspbrk'
wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcspbrk(__s1, __s2);}
                                                                                      ^
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/wchar.h:150:78: error: use of undeclared identifier 'wcsrchr'; did you mean
'wcschr'?
wchar_t* __libcpp_wcsrchr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcsrchr(__s, __c);}
                                                                             ^
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/wchar.h:138:16: note: 'wcschr' declared here
const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
               ^
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/wchar.h:157:86: error: use of undeclared identifier 'wcsstr'; did you mean
'wcschr'?
wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
                                                                                     ^
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/wchar.h:140:16: note: 'wcschr' declared here
      wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
               ^
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/wchar.h:157:86: error: no matching function for call to 'wcschr'
wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
                                                                                     ^
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/wchar.h:140:16: note: candidate disabled: <no message provided>
      wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
               ^
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/wchar.h:157:93: error: cannot initialize a parameter of type 'wchar_t *' with
an lvalue of type 'const wchar_t *'
wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
                                                                                            ^~~~
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/wchar.h:140:38: note: passing argument to parameter '__s' here
      wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
                                     ^
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/wchar.h:164:60: error: unknown type name 'size_t'
wchar_t* __libcpp_wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return (wchar_t*)wmemchr(__s, __c, __n);}
                                                           ^
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/wchar.h:166:57: error: unknown type name 'size_t'
const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
                                                        ^
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/wchar.h:168:57: error: unknown type name 'size_t'
      wchar_t* wmemchr(      wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
                                                        ^
In file included from ./libsass/src/ast.cpp:3:
In file included from ./libsass/src/sass.hpp:55:
In file included from ./libsass/src/memory.hpp:8:
In file included from ./libsass/src/memory/allocator.hpp:8:
In file included from /Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/vector:273:
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/iosfwd:189:14: error: use of undeclared identifier 'mbstate_t'
typedef fpos<mbstate_t>    streampos;
             ^
/Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/llvm-toolchain/bin/../include/c++/v1/iosfwd:190:14: error: use of undeclared identifier 'mbstate_t'
typedef fpos<mbstate_t>    wstreampos;
             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [ast.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/gems/gems/sassc-2.4.0 for inspection.
Results logged to /Users/scouttalent2/.rbenv/versions/truffleruby-dev/lib/gems/extensions/x86_64-darwin/2.7.3.1/sassc-2.4.0/gem_make.out

An error occurred while installing sassc (2.4.0), and Bundler cannot continue.
Make sure that `gem install sassc -v '2.4.0' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  sass-rails was resolved to 6.0.0, which depends on
    sassc-rails was resolved to 2.1.2, which depends on
      sassc
(base) FAIL​​​​​​
@eregon
Copy link
Member

eregon commented May 19, 2021

Thanks for the report.

I think you are hitting this issue, which specific to macOS 11.3+: oracle/graal#3383
@rschatz is working on that, once there is a new LLVM toolchain with that fix it should work.

eventmachine and unf_ext are also C++ extensions so it's very likely the same issue.

@eregon
Copy link
Member

eregon commented May 19, 2021

Unfortunately I don't think there is an easy workaround available until that's fixed (macOS 11.3 broke LLVM 11 and before it seems).
oracle/graal#3383 (comment) is possible but would require to build TruffleRuby yourself (with jt build --env native).
If you have a Linux system or an older macOS, or Docker then those gems should install fine.

@eregon eregon self-assigned this May 28, 2021
@eregon eregon added this to the 21.2.0 milestone May 28, 2021
@eregon
Copy link
Member

eregon commented Jun 20, 2021

This has been fixed for a while and will be in the next release: oracle/graal#3383 (comment)

@eregon eregon closed this as completed Jun 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants