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

isnan and isinf belongs to std namespace #115

Closed
ghost opened this issue Sep 9, 2017 · 8 comments · Fixed by #123
Closed

isnan and isinf belongs to std namespace #115

ghost opened this issue Sep 9, 2017 · 8 comments · Fixed by #123

Comments

@ghost
Copy link

ghost commented Sep 9, 2017

Hi !

I'm discovering epsilon and for my first build, I used a docker container with the latest Ubuntu:

apt-get update
apt upgrade
apt install git make gcc libfreetype6-dev bison g++ flex python clang libfltk1.3-dev
git clone https://github.com/numworks/epsilon.git
cd epsilon/
make PLATFORM=simulator

I got plenty of error in a lot of files like:

poincare/src/complex.cpp:362:7: error: use of undeclared identifier 'isinf'
  if (isinf(truncatedMantissa) || isnan(truncatedMantissa)) {
      ^
poincare/src/complex.cpp:368:9: error: use of undeclared identifier 'isnan'
    if (isnan(newLogBase10) || isinf(newLogBase10)) {
        ^

I suppose this error didn't showed to other people before and I don't quite understand why.

g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)

Anyway, It appears that isnan and isinf belongs to std namespace so I replaced
isnan -> std::isnan
isinf -> std::isinf
in all concerned files and now it builds.

A patch is ready, would you want a PR ?

EDIT: this problems does not show up when not building for the simulator target.

@adriweb
Copy link
Contributor

adriweb commented Sep 9, 2017

Note: that error looks like it's using clang to compile. You can check by doing make PLATFORM=simulator info

@ghost
Copy link
Author

ghost commented Sep 10, 2017

ops, yes it's clang

make PLATFORM=simulator info
========= BUILD SETTINGS ======
DEBUG = 0
PLATFORM = simulator
CC = clang
CXX = clang++
LD = clang++
CFLAGS = -std=c99
CXXFLAGS = -std=c++11 -fno-exceptions -fno-rtti -fno-threadsafe-statics
SFLAGS = -fPIE -DDEBUG=0 -DOS_WITH_ONBOARDING_APP=0 -DOS_WITH_SOFTWARE_UPDATE_PROMPT=0 -DQUIZ_USE_CONSOLE=0 -Os -Ilib -I. -Wall -MD -MP -Iliba/include/bridge -Iion/include -DKD_CONFIG_H=1  -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/freetype2 -DCP936  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT -Ikandinsky/include -Ipoincare/include -Ipython/src -Ipython/port -Iescher/include -Iquiz/include
LDFLAGS = -Wl,-Bsymbolic-functions -lfltk -lX11
===============================
clang++ -v
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

@rhaamo
Copy link
Contributor

rhaamo commented Sep 10, 2017

hi,

clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)

clang 3.x is too old, you need at least clang 4.0 to build.

@adriweb
Copy link
Contributor

adriweb commented Sep 10, 2017

Nah it’s fine. I’ve built epsilon with clang 3.5.

@ghost
Copy link
Author

ghost commented Sep 11, 2017

Same error with clang 4.0.0 :/

@adriweb
Copy link
Contributor

adriweb commented Sep 11, 2017

Eh, then I guess a PR is needed.

@adriweb
Copy link
Contributor

adriweb commented Sep 11, 2017

FTR:

Those functions are in the provided math.h
It looks like commit 1964d61 isn't quite liked by some toolchains, possibly confusing the provided cmath and the system one?
Maybe a #include <math.h> would work instead of #include <cmath>.

@lyda
Copy link

lyda commented Oct 5, 2017

Not a huge C++ user, but #191 worked for me. Not sure if #123 or this PR are better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants