Fatal error cmath no such file or directory

I wrote the simple program in linux ubuntu, when I use g++ there is no error but when I use gcc I see this error: test.c:1:17: fatal error: cmath: No such file or directory #include ...

I wrote the simple program in linux ubuntu, when I use g++ there is no error but when I use gcc I see this error:

test.c:1:17: fatal error: cmath: No such file or directory  #include <cmath>

Note : «as a matter of fact I see this error in compiling the package, I thought it might be related to gcc library which is not set to linux environment, so I wrote the simple program to determine the error clearly and whitout dependency!»
so the program should compile with gcc so that I can over come the main problem.
I khow that I can use math.h instead of cmath, but the packege used the cmath!
this is the simple program:

   /*test.c*/
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int main(){
        double sinx =   sin(3.14/3);
cout<< "sinx= " << sinx;

return 0;
}

here is cmath pathes:

root@geant4:/# find -name cmath
./opt/root5.32.00/cint/cint/include/cmath
./app/gcc/4.8.0/include/c++/4.8.0/ext/cmath
./app/gcc/4.8.0/include/c++/4.8.0/cmath
./app/gcc/4.8.0/include/c++/4.8.0/tr1/cmath
./usr/include/boost/compatibility/cpp_c_headers/cmath
./usr/include/boost/tr1/tr1/cmath
./usr/include/c++/4.5/cmath
./usr/include/c++/4.5/tr1_impl/cmath
./usr/include/c++/4.5/tr1/cmath
./usr/include/c++/4.6/cmath
./usr/include/c++/4.6/tr1/cmath
./usr/share/gccxml-0.9/GCC/2.95/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c_global/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c_std/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/testsuite/26_numerics/headers/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath

and after installing gcc-4.8 I did this instruction:

root@geant4:~/Desktop# update-alternatives --install /usr/bin/gcc gcc /app/gcc/4.8.0/bin/gcc 40 --slave /usr/bin/g++ g++ /app/gcc/4.8.0/bin/g++

root@geant4:~/Desktop#update-alternatives --install /usr/bin/gcc gcc /app/gcc/4.8.0/bin/gcc 60 --slave /usr/bin/g++ g++ /app/gcc/4.8.0/bin/g++
root@geant4:~/Desktop# update-alternatives --config gcc

to make gcc-4.8 my default gcc.

now

root@geant4:~/Desktop# gcc --version
gcc (GCC) 4.8.0
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

as a matter of fact I wrote the main problem in https://askubuntu.com/questions/309195/cmath-no-such-file-or-directory-include-cmath

please help me
I don`t know what to do.
thanks

I downloaded and try to installed the package «wfconvert» from this link . but I got some error.

here what I did:

  1. copy the wfconvert folder in root «/»
  2. cd /wfconvert/build/

    root@geant4:/wfconvert/build# cmake ..
    
    -- Current revision : 65 modified on 2013-01-16 22:14:53 +0330 (Wed, 16 Jan 2013)  
    -- Found mpi.h and libraries. Check for working mpi compiler  
    -- MPI is disabled  
    -- Failed to link LAPACK, BLAS, ATLAS libraries with environments. Going to search standard paths.  
    -- LAPACK_LIBRARIES=/usr/lib/liblapack.so  
    -- BLAS_LIBRARIES=/usr/lib/libblas.so  
    -- CXX compiler flags:  -g -O3 -ftemplate-depth-60 -Drestrict=__restrict__ -funroll-all-loops   -finline-limit=1000 -Wno-deprecated  -mmmx -msse -msse2 -msse3 -fopenmp  
    -- CC  compiler flags:  -O3 -Drestrict=__restrict__ -funroll-all-loops   -finline-limit=1000 -std=gnu99 -fomit-frame-pointer  -mmmx -msse -msse2 -msse3  
    -- LIBXML2_INCLUDE_DIR=/usr/include/libxml2  
    -- LIBXML2_LIBRARIES=/usr/lib/libxml2.so  
    -- HDF5_INCLUDE_DIR=/usr/include  
    -- HDF5_LIBRARIES=/usr/lib/libhdf5.so  
    -- FFTW_INCLUDE_DIR=/usr/include  
    -- FFTW_LIBRARIES=/usr/lib/libfftw3.so  
    -- Ready to build qmcpack  
    -- Configuring done  
    -- Generating done  
    -- Build files have been written to: /wfconvert/build  
    
  3. make command

    root@geant4:/wfconvert/build# make
    
    [  1%] Building C object src/einspline/CMakeFiles/einspline.dir/bspline_create.c.o  
    In file included from /wfconvert/src/einspline/bspline_base.h:24:0,  
             from /wfconvert/src/einspline/bspline_create.h:24,  
             from /wfconvert/src/einspline/bspline_create.c:21:  
    /wfconvert/build/src/Common/config.h:65:17: fatal error: cmath: No such file or directory  
     #include <cmath> 
             ^
    compilation terminated.    
    make[2]: *** [src/einspline/CMakeFiles/einspline.dir/bspline_create.c.o] Error 1  
    make[1]: *** [src/einspline/CMakeFiles/einspline.dir/all] Error 2  
    make: *** [all] Error 2  
    

I don`t know what to do!
here is my cmath file list:

