cadets / loom

The LOOM IR instrumentation framework
Other
19 stars 4 forks source link

ninja failed #18

Closed zchcai closed 5 years ago

zchcai commented 5 years ago
$ ninja
[7/14] Building CXX object src/CMakeFiles/LLVMLoom.dir/Strings.cc.o
FAILED: src/CMakeFiles/LLVMLoom.dir/Strings.cc.o 
/usr/bin/c++   -DGTEST_HAS_RTTI=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/nobackup/llvm/include -I/nobackup/llvm/Release/include -fPIC -fvisibility-inlines-hidden -
Werror=date-time -std=c++11 -w -fdiagnostics-color -ffunction-sections -fdata-sections -std=c++11 -Wall -O3 -DNDEBUG -fPIC   -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS  -fno-exceptio
ns -fno-rtti -MMD -MT src/CMakeFiles/LLVMLoom.dir/Strings.cc.o -MF src/CMakeFiles/LLVMLoom.dir/Strings.cc.o.d -o src/CMakeFiles/LLVMLoom.dir/Strings.cc.o -c ../src/Strings.cc
../src/Strings.cc: In function ‘std::__cxx11::string loom::Join(const std::vector<std::__cxx11::basic_string<char> >&, const string&)’:
../src/Strings.cc:42:3: error: ‘ostream_iterator’ was not declared in this scope
   ostream_iterator<string> Iterator(Stream, Delimiter.c_str());
   ^
../src/Strings.cc:42:26: error: expected primary-expression before ‘>’ token
   ostream_iterator<string> Iterator(Stream, Delimiter.c_str());
                          ^
../src/Strings.cc:42:62: error: ‘Iterator’ was not declared in this scope
   ostream_iterator<string> Iterator(Stream, Delimiter.c_str());
                                                              ^
[9/14] Building CXX object src/CMakeFiles/LLVMLoom.dir/PolicyFile.cc.o
FAILED: src/CMakeFiles/LLVMLoom.dir/PolicyFile.cc.o 
/usr/bin/c++   -DGTEST_HAS_RTTI=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/nobackup/llvm/include -I/nobackup/llvm/Release/include -fPIC -fvisibility-inlines-hidden -
Werror=date-time -std=c++11 -w -fdiagnostics-color -ffunction-sections -fdata-sections -std=c++11 -Wall -O3 -DNDEBUG -fPIC   -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS  -fno-exceptio
ns -fno-rtti -MMD -MT src/CMakeFiles/LLVMLoom.dir/PolicyFile.cc.o -MF src/CMakeFiles/LLVMLoom.dir/PolicyFile.cc.o.d -o src/CMakeFiles/LLVMLoom.dir/PolicyFile.cc.o -c ../src/PolicyFile.cc
../src/PolicyFile.cc:147:14: error: specialization of ‘template<class T, class EnableIf> struct llvm::yaml::SequenceTraits’ in different namespace [-fpermissive]
 struct yaml::SequenceTraits<vector<T>> {
              ^
In file included from ../src/PolicyFile.cc:40:0:
/nobackup/llvm/include/llvm/Support/YAMLTraits.h:200:8: error:   from definition of ‘template<class T, class EnableIf> struct llvm::yaml::SequenceTraits’ [-fpermissive]
 struct SequenceTraits {
        ^
../src/PolicyFile.cc:159:14: error: specialization of ‘template<class T> struct llvm::yaml::ScalarEnumerationTraits’ in different namespace [-fpermissive]
 struct yaml::ScalarEnumerationTraits<InstrStrategy::Kind> {
              ^
In file included from ../src/PolicyFile.cc:40:0:
/nobackup/llvm/include/llvm/Support/YAMLTraits.h:99:8: error:   from definition of ‘template<class T> struct llvm::yaml::ScalarEnumerationTraits’ [-fpermissive]
 struct ScalarEnumerationTraits {
        ^
../src/PolicyFile.cc:168:14: error: specialization of ‘template<class T> struct llvm::yaml::ScalarEnumerationTraits’ in different namespace [-fpermissive]
 struct yaml::ScalarEnumerationTraits<Policy::KTraceTarget> {
In file included from ../src/PolicyFile.cc:40:0:
/nobackup/llvm/include/llvm/Support/YAMLTraits.h:99:8: error:   from definition of ‘template<class T> struct llvm::yaml::ScalarEnumerationTraits’ [-fpermissive]
 struct ScalarEnumerationTraits {
        ^
../src/PolicyFile.cc:178:14: error: specialization of ‘template<class T> struct llvm::yaml::ScalarEnumerationTraits’ in different namespace [-fpermissive]
 struct yaml::ScalarEnumerationTraits<Policy::Direction> {
              ^
In file included from ../src/PolicyFile.cc:40:0:
/nobackup/llvm/include/llvm/Support/YAMLTraits.h:99:8: error:   from definition of ‘template<class T> struct llvm::yaml::ScalarEnumerationTraits’ [-fpermissive]
 struct ScalarEnumerationTraits {
        ^
../src/PolicyFile.cc:187:14: error: specialization of ‘template<class T> struct llvm::yaml::ScalarEnumerationTraits’ in different namespace [-fpermissive]
 struct yaml::ScalarEnumerationTraits<SerializationType> {
              ^
In file included from ../src/PolicyFile.cc:40:0:
/nobackup/llvm/include/llvm/Support/YAMLTraits.h:99:8: error:   from definition of ‘template<class T> struct llvm::yaml::ScalarEnumerationTraits’ [-fpermissive]
 struct ScalarEnumerationTraits {
        ^
../src/PolicyFile.cc:196:14: error: specialization of ‘template<class T> struct llvm::yaml::ScalarEnumerationTraits’ in different namespace [-fpermissive]
 struct yaml::ScalarEnumerationTraits<SimpleLogger::LogType> {
              ^
In file included from ../src/PolicyFile.cc:40:0:
/nobackup/llvm/include/llvm/Support/YAMLTraits.h:99:8: error:   from definition of ‘template<class T> struct llvm::yaml::ScalarEnumerationTraits’ [-fpermissive]
 struct ScalarEnumerationTraits {
        ^
../src/PolicyFile.cc:206:14: error: specialization of ‘template<class T> struct llvm::yaml::MappingTraits’ in different namespace [-fpermissive]
 struct yaml::MappingTraits<FnInstrumentation> {
              ^
In file included from ../src/PolicyFile.cc:40:0:
/nobackup/llvm/include/llvm/Support/YAMLTraits.h:54:8: error:   from definition of ‘template<class T> struct llvm::yaml::MappingTraits’ [-fpermissive]
 struct MappingTraits {
        ^
../src/PolicyFile.cc:216:14: error: specialization of ‘template<class T> struct llvm::yaml::ScalarEnumerationTraits’ in different namespace [-fpermissive]
 struct yaml::ScalarEnumerationTraits<FieldOperation> {
              ^
In file included from ../src/PolicyFile.cc:40:0:
/nobackup/llvm/include/llvm/Support/YAMLTraits.h:99:8: error:   from definition of ‘template<class T> struct llvm::yaml::ScalarEnumerationTraits’ [-fpermissive]
 struct ScalarEnumerationTraits {
        ^
../src/PolicyFile.cc:225:14: error: specialization of ‘template<class T> struct llvm::yaml::MappingTraits’ in different namespace [-fpermissive]
 struct yaml::MappingTraits<FieldInstrumentation> {
              ^
In file included from ../src/PolicyFile.cc:40:0:
/nobackup/llvm/include/llvm/Support/YAMLTraits.h:54:8: error:   from definition of ‘template<class T> struct llvm::yaml::MappingTraits’ [-fpermissive]
 struct MappingTraits {
        ^
../src/PolicyFile.cc:234:14: error: specialization of ‘template<class T> struct llvm::yaml::MappingTraits’ in different namespace [-fpermissive]
 struct yaml::MappingTraits<StructInstrumentation> {
              ^
In file included from ../src/PolicyFile.cc:40:0:
/nobackup/llvm/include/llvm/Support/YAMLTraits.h:54:8: error:   from definition of ‘template<class T> struct llvm::yaml::MappingTraits’ [-fpermissive]
 struct MappingTraits {
        ^
../src/PolicyFile.cc:243:14: error: specialization of ‘template<class T> struct llvm::yaml::MappingTraits’ in different namespace [-fpermissive]
 struct yaml::MappingTraits<PolicyFile::PolicyFileData> {
              ^
In file included from ../src/PolicyFile.cc:40:0:
/nobackup/llvm/include/llvm/Support/YAMLTraits.h:54:8: error:   from definition of ‘template<class T> struct llvm::yaml::MappingTraits’ [-fpermissive]
 struct MappingTraits {
        ^
[13/14] Building CXX object src/CMakeFiles/LLVMLoom.dir/OptPass.cc.o
ninja: build stopped: subcommand failed.
bkidney commented 5 years ago

Which version of LLVM are you using? Could you post a copy of your env here?

zchcai commented 5 years ago

The version generated by your scripts

zchcai commented 5 years ago

The /nobackup/llvm/Release/bin is in the PATH.

$ echo $PATH
/u/z/h/zhicheng/.opam/4.02.3+PIC/bin:/usr/local/sbin:/usr/local/bin:/usr/games:/usr/local/games:/u/z/h/zhicheng/.npm-packages/bin:/s/std/bin:/u/z/h/zhicheng/local/bin:/usr/afsws/bin:/bin:/sbin:/usr/bin:/usr/sbin:/nobackup/bin:/u/z/h/zhicheng/bin:/u/z/h/zhicheng/node-latest-install/node_modules/solgraph:/nobackup/porosity/porosity/porosity:/nobackup/goapp/bin:/nobackup/llvm/Release/bin:/nobackup/ripgrep/0.8.1:/nobackup/anaconda3/bin
bkidney commented 5 years ago

Do you have any CFLAGS or similar in your environment? I am seeing flags such a "-fpermissive" in the output that I do not have in my builds.

zchcai commented 5 years ago

Thank you for your reply. But there is no CFLAGS in my env. Probably it is the ninjathat makes things worse. Is there a compiling way without using ninja?

$ printenv
CAML_LD_LIBRARY_PATH=/u/z/h/zhicheng/.opam/4.02.3+PIC/lib/stublibs
XDG_VTNR=7
MANPATH=/u/z/h/zhicheng/.npm-packages/share/man:/u/z/h/zhicheng/local/share/man:/usr/share/man:/usr/local/share/man:/u/z/h/zhicheng/.opam/4.02.3+PIC/man
XDG_SESSION_ID=c2
HOSTNAME=
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/zhicheng
CLUTTER_IM_MODULE=xim
SESSION=ubuntu
TERM=xterm-256color
VTE_VERSION=4205
XDG_MENU_PREFIX=gnome-
SHELL=/bin/bash
PERL5LIB=/u/z/h/zhicheng/.opam/4.02.3+PIC/lib/perl5:/u/z/h/zhicheng/.opam/4.02.3+PIC/lib/perl5:/u/z/h/zhicheng/.opam/4.02.3+PIC/lib/perl5:
QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
WINDOWID=73478572
OLDPWD=/nobackup
UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/19629/2094
GNOME_KEYRING_CONTROL=
GTK_MODULES=gail:atk-bridge:unity-gtk-module
OCAML_TOPLEVEL_PATH=/u/z/h/zhicheng/.opam/4.02.3+PIC/lib/toplevel
USER=zhicheng
LD_LIBRARY_PATH=/nobackup/z3/build
QT_ACCESSIBILITY=1
UNITY_HAS_3D_SUPPORT=true
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
SSH_AUTH_SOCK=/run/user/19629/keyring/ssh
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
SESSION_MANAGER=local/taxi:@/tmp/.ICE-unix/2304,unix/taxi:/tmp/.ICE-unix/2304
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg
UNITY_DEFAULT_PROFILE=unity
DESKTOP_SESSION=ubuntu
PATH=/u/z/h/zhicheng/.opam/4.02.3+PIC/bin:/usr/local/sbin:/usr/local/bin:/usr/games:/usr/local/games:/u/z/h/zhicheng/.npm-packages/bin:/s/std/bin:/u/z/h/zhicheng/local/bin:/usr/afsws/bin:/bin:/sbin:/usr/bin:/usr/sbin:/nobackup/bin:/u/z/h/zhicheng/bin:/u/z/h/zhicheng/node-latest-install/node_modules/solgraph:/nobackup/porosity/porosity/porosity:/nobackup/goapp/bin:/nobackup/llvm/Release/bin:/nobackup/ripgrep/0.8.1:/nobackup/anaconda3/bin
QT_IM_MODULE=fcitx
QT_QPA_PLATFORMTHEME=appmenu-qt5
XDG_SESSION_TYPE=x11
PWD=/nobackup
JOB=unity-settings-daemon
XMODIFIERS=@im=fcitx
GNOME_KEYRING_PID=
LANG=en_US.UTF-8
GDM_LANG=en_US
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
COMPIZ_CONFIG_PROFILE=ubuntu
IM_CONFIG_PHASE=1
PS1=[\u@\h] (\#)$ 
GDMSESSION=ubuntu
KRB5CCNAME=/var/adm/krb5/tmp/tkt/krb5cc_19629_8yxWky
SESSIONTYPE=gnome-session
GTK2_MODULES=overlay-scrollbar
SHLVL=1
HOME=/u/z/h/zhicheng
XDG_SEAT=seat0
LANGUAGE=en_US:
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
UPSTART_INSTANCE=
PYTHONPATH=/nobackup/z3/build/python
UPSTART_EVENTS=xsession started
XDG_SESSION_DESKTOP=ubuntu
LOGNAME=zhicheng
COMPIZ_BIN_PATH=/usr/bin/
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-WF7uw6hmbC
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/var/lib/snapd/desktop
QT4_IM_MODULE=fcitx
GOPATH=/nobackup/goapp
INSTANCE=
UPSTART_JOB=unity7
XDG_RUNTIME_DIR=/run/user/19629
DISPLAY=:0
XDG_CURRENT_DESKTOP=Unity
GTK_IM_MODULE=fcitx
XAUTHORITY=/u/z/h/zhicheng/.Xauthority
_=/usr/bin/printenv
bkidney commented 5 years ago

I am still looking at the issue. Can you post the results of the following commands for me?

/usr/bin/c++ --verison

uname -a

zchcai commented 5 years ago
$ /usr/bin/c++ --version 
c++ (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
Copyright (C) 2015 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.

$ uname -a
Linux taxi 4.4.0-137-generic #163-Ubuntu SMP Mon Sep 24 13:14:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Thank you! (taxi is my hostname)

bkidney commented 5 years ago

If you want to use makefiles instead of Ninja, you can leave the "-G Ninja" out of the cmake command. On a Linux system, this should generate standard makefiles.

I am not convinced this will fix the issue. Since Loom is developed and used by the CADETS project mainly in FreeBSD we generally build it using LLVM (clang++). In theory, it should be buildable via gcc as long as the Loom library is linked against LLVM after compilation. I am going to build up an Ubuntu VM and see if I can test your configuration on replicate the issue.

zchcai commented 5 years ago

thanks

zchcai commented 5 years ago

This has been resolved as follows:

$ pwd
/nobackup/loom
$ git diff
diff --git a/src/Strings.cc b/src/Strings.cc
index 4d33ae7..f21af7e 100644
--- a/src/Strings.cc
+++ b/src/Strings.cc
@@ -32,6 +32,7 @@

 #include <algorithm>
 #include <sstream>
+#include <iterator>

 using namespace std;

Then, under the /nobackup/loom/Release, run: cmake -G Ninja -DCMAKE_CXX_COMPILER=/nobackup/llvm-3.8.0/bin/clang++ -DCMAKE_C_COMPILER=/nobackup/llvm-3.8.0/bin/clang -D CMAKE_BUILD_TYPE=Release -DLLVM_DIR=/nobackup/llvm/Release/lib/cmake/llvm/ .., where /nobakcup/llvm is the llvm provided in loom, and llvm-3.8.0 is another version of binary. For the PATH setting, use the llvm-3.8.0. At last, use /nobackup/llvm/Release/bin/opt -load /nobackup/loom/Release/lib/LLVMLoom.so --help to check.