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

error: fmod is not a member of std #149

Open
dima4p opened this issue Aug 28, 2019 · 13 comments
Open

error: fmod is not a member of std #149

dima4p opened this issue Aug 28, 2019 · 13 comments

Comments

@dima4p
Copy link

dima4p commented Aug 28, 2019

Hello, while installing the gem I've got the problem to compile the extension.

$ gem install sassc -v '2.2.0' --source 'https://rubygems.org/'                     Building native extensions. This could take a while...
ERROR:  Error installing sassc:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/rvm/gems/ruby-2.6.3@my_project/gems/sassc-2.2.0/ext
/usr/local/rvm/rubies/ruby-2.6.3/bin/ruby -I /usr/local/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0 -r ./siteconf20190828-18319-ou8ovf.rb extconf.rb
creating Makefile

current directory: /usr/local/rvm/gems/ruby-2.6.3@my_project/gems/sassc-2.2.0/ext
make "DESTDIR=" clean

current directory: /usr/local/rvm/gems/ruby-2.6.3@my_project/gems/sassc-2.2.0/ext
make "DESTDIR="
compiling ./libsass/src/color_maps.cpp
In file included from ./libsass/src/ast.hpp:19:0,
                 from ./libsass/src/color_maps.cpp:5:
./libsass/src/util.hpp: In function ‘T Sass::absmod(const T&, const T&)’:
./libsass/src/util.hpp:28:11: error: ‘fmod’ is not a member of ‘std’
     T m = std::fmod(n, r);
           ^
./libsass/src/util.hpp:28:11: note: suggested alternative:
In file included from /usr/include/features.h:368:0,
                 from /usr/include/c++/5.5.0/x86_64-slackware-linux/bits/os_defines.h:39,
                 from /usr/include/c++/5.5.0/x86_64-slackware-linux/bits/c++config.h:489,
                 from /usr/include/c++/5.5.0/string:38,
                 from ./libsass/src/sass.hpp:55,
                 from ./libsass/src/color_maps.cpp:3:
/usr/include/bits/mathcalls.h:187:1: note:   ‘fmod’
 __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
 ^
Makefile:235: recipe for target 'color_maps.o' failed
make: *** [color_maps.o] Error 1

My gcc is:

$ gcc -v
Reading specs from /usr/lib64/gcc/x86_64-slackware-linux/5.5.0/specs
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-slackware-linux/5.5.0/lto-wrapper
Target: x86_64-slackware-linux
Configured with: ../gcc-5.5.0/configure --prefix=/usr --libdir=/usr/lib64 --mandir=/usr/man --infodir=/usr/info --enable-shared --enable-bootstrap --enable-languages=ada,c,c++,fortran,go,java,lto,objc --enable-threads=posix --enable-checking=release --enable-objc-gc --with-system-zlib --with-python-dir=/lib64/python2.7/site-packages --enable-libstdcxx-dual-abi --with-default-libstdcxx-abi=gcc4-compatible --disable-libunwind-exceptions --enable-__cxa_atexit --enable-libssp --enable-lto --disable-install-libiberty --with-gnu-ld --verbose --enable-java-home --with-java-home=/usr/lib64/jvm/jre --with-jvm-root-dir=/usr/lib64/jvm --with-jvm-jar-dir=/usr/lib64/jvm/jvm-exports --with-arch-directory=amd64 --with-antlr-jar=/home/slackware/slackbuilds/gcc-5.5.0/antlr-runtime-3.4.jar --enable-multilib --target=x86_64-slackware-linux --build=x86_64-slackware-linux --host=x86_64-slackware-linux
Thread model: posix
gcc version 5.5.0 (GCC) 

With the version 2.1.0 there is no problem

@dima4p dima4p changed the title error: ‘fmod’ is not a member of ‘std’ error: fmod is not a member of std Aug 28, 2019
@glebm
Copy link
Contributor

glebm commented Aug 28, 2019

Version 2.1.0 comes with a pre-compiled library for Linux+glibc but the new version doesn't.

This seems to be a bug (missing include) that's been fixed on libsass master but is not in any release yet. This missing include seems to only break some compiler versions.

@dima4p
Copy link
Author

dima4p commented Aug 29, 2019

@glebm, so it seems to be easy fixable?

@RaymondFallon
Copy link

Hey @glebm, thanks for identifying the problem! Is there any way to estimate when this fix will be included in a new release?

@dima4p
Copy link
Author

dima4p commented Sep 3, 2019

@RaymondFallon, is not it easier to fix the line

./libsass/src/util.hpp:28:11

?

@taca
Copy link

taca commented Sep 16, 2019

Bellow code might help.

--- ext/libsass/src/util.hpp.orig	2019-09-16 15:47:08.475272400 +0000
+++ ext/libsass/src/util.hpp
@@ -9,6 +9,7 @@
 #include "ast_fwd_decl.hpp"
 
 #include <cstring>
+#include <cmath>
 #include <vector>
 #include <string>
 #include <assert.h>

@vmiheer
Copy link

vmiheer commented Nov 7, 2019

#153 is dupe of this.
Someone maybe need to update the libsass submodule? So that cmath would be included as per @taca's suggestion?

@ahorek
Copy link

ahorek commented Nov 7, 2019

update the libsass submodule? see #164

@vmiheer
Copy link

vmiheer commented Nov 7, 2019

@ahorek, yup that release has include. So potentially fix the issue.

@vmiheer
Copy link

vmiheer commented Nov 8, 2019

I built the gem with the modification and used as part of jekyll, things work without hitch.

@dima4p
Copy link
Author

dima4p commented Nov 11, 2019

The problem for me was the version of GCC compiler.
After I have upgraded it from 5.5.0 to 9.2.0 all is OK.
Probably gem should check the version and report it at install.

@JuPlutonic
Copy link

JuPlutonic commented Nov 11, 2019

After upgrade of GCC from 5.5.0 to 8.3.0 the installation process successfully finished:
Installing sassc 2.2.1 (was 2.1.0) with native extensions🛠
Upd. just brew unlink gcc

@vmiheer
Copy link

vmiheer commented Nov 11, 2019

Note: upgrading compiler isn't always solution e.g. linuxbrew uses gcc 5.5.

@rscircus
Copy link

brew uninstall --ignore-dependencies gcc solved it for me.

Be aware that you should know what you are doing and have replacements available. Like sudo apt-get install ruby-full build-essential zlib1g-dev or something similar. Else the other apps brew installed might stop working for you.

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

8 participants