root@geant4:/# find -name cmath
./opt/root5.32.00/cint/cint/include/cmath
./app/gcc/4.8.0/include/c++/4.8.0/ext/cmath
./app/gcc/4.8.0/include/c++/4.8.0/cmath
./app/gcc/4.8.0/include/c++/4.8.0/tr1/cmath
./usr/include/boost/compatibility/cpp_c_headers/cmath
./usr/include/boost/tr1/tr1/cmath
./usr/include/c++/4.5/cmath
./usr/include/c++/4.5/tr1_impl/cmath
./usr/include/c++/4.5/tr1/cmath
./usr/include/c++/4.6/cmath
./usr/include/c++/4.6/tr1/cmath
./usr/share/gccxml-0.9/GCC/2.95/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c_global/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c_std/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/testsuite/26_numerics/headers/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath

and

root@geant4:/# uname -a
Linux geant4 3.0.0-32-generic-pae #51-Ubuntu SMP Thu Mar 21 16:09:48 UTC 2013 i686 i686 i386 GNU/Linux

Please help me.

Ravexina's user avatar

Ravexina

53k23 gold badges151 silver badges176 bronze badges

asked Jun 17, 2013 at 11:04

alireza yousefi's user avatar

2

I would suspect corrupt installation of development tools or something like that. First thing I would do is re install build package

sudo apt-get purge build-essential
sudo apt-get install build-essential

If the problem still persists post it back

Just curious: How did you install GCC 4.8? I have 13.04 and it have 4.7.3
So that might be an issue if was not done properly!

answered Jun 17, 2013 at 11:09

Stefano Mtangoo's user avatar

Stefano MtangooStefano Mtangoo

2,7602 gold badges28 silver badges39 bronze badges

4

With gcc it looks this:

gcc example.c -o example -lm   

for more precise compiling (with debugging output in case of failures) you do this:

gcc -ggdb -Wall example.c -o example -lm

lm is here the linking with the math-library of gcc (there is #include math.h at the beginning of example.c).

Ravexina's user avatar

Ravexina

53k23 gold badges151 silver badges176 bronze badges

answered Jun 18, 2013 at 17:21

dschinn1001's user avatar

dschinn1001dschinn1001

3,6936 gold badges26 silver badges38 bronze badges

Содержание

  1. «cmath: нет такого файла или каталога» при компиляции с помощью GCC
  2. 2 ответы
  3. Build error with CMake and MSYS2 mingw-w64 #669
  4. Comments
  5. Steps to reproduce:
  6. fatal error: math.h: No such file or directory #72
  7. Comments
  8. GCC 6.1 build failure #797
  9. Comments
  10. «cmath: нет такого файла или каталога» при компиляции с помощью GCC

«cmath: нет такого файла или каталога» при компиляции с помощью GCC

Я написал простую программу на Linux Ubuntu, когда я использую g++, ошибки нет, но когда я использую GCC Я вижу эту ошибку:

Примечание: «на самом деле я вижу эту ошибку при компиляции пакета, я подумал, что это может быть связано с библиотекой gcc, которая не настроена на среду Linux, поэтому я написал простую программу, чтобы четко определить ошибку и без зависимости!» поэтому программа должна компилироваться с помощью gcc, чтобы я мог решить основную проблему. Я знаю, что могу использовать math.h вместо cmath, но пакет использует cmath! это простая программа:

и после установки gcc-4.8 сделал по этой инструкции:

чтобы сделать gcc-4.8 gcc по умолчанию.

Пожалуйста, помогите мне
Я не знаю, что делать.
благодаря

задан 17 июн ’13, 13:06

+1 за хороший вопрос и упрощение кода, чтобы четко определить ошибку. — Abhineet

cmath для C++, используйте math.h для C, если файл заканчивается на .c, но это явно файл C++, измените окончание. — stdcall

2 ответы

Оба являются драйверами, которые вызывают компиляторы по мере необходимости.

Очистив ваши сомнения::

Проблема с GCC в том, что он не ссылается на стандартные библиотеки C++ по умолчанию как G++ делает. GCC это просто фронтенд. Фактический компилятор cc1plus. Поэтому всегда рекомендуется использовать G++ при компиляции файлов C++. Результат может быть одинаковым с обоими GCC и G++ если вы знаете точные аргументы, чтобы связать их. Вы можете найти это ссылке полезно.

Но если вы все еще хотите использовать GCC , используйте его с параметром компоновщика -lstdc++ в конце команды. Эта опция компоновщика добавляется по умолчанию, когда вы используете G++ . Вы можете убедиться в этом, скомпилировав свой код, используя GCC с -### вариант, и он покажет вам, что -lstdc++ опция отсутствует.

Я использовал gcc с опцией -lstdc++ но это не t work! the error remained.I wrote this command: gcc test.c -lstdc++` — Алиреза Юсефи

Можете ли вы опубликовать команду, которую вы использовали? Кроме того, попробуйте g++ с параметром -v, он покажет вам все команды и параметры. Отсюда можно вывести правильное. — Абхинит

Переименуйте файл в «test.cpp». GCC вызывает соответствующий компилятор, видя расширение файла. — Абхинит

@alirezayusefi сборка завершается ошибкой на этапе компиляции, а не на этапе компоновки, поэтому добавление -lstdc++ не произойдет. проблема в том, что g++ имеет другие пути включения, такие как gcc, а «cmath» является C ++ заголовок ищется только тогда, когда программа скомпилирована как C++ — умлют

Если ваша основная проблема в этом, то, возможно, вам следует дождаться решения там и не начинать размещать свой вопрос повсюду. — Абхинит

Скомпилируйте исходные файлы C++ с помощью g++, а не gcc.

Источник

Build error with CMake and MSYS2 mingw-w64 #669

If attempt to use cmake to build CppUTest on msys2 I get following compiler errors:

Note that while cmake fails the autotools build works fine on msys2.

Steps to reproduce:

  1. Get MSYS2 and follow their install intructions
  2. Install mingw-w64, cmake and ninja with pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja
  3. Open MinGW-w64 Win64 Shell and execute cmake -G Ninja . && ninja in the CppUTest folder

The text was updated successfully, but these errors were encountered:

For a conversion to / from float to int to occur at all, you must be attracting a very weird implementation of isnan(). Personally, I doubt that is anything to do with CppUTest.

For example, the «normal» declaration would be something like:

according to this page (so, strictly speaking, the cast to double is unnecessary), which resolves to something like:

which is a clean match to the call within CppUTest. Could you please dig up your math.h and check the definition of isnan()?

P.S. Unfortunately, I can’t personally take the time to set up an entire build environment to reproduce your problem.

The according function is resovled with C++ templates defined in line 75.

Like you said it should resolve to extern int __cdecl __isnanf (float) because the parameter for isnan() is casted to float in UtestPlatform.cpp like return isnan((float)d);

I don’t really know why the compiler throws those conversion errors when calling isnan() like that. A simliar error occurs if I change the line to return isnan(d); :

I wonder why the autotools build works flawlessly. It should be using the exact same header file.

Very strange indeed. The first error in particular, since the macro would imply that it chooses the correct version if its three internal isnan definitions. As for the ‘double’ to ‘int’ conversion, I have no idea. It is almost as if it it is digging up some strange definition elsewhere. But where, and why?

It might be interesting to compile with -E instead of -c to see what is the actual preprocessor output.

What happens if you #include and call std::isnan() ?

This change fixes the cmake build and at the same time breaks the autotools based build:

Is UtestPlatform.cpp compiled as C code here?

  1. You’d have to keep the IsNanImplementation(double d) wrapper, because using the function pointer breaks template-based Clang (sigh).
  2. Nice that it fixes cmake 🙂
  3. Now that’s one weird error again. I don’t know what to say. It is compiled as C++.

I get the same error (cmath not found) with autotools and clang(++).

Looks like -nostdinc++ compiler flag in CPPUTEST_CXXFLAGS causes this behavoir. When I remove it everything builds fine.

This one happens when the -nostdinc++ option is present on the compiler command line. This is strange, since it is not the default. Running ../configure without arguments should remove it

Too bad though, because CppUTest needs to be able to build with the -nostdinc++ flag also — so we can’t use this solution, unfortunately.

The only fix I could come up with would be to use ugly #ifdef code, which I don’t think is the right way.
As this is clearly a mingw-w64 bug I’ll close this issue and file a bug report at their issue tracker.
Thank you very much for your help! 🙂

Источник

fatal error: math.h: No such file or directory #72

On Archlinux with gcc 8.2.1 I get this error:

Unfortunately it’s not very clear what causes it.

The text was updated successfully, but these errors were encountered:

This sounds like a problem with your Arch installation — your system include directory (or directories) does not include math.h, and so your C++ compiler can’t properly use cmath. This is way outside of ROCm’s wheelhouse.

/usr/include/math.h exists and most likely changing the #include_next to #include would work (haven’t tested yet).

It most likely has something to do with the build system and the system include path, see issues like
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71090
ponylang/ponyc#797

In vanilla llvm something similar started happening recently, so I took the time to find out why.

This adds -isystem /include to the gcc command line, which breaks its ability to find system headers, in the case of vanilla llvm, the first affected one is stdlib.h.

I’ll try later if this is the cause in rocm opencl too and see if there are more.

In ubuntu 20.04 x86 the following changes had to be made from the APT lines:
sudo apt update
sudo apt install libhamlib2 libqwt-qt5-6 libqt5svg5*
sudo apt install g++ unzip make qtbase5-dev-tools automake libtool libtool-bin >

Also, there were errors that a file existed in the ln lines which aborted the script.

Источник

GCC 6.1 build failure #797

For GCC 6 this has been fixed, by making the C++ library install its own version of math.h, which includes cmath, which then includes the real math.h from the C
library.

(Edit: Removed <> from quote because lolmarkdown)

The text was updated successfully, but these errors were encountered:

@Earnestly can you provide more info: what OS, libc, llvm, etc so we can try and reproduce.

  • uname -a Linux 4.5.2-1-zen #1 ZEN SMP PREEMPT . x86_64 GNU/Linux
  • glibc 2.23.90 (2.23-64-g1eb8930)
  • llvm 3.7.1
  • gcc 6.1.1 (as above)

Builds flags (environmental):

Anything else I might have missed?

Arch Linux (This is a little less concrete since I run lots of userspace from development head, such as glibc.)

Looks like I have this same issue following an update. Arch Linux (bog-standard), llvm 3.7.1, gcc 6.1.1 20160501 (not sure what version I had previously).

Doing make verbose=t produces

Fiddling around with the command line suggests the issue involves the -isystem /usr/include/ argument; removing it allows the build to continue. The following change in Makefile (replacing -isystem with -I) allows the build to succeed. Tests run satisfactorily.

The search path with -isystem /usr/include is

The search path with -I /usr/include is

@tmmcguire Good find; thanks to your change the build completes successfully here too, along with both test phases passing.

A question: is anyone cross-compiling Pony? I think that might be the only way this change would break anything. From the gcc docs:

The assumption I’m making here is that the Makefile is using -isystem to favor the headers that LLVM uses for the target architecture while preventing the host’s headers from confusing the issue. But I don’t know enough about LLVM to know what I’m talking about.

Yes. We cross compile for RPi from AMD64.

Call is for someone to pick this up and change from isystem to i

Sadly #819 didn’t work out and the build blew up because of it, perhaps we might not have an easy way out on this.

Yep, that wasn’t pretty.

I’ve filed bugs with GCC and Arch Linux (more or less for heck of it), since I suspect this is an upstream problem.

Let’s see which one gets me yelled at first.

Let’s see which one gets me yelled at first.

It was a close finish, but Arch surpassed in both the speed and the snide-ness of the response. 😉

Comment by Doug Newgard (Scimmia) — Thursday, 12 May 2016, 19:39 GMT
So don’t use -lsystem /usr/include.

I dunno; the GCC response gets extra points for pointing to some unspecified Mozilla bug.

This is not a GCC bug you are changing the search directory paths what do you expect to happen?

Note Mozilla had a similar bug which is being fixed there.

It was a close finish, but Arch surpassed in both the speed and the snide-ness of the response. 😉

You call it snide, I call it common sense. If something doesn’t work when you do something dumb, don’t do something dumb.

This is the kind of dismissive attitude that I was calling snide. I don’t see any attempt to engage with the OP, whether to better understand their issue or to help them better understand why their issue is or is not valid.

You’re absolutely free to have this attitude (especially on your own issue tracker). But I’m also free to call it «snide», and I do so because I see it as counterproductive to a meaningful issue resolution interaction.

On this issue tracker, such a response from a core contributor to a user would not be considered acceptable. Again, you’re free to apply your own standards of acceptability in your own forums, but I’m also free to raise my eyebrows.

@jemc Don’t fret, this is just how Scimmia is. They’re respondible for bug wrangling but not development or packaging, which brings me to my next point: it’s somewhat unclear why the issue was closed as this appears to be a genuine regression in GCC 6.1.1 unless -isystem working prior to 6.1.1 was dumb luck.

I assume using -isystem is not «dumb», it’s used throughout GNU toolchain bootstrap process (maybe it is dumb then?) but, without having the guts to wade through autohell, they probably only use it conditionally. Conversely, better software, such as musl’s build (it used in musl’s spec file if one isn’t using a cross-compiler though), doesn’t use it at all.

Nobody said that you can’t use -isystem, just that you can’t use it this way. #include_next depends on things being in a certain order, and you’re screwing with that order. That this worked previously was, in fact, dumb luck as there wasn’t multiple versions of math.h before.

The Arch report was closed for the same reason the GCC report was closed — this is expected behavior. I could have assigned it to Allan and let him yell at the reporter before closing it. Would that have been better?

Источник

«cmath: нет такого файла или каталога» при компиляции с помощью GCC

Я написал простую программу в linux ubuntu , когда я использую g++, ошибки нет, но когда я использую gcc , я вижу эту ошибку:

Примечание: «на самом деле я вижу эту ошибку при компиляции пакета, я подумал, что это может быть связано с библиотекой gcc, которая не настроена на среду Linux, поэтому я написал простую программу, чтобы четко определить ошибку и без зависимости!» поэтому программа должна компилироваться с помощью gcc, чтобы я мог решить основную проблему. Я знаю, что могу использовать math.h вместо cmath, но пакет использует cmath! это простая программа:

и после установки gcc-4.8 сделал по этой инструкции:

чтобы сделать gcc-4.8 gcc по умолчанию.

пожалуйста, помогите мне,
я не знаю, что делать.
Спасибо

Оба являются драйверами, которые вызывают компиляторы по мере необходимости.

Очистив ваши сомнения::

Проблема в GCC том, что он по умолчанию не связывается со стандартными библиотеками С++ , как G++ это делает. GCC это просто фронтенд. Фактический компилятор cc1plus. Так всегда рекомендуется использовать G++ при компиляции файлов C++. Результат может быть одинаковым для обоих , GCC и G++ если вы знаете точные аргументы, чтобы связать их. Вы можете найти эту ссылку полезной.

Но если вы все еще хотите использовать GCC , используйте его с параметром компоновщика -lstdc++ в конце команды. Этот параметр компоновщика добавляется по умолчанию при использовании G++ . Вы можете убедиться в этом, скомпилировав свой код GCC с -### опцией with, и он покажет вам, что -lstdc++ опция отсутствует.

Источник

Hi,
config:
Ubuntu: 18.04
gcc: 5.5, 6.5, 7.3
cuda: 9.1
python: 3.7
pytorch: 1.0

This issue is related to some posted issues. Sorry for repetition.

I am sure the error is related to the version of cuda, gcc. For now, I changed the version of gcc (using update-alternatives) and the wheel of pytorch (compiled using different cuda).

I obtain the error below. Any pointer is much appreciated!!! thanks
Since the error points to missing headers, I reinstalled:

sudo apt install --reinstall libstdc++-{5, 6, 7}-dev.

But the error persists.

Traceback (most recent call last):
  File "/home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 946, in _build_extension_module
    check=True)
  File "/home/brian/anaconda3/lib/python3.7/subprocess.py", line 468, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3291, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-99c8874721c0>", line 1, in <module>
    runfile('/mnt/0890ce70-3387-4496-a36e-fe2ed1d8596f/research/code/glas-1/test.py', wdir='/mnt/0890ce70-3387-4496-a36e-fe2ed1d8596f/research/code/glas-1')
  File "/home/brian/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/183.5912.18/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "/home/brian/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/183.5912.18/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"n", file, 'exec'), glob, loc)
  File "/mnt/0890ce70-3387-4496-a36e-fe2ed1d8596f/research/code/glas-1/test.py", line 3, in <module>
    from deepmil.deeplabv3 import Res_Deeplab
  File "/home/brian/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/183.5912.18/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/mnt/0890ce70-3387-4496-a36e-fe2ed1d8596f/research/code/glas-1/deepmil/deeplabv3.py", line 17, in <module>
    from libs import InPlaceABN, InPlaceABNSync
  File "/home/brian/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/183.5912.18/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/mnt/0890ce70-3387-4496-a36e-fe2ed1d8596f/research/code/glas-1/libs/__init__.py", line 1, in <module>
    from .bn import ABN, InPlaceABN, InPlaceABNSync
  File "/home/brian/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/183.5912.18/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/mnt/0890ce70-3387-4496-a36e-fe2ed1d8596f/research/code/glas-1/libs/bn.py", line 10, in <module>
    from .functions import *
  File "/home/brian/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/183.5912.18/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/mnt/0890ce70-3387-4496-a36e-fe2ed1d8596f/research/code/glas-1/libs/functions.py", line 18, in <module>
    extra_cuda_cflags=["--expt-extended-lambda"])
  File "/home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 645, in load
    is_python_module)
  File "/home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 814, in _jit_compile
    with_cuda=with_cuda)
  File "/home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 863, in _write_ninja_file_and_build
    _build_extension_module(name, build_directory, verbose)
  File "/home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 959, in _build_extension_module
    raise RuntimeError(message)
RuntimeError: Error building extension 'inplace_abn': [1/3] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=inplace_abn -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include/TH -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include/THC -isystem /usr/include -isystem /home/brian/Venvs/pytorch.1.0.1/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --compiler-options '-fPIC' --expt-extended-lambda -std=c++11 -c /mnt/0890ce70-3387-4496-a36e-fe2ed1d8596f/research/code/glas-1/libs/src/inplace_abn_cuda.cu -o inplace_abn_cuda.cuda.o
FAILED: inplace_abn_cuda.cuda.o 
/usr/bin/nvcc -DTORCH_EXTENSION_NAME=inplace_abn -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include/TH -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include/THC -isystem /usr/include -isystem /home/brian/Venvs/pytorch.1.0.1/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --compiler-options '-fPIC' --expt-extended-lambda -std=c++11 -c /mnt/0890ce70-3387-4496-a36e-fe2ed1d8596f/research/code/glas-1/libs/src/inplace_abn_cuda.cu -o inplace_abn_cuda.cuda.o
In file included from /usr/include/crt/math_functions.h:8835:0,
                 from /usr/include/crt/common_functions.h:271,
                 from /usr/include/common_functions.h:50,
                 from /usr/include/cuda_runtime.h:115,
                 from <command-line>:0:
/usr/include/c++/6/cmath:45:23: fatal error: math.h: No such file or directory
 #include_next <math.h>
                       ^
compilation terminated.
[2/3] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=inplace_abn -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include/TH -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include/THC -isystem /usr/include -isystem /home/brian/Venvs/pytorch.1.0.1/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --compiler-options '-fPIC' --expt-extended-lambda -std=c++11 -c /mnt/0890ce70-3387-4496-a36e-fe2ed1d8596f/research/code/glas-1/libs/src/inplace_abn_cuda_half.cu -o inplace_abn_cuda_half.cuda.o
FAILED: inplace_abn_cuda_half.cuda.o 
/usr/bin/nvcc -DTORCH_EXTENSION_NAME=inplace_abn -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include/TH -isystem /home/brian/Venvs/pytorch.1.0.1/lib/python3.7/site-packages/torch/lib/include/THC -isystem /usr/include -isystem /home/brian/Venvs/pytorch.1.0.1/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --compiler-options '-fPIC' --expt-extended-lambda -std=c++11 -c /mnt/0890ce70-3387-4496-a36e-fe2ed1d8596f/research/code/glas-1/libs/src/inplace_abn_cuda_half.cu -o inplace_abn_cuda_half.cuda.o
In file included from /usr/include/crt/math_functions.h:8835:0,
                 from /usr/include/crt/common_functions.h:271,
                 from /usr/include/common_functions.h:50,
                 from /usr/include/cuda_runtime.h:115,
                 from <command-line>:0:
/usr/include/c++/6/cmath:45:23: fatal error: math.h: No such file or directory
 #include_next <math.h>
                       ^
compilation terminated.
ninja: build stopped: subcommand failed.

Hello,
I’ve followed the slightly outdated MinGW compile guide for compiling on(and for) Windows, and, after getting the hang of Git and installing dependencies such as bison & flex, installed the includes such as SDL and libpng (manually at first, then found the 2009 devpkg on sourceforge: out of date, but quicker than downloading & extracting each package manually).

However, despite installing everything described in the old guide, I am still receiving ‘file not found’ errors, regarding cmath:
(the most pertinent part afaict is at the bottom)

Code: Select all

Checking config...
PACKAGE_VERSION := TRUNK
MODE := release
DEVDIR := C:/devlib
Config seems valid.
Checking config...
PACKAGE_VERSION := TRUNK
MODE := release
DEVDIR := C:/devlib
Config seems valid.
bison -d  -o message_parser.tab.c message_parser.y
gcc -I.. -DPACKAGE="warzone2100" -DPACKAGE_VERSION="TRUNK" -DYY_STATIC -IC:/
devlib/include/SDL -IC:/devlib/include/libpng12 -IC:/devlib/include/bfd -IC:/dev
lib/include -DNDEBUG -DWIN32 -DPACKAGE="warzone2100" -DPACKAGE_VERSION="TRUNK
" -DYY_STATIC -IC:/devlib/include/SDL -IC:/devlib/include/libpng12 -IC:/devlib/
include/bfd -IC:/devlib/include -DNDEBUG -DWIN32  -I../lib/ivis_opengl -std=gnu9
9 -g -Wall -Werror-implicit-function-declaration -std=gnu99 -g -Wall -Werror-imp
licit-function-declaration  -c -o message_parser.tab.o message_parser.tab.c
In file included from ../lib/framework/string_ext.h:24:0,
                 from ../lib/framework/frame.h:39,
                 from message_parser.y:26:
../lib/framework/debug.h:55:13: error: expected '=', ',', ';', 'asm' or '__attri
bute__' before 'assertEnabled'
In file included from ../lib/framework/string_ext.h:24:0,
                 from ../lib/framework/frame.h:39,
                 from message_parser.y:26:
../lib/framework/debug.h:129:9: error: expected '=', ',', ';', 'asm' or '__attri
bute__' before '<' token
../lib/framework/debug.h:130:9: error: expected '=', ',', ';', 'asm' or '__attri
bute__' before '<' token
../lib/framework/debug.h:186:13: error: expected '=', ',', ';', 'asm' or '__attr
ibute__' before 'enabled_debug'
../lib/framework/debug.h:189:15: error: expected declaration specifiers or '...'
 before '*' token
../lib/framework/debug.h:189:9: warning: type defaults to 'int' in declaration o
f 'bool'
../lib/framework/debug.h:189:9: error: 'bool' declared as function returning a f
unction
../lib/framework/debug.h:195:2: error: expected specifier-qualifier-list before
'debug_callback_init'
../lib/framework/debug.h:227:59: error: expected declaration specifiers or '...'
 before 'debug_callback_init'
../lib/framework/debug.h:230:6: error: 'debug_callback_file_init' declared as fu
nction returning a function
../lib/framework/debug.h:244:6: error: 'debug_enable_switch' declared as functio
n returning a function
../lib/framework/debug.h:277:13: error: 'debugPartEnabled' declared as function
returning a function
In file included from ../lib/framework/frame.h:39:0,
                 from message_parser.y:26:
../lib/framework/string_ext.h: In function 'strlcpy':
../lib/framework/string_ext.h:103:2: error: function '_wzeval' is initialized li
ke a variable
../lib/framework/string_ext.h:103:2: warning: the address of '_wzeval' will alwa
ys evaluate as 'true'
../lib/framework/string_ext.h:103:2: error: 'assertEnabled' undeclared (first us
e in this function)
../lib/framework/string_ext.h:103:2: note: each undeclared identifier is reporte
d only once for each function it appears in
../lib/framework/string_ext.h:103:2: error: nested function '_wzeval' declared b
ut never defined
../lib/framework/string_ext.h:104:2: error: function '_wzeval' is initialized li
ke a variable
../lib/framework/string_ext.h:104:2: warning: the address of '_wzeval' will alwa
ys evaluate as 'true'
../lib/framework/string_ext.h:104:2: error: nested function '_wzeval' declared b
ut never defined
../lib/framework/string_ext.h: In function 'strlcat':
../lib/framework/string_ext.h:140:2: error: function '_wzeval' is initialized li
ke a variable
../lib/framework/string_ext.h:140:2: warning: the address of '_wzeval' will alwa
ys evaluate as 'true'
../lib/framework/string_ext.h:140:2: error: 'assertEnabled' undeclared (first us
e in this function)
../lib/framework/string_ext.h:140:2: error: nested function '_wzeval' declared b
ut never defined
../lib/framework/string_ext.h:141:2: error: function '_wzeval' is initialized li
ke a variable
../lib/framework/string_ext.h:141:2: warning: the address of '_wzeval' will alwa
ys evaluate as 'true'
../lib/framework/string_ext.h:141:2: error: nested function '_wzeval' declared b
ut never defined
In file included from ../lib/framework/frame.h:44:0,
                 from message_parser.y:26:
../lib/framework/i18n.h: At top level:
../lib/framework/i18n.h:54:13: error: 'setLanguage' declared as function returni
ng a function
In file included from ../lib/framework/frame.h:45:0,
                 from message_parser.y:26:
../lib/framework/trig.h:32:13: error: 'trigInitialise' declared as function retu
rning a function
In file included from message_parser.y:26:0:
../lib/framework/frame.h:71:13: error: 'frameInitialise' declared as function re
turning a function
In file included from message_parser.y:26:0:
../lib/framework/frame.h:117:8: error: expected identifier or '(' before string
constant
In file included from message_parser.y:26:0:
../lib/framework/frame.h:119:8: error: expected identifier or '(' before string
constant
In file included from message_parser.y:27:0:
../lib/framework/strres.h:46:13: error: 'strresLoad' declared as function return
ing a function
In file included from message_parser.y:28:0:
../lib/framework/frameresource.h:36:16: error: 'RES_BUFFERLOAD' declared as func
tion returning a function
../lib/framework/frameresource.h:39:16: error: 'RES_FILELOAD' declared as functi
on returning a function
In file included from message_parser.y:28:0:
../lib/framework/frameresource.h:84:13: error: 'resInitialise' declared as funct
ion returning a function
../lib/framework/frameresource.h:93:6: error: 'resLoad' declared as function ret
urning a function
../lib/framework/frameresource.h:105:13: error: 'resAddBufferLoad' declared as f
unction returning a function
../lib/framework/frameresource.h:109:13: error: 'resAddFileLoad' declared as fun
ction returning a function
../lib/framework/frameresource.h:113:13: error: 'resLoadFile' declared as functi
on returning a function
../lib/framework/frameresource.h:116:13: error: 'resAddData' declared as functio
n returning a function
../lib/framework/frameresource.h:121:13: error: 'resPresent' declared as functio
n returning a function
../lib/framework/frameresource.h:125:13: error: 'resGetHashfromData' declared as
 function returning a function
In file included from ../lib/framework/vector.h:29:0,
                 from ../lib/ivis_opengl/pietypes.h:33,
                 from ../src/objectdef.h:28,
                 from ../src/structure.h:29,
                 from ../src/message.h:27,
                 from message_parser.y:29:
../lib/framework/math_ext.h:29:17: fatal error: cmath: No such file or directory

compilation terminated.
make: *** [message_parser.tab.o] Error 1
rm message_parser.tab.c

I’ve done a little research, and I now know cmath is part of the C++ standard library. But what I don’t understand is why gcc (or make) cannot find it (i did find a copy inside an obscure subdirectory of mingw, but i doubt this is reachable or useable by the compiler).
Although i only found the C version math.h inside «mingw/include», I had hoped that there might be some sort of automatic conversion into the C++ format; and if there wasn’t, then why weren’t the C++ standard headers included in my copy of gcc? Have I installed the wrong version somewhere?

I am sure I’ve missed something simple somewhere(and am sorry to waste people’s time something probably quite simple); but not knowing what to look for, I have no idea what.
Someone please point out my mistake.
Thankyou :)

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Fatal error checkcoderesources wolfenstein
  • Fatal error checkcoderesources resource error for
  • Fatal error chara
  • Fatal error cengineapi initialize
  • Fatal error cannot use because the name is already in use

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии