swtv-kaist / MUSIC

MUSIC: MUtation analySIs tool with High Configurability and Extensibility
Other
17 stars 6 forks source link

fatal error: 'stddef.h' file not found #2

Closed insublee closed 1 year ago

insublee commented 1 year ago

When I run the code below in google colab, an error occurs. The same error also occurs on Ubuntu 20.04. how do i solve it? The code in test.cpp was fine when compiled with g++ and clang++-16.

!sudo echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-16 main" >> /etc/apt/sources.list
!sudo echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-16 main" >> /etc/apt/sources.list
!wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
!sudo apt-get update
!sudo apt-get install clang-16 clang-tools-16 clang-16-doc libclang-common-16-dev libclang-16-dev libclang1-16 clang-format-16 python3-clang-16 libllvm-16-ocaml-dev libllvm16 llvm-16 llvm-16-dev llvm-16-doc llvm-16-examples llvm-16-runtime zlib1g-dev
!git clone https://github.com/swtv-kaist/MUSIC.git
!cd MUSIC && make
test_cpp = """#include <iostream>
#include <vector>

using namespace std;

int main()
{
  vector<int> v1;
  for (int i = 1; i <= 5; i++)
    v1.push_back(i);
  for (auto i = v1.begin(); i != v1.end(); ++i)
    cout << *i << " ";
  cout << "\n";
  for (auto ir = v1.rbegin(); ir != v1.rend(); ++ir)
    cout << *ir << " ";

  cout << "\n";
  for (int i = 0; i < v1.size(); i++)
    cout << v1[i] << " ";

  cout << "\n";
  for (int i = 0; i < v1.size(); i++)
    cout << v1.at(i) << " ";
  cout << "\n";
  return 0;
}"""
with open('test.cpp', mode='w', encoding='UTF-8') as f:
    f.write(test_cpp)

!./MUSIC/music test.cpp --

------------output------------

done with option o: ./ done with option l: -1 added ARGARINEG added ARGBITNEG added ARGDEL added ARGINCDEC added ARGLOGNEG added ARGREPREQ added ARGSTCALI added ARGSTCDIF added CGCR added CGSR added CLCR added CLSR added CRCR added DIRVARARINEG added DIRVARBITNEG added DIRVARINCDEC added DIRVARLOGNEG added DIRVARREPCON added DIRVARREPEXT added DIRVARREPGLO added DIRVARREPLOC added DIRVARREPPAR added DIRVARREPREQ added FUNCALDEL added INDVARARINEG added INDVARBITNEG added INDVARINCDEC added INDVARLOGNEG added INDVARREPCON added INDVARREPEXT added INDVARREPGLO added INDVARREPLOC added INDVARREPPAR added INDVARREPREQ added OAAA added OAAN added OABA added OABN added OAEA added OALN added OARN added OASA added OASN added OBAA added OBAN added OBBA added OBBN added OBEA added OBLN added OBNG added OBRN added OBSA added OBSN added OCOR added OEAA added OEBA added OESA added OIPM added OLAN added OLBN added OLLN added OLNG added OLRN added OLSN added OMMO added OPPO added ORAN added ORBN added ORLN added ORRN added ORSN added OSAA added OSAN added OSBA added OSBN added OSEA added OSLN added OSRN added OSSA added OSSN added SSOM added VASM added VDTR added VGAR added VGPR added VGSR added VGTR added VLAR added VLPR added VLSR added VLTR added VSCR added VTWD done with option m g_inputfile_name = test.cpp g_mutdbfile_name = ./test_mut_db.csv executing action from GatherDataAction In file included from /content/test.cpp:1: In file included from /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/iostream:39: In file included from /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ostream:38: In file included from /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ios:38: In file included from /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/iosfwd:40: In file included from /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/postypes.h:40: In file included from /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cwchar:44: /usr/include/wchar.h:35:10: fatal error: 'stddef.h' file not found

include

     ^~~~~~~~~~

Done GatherDataAction 0 test.cpp (1 : 1) (30 : 2) executing action from GenerateMutantAction In file included from /content/test.cpp:1: In file included from /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/iostream:39: In file included from /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ostream:38: In file included from /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ios:38: In file included from /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/iosfwd:40: In file included from /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/postypes.h:40: In file included from /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cwchar:44: /usr/include/wchar.h:35:10: fatal error: 'stddef.h' file not found

include

     ^~~~~~~~~~

====== entering main done execute action opened file name ./test_mut_db.csv ArgAriNeg 0 ArgBitNeg 0 ArgDel 0 ArgIncDec 0 ArgLogNeg 0 ArgRepReq 0 ArgStcAli 0 ArgStcDif 0 CGCR 0 CGSR 0 CLCR 2 CLSR 8 CRCR 20 CovAllEdg 4 CovAllNod 4 DirVarAriNeg 0 DirVarBitNeg 0 DirVarIncDec 0 DirVarLogNeg 0 DirVarRepCon 0 DirVarRepExt 0 DirVarRepGlo 0 DirVarRepLoc 0 DirVarRepPar 0 DirVarRepReq 0 FunCalDel 0 IndVarAriNeg 0 IndVarBitNeg 0 IndVarIncDec 0 IndVarLogNeg 0 IndVarRepCon 0 IndVarRepExt 0 IndVarRepGlo 0 IndVarRepLoc 0 IndVarRepPar 0 IndVarRepReq 0 OAAA 0 OAAN 0 OABA 0 OABN 0 OAEA 0 OALN 0 OARN 0 OASA 0 OASN 0 OBAA 0 OBAN 0 OBBA 0 OBBN 0 OBEA 0 OBLN 0 OBNG 0 OBRN 0 OBSA 0 OBSN 0 OCNG 2 OCOR 0 OEAA 0 OEBA 0 OESA 0 OIPM 0 OLAN 0 OLBN 0 OLLN 0 OLNG 0 OLRN 0 OLSN 0 OMMO 0 OPPO 4 ORAN 5 ORBN 3 ORLN 2 ORRN 5 ORSN 2 OSAA 0 OSAN 0 OSBA 0 OSBN 0 OSEA 0 OSLN 0 OSRN 0 OSSA 0 OSSN 0 RetStaDel 0 SBRC 0 SBRN 0 SCRB 0 SCRN 0 SDWD 0 SGLR 0 SMTC 2 SMTT 2 SMVB 0 SRSR 0 SSDL 4 SSOM 0 SSWM 0 STRI 4 STRP 4 SWDD 0 VASM 0 VDTR 12 VGAR 0 VGPR 0 VGSR 0 VGTR 0 VLAR 0 VLPR 0 VLSR 5 VLTR 0 VSCR 0 VTWD 8 1 error generated. Error while processing /content/test.cpp. 1 error generated. Error while processing /content/test.cpp. Done tooling on test.cpp

lkarus commented 1 year ago

Could you try out the following solution? https://stackoverflow.com/a/20587653 I did not run the program but I checked out Clang 16 on Ubuntu 20.4 and the link is in fact incorrect, usually with the version number Example: /usr/lib/clang/16/include --> ../../llvm-16/lib/clang/16.0.6/include this directory does not exist. find the correct one and replace it. on my system it was ../../llvm-16/lib/clang/16/include

insublee commented 1 year ago

thank you. link was the problem.

mkdir /usr/lib/llvm-16/lib/clang/16.0.6 sudo ln -s ../16/include /usr/lib/llvm-16/lib/clang/16.0.6/include sudo ln -s ../16/lib /usr/lib/llvm-16/lib/clang/16.0.6/lib

solved :)