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

Add docker support #87

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b1c8698
Fix new clang warning: missing override.
Axel-Naumann Nov 6, 2014
bf52813
More override fixes - thanks, clang!
Axel-Naumann Nov 6, 2014
31faaef
Argument parsing can trigger ASTReading; needs transaction (ROOT-6625).
Axel-Naumann Nov 20, 2014
44377b8
Buffer the pending instantiations in case or recursive parsing.
Axel-Naumann Dec 2, 2014
587f324
Errors are errors (ROOT-5698).
Axel-Naumann Dec 3, 2014
a140f26
change all WIN32 defines to _WIN32 as it is a compiler define
martell Dec 4, 2014
a578b39
Only call GetFullyQualifiedName() if wrapper does not exist (ROOT-6909).
Axel-Naumann Dec 4, 2014
76fc205
use size_t for void pointer cast
martell Dec 8, 2014
d55c583
Merge pull request #65 from martell/master
vgvassilev Feb 1, 2015
9a47981
Change the default URLs of repositories
onyb Jun 2, 2015
7bd4df1
New method to get sources of LLVM and Clang
onyb Jun 3, 2015
e231446
Use modern syntax of "except" for dual compatibility with Python 2 and 3
onyb Jun 3, 2015
2d27a56
Merge pull request #70 from onyb/cpt
vgvassilev Jun 5, 2015
8fe62b2
Refactor and reformat code in CPT
onyb Oct 11, 2015
0bbd432
CPT: Fix subprocess communication in Python 3
onyb Oct 11, 2015
921a88a
CPT: Better SSL detection
onyb Oct 11, 2015
c92c6e5
CPT: Limit parallel builds to 4 cores
onyb Oct 11, 2015
683548d
CPT: LLVM revision must correspond to checked out tag
onyb Oct 11, 2015
7a16ad6
CPT: Use GitHub API to fetch repo tags
onyb Oct 11, 2015
3bccf49
Update .travis.yml to use CPT
onyb Oct 11, 2015
bbf0205
Merge pull request #75 from onyb/cpt
vgvassilev Oct 11, 2015
0c395a4
Add docker support
maddouri Apr 25, 2016
e2a131d
Merge branch 'develop-docker' into develop
maddouri Apr 25, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 11 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,22 @@ compiler:
before_install:
- echo $LANG
- echo $LC_ALL
- sudo apt-get install python-software-properties
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update
- sudo apt-get install gcc-4.8
- sudo apt-get install g++-4.8
- sudo apt-get install binutils-gold
- sudo apt-get install git gcc-4.8 g++-4.8 debhelper devscripts gnupg python binutils-gold python-software-properties
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
- wget https://raw.githubusercontent.com/vgvassilev/cling/master/tools/packaging/cpt.py
- chmod +x cpt.py

before_script:
- mkdir src inst obj
- git clone https://github.com/vgvassilev/llvm.git src
- (cd src && git checkout cling-patches)
- git clone https://github.com/vgvassilev/clang.git src/tools/clang
- (cd src/tools/clang && git checkout cling-patches)
- git clone https://github.com/vgvassilev/cling.git src/tools/cling
- cd src
- cd ../obj
- travis_retry ../src/configure --prefix=`pwd`/../inst --disable-docs --disable-bindings --disable-visibility-inlines-hidden --disable-clang-rewriter --disable-clang-static-analyzer --disable-clang-arcmt --disable-compiler-version-checks --enable-targets=host
# Perform a sanity check before proceeding
- echo "no" | ./cpt.py -c

script:
- travis_retry make -j4 -k
- travis_retry make -j4 -k
- travis_retry make install
- cd tools/cling
- make test LIT_ARGS=--no-progress-bar
# FIXME: Change URLs to the repo of @vgvassilev after repositories have been updated.
# Remove --no-test option when appropriate.
- ./cpt.py --create-dev-env=release --no-test --with-llvm-url=https://github.com/onyb/llvm --with-clang-url=https://github.com/onyb/clang --with-cling-url=http://root.cern.ch/git/cling.git

branches:
only:
Expand All @@ -40,17 +30,14 @@ branches:
notifications:
recipients:
- [email protected]
- [email protected]
#- [email protected]

email:
on_success: change
on_failure: always
#irc:
#channels:
#- "chat.freenode.net#rubinius"

template:
- "%{repository}/%{branch} (%{commit} - %{author}): %{message}"

os:
- linux
# - osx
- linux
6 changes: 4 additions & 2 deletions include/cling/Interpreter/Value.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#ifndef CLING_VALUE_H
#define CLING_VALUE_H

#include <stddef.h>

namespace llvm {
class raw_ostream;
}
Expand Down Expand Up @@ -101,7 +103,7 @@ namespace cling {
case kLongDoubleType:
return (T) V.getAs<long double>();
case kPointerType:
return (T) (unsigned long) V.getAs<void*>();
return (T) (size_t) V.getAs<void*>();
case kUnsupportedType:
V.AssertOnUnsupportedTypeCast();
}
Expand All @@ -115,7 +117,7 @@ namespace cling {
EStorageType storageType = V.getStorageType();
switch (storageType) {
case kPointerType:
return (T*) (unsigned long) V.getAs<void*>();
return (T*) (size_t) V.getAs<void*>();
default:
V.AssertOnUnsupportedTypeCast(); break;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Interpreter/BackendPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ namespace {
InlineCost getInlineCost(CallSite CS) {
return m_Inliner->getInlineCost(CS);
}
void getAnalysisUsage(AnalysisUsage &AU) const {
void getAnalysisUsage(AnalysisUsage &AU) const override {
m_Inliner->getAnalysisUsage(AU);
}
bool runOnSCC(CallGraphSCC &SCC) {
bool runOnSCC(CallGraphSCC &SCC) override {
return m_Inliner->runOnSCC(SCC);
}

using llvm::Pass::doFinalization;
// No-op: we need to keep the inlined functions for later use.
bool doFinalization(CallGraph& /*CG*/) {
bool doFinalization(CallGraph& /*CG*/) override {
// Module is unchanged
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Interpreter/DynamicLibraryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <stdlib.h>
#include <sys/stat.h>

#ifdef WIN32
#ifdef _WIN32
#include <Windows.h>
#include <shlobj.h>
#else
Expand Down
3 changes: 3 additions & 0 deletions lib/Interpreter/IncrementalParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "clang/Parse/Parser.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Sema/Sema.h"
#include "clang/Serialization/ASTWriter.h"

#include "llvm/IR/LLVMContext.h"
Expand Down Expand Up @@ -755,6 +756,8 @@ namespace cling {
PP.EnterSourceFile(FID, /*DirLookup*/0, NewLoc);
m_Consumer->getTransaction()->setBufferFID(FID);

Sema::SavePendingInstantiationsRAII SavedPendingInstantiations(S);

Parser::DeclGroupPtrTy ADecl;

while (!m_Parser->ParseTopLevelDecl(ADecl)) {
Expand Down
4 changes: 3 additions & 1 deletion lib/Interpreter/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,9 @@ namespace cling {
return Interpreter::kFailure;
}

// Even if the transaction was empty it is still success.
// Even if the transaction was empty it can still be a success.
if (getCI()->getDiagnostics().hasErrorOccurred())
return Interpreter::kFailure;
return Interpreter::kSuccess;
}

Expand Down
1 change: 1 addition & 0 deletions lib/Interpreter/LookupHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,7 @@ namespace cling {
// Parse the arguments now.
//

Interpreter::PushTransactionRAII TforDeser(Interp);
ParserStateRAII ResetParserState(P);
prepareForParsing(P,Interp,
funcArgs, llvm::StringRef("func.args.file"), diagOnOff);
Expand Down
2 changes: 1 addition & 1 deletion lib/Interpreter/MultiplexInterpreterCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace cling {
return result;
}

bool LookupObject(clang::LookupResult& LR, clang::Scope* S) {
bool LookupObject(clang::LookupResult& LR, clang::Scope* S) override {
bool result = false;
for (InterpreterCallbacks* cb : m_Callbacks)
result = cb->LookupObject(LR, S) || result;
Expand Down
10 changes: 8 additions & 2 deletions lib/Interpreter/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,21 @@ namespace cling {
namestr << "__cling_StoredValue_Destruct_" << RD;
}

std::string code("extern \"C\" void ");
{
// Check whether the function exists before calling
// utils::TypeName::GetFullyQualifiedName which is expensive
// (memory-wise). See ROOT-6909.
std::string code;
if (!m_Interpreter->getAddressOfGlobal(funcname)) {
code = "extern \"C\" void ";
clang::QualType RDQT(RD->getTypeForDecl(), 0);
std::string typeName
= utils::TypeName::GetFullyQualifiedName(RDQT, RD->getASTContext());
std::string dtorName = RD->getNameAsString();
code += funcname + "(void* obj){((" + typeName + "*)obj)->~"
+ dtorName + "();}";
}
// else we have an empty code string - but the function alreday exists
// so we'll be fine and take the existing one (ifUniq = true).

return m_Interpreter->compileFunction(funcname, code, true /*ifUniq*/,
false /*withAccessControl*/);
Expand Down
2 changes: 1 addition & 1 deletion lib/UserInterface/textinput/SignalHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace textinput {

void
SignalHandler::EmitCtrlZ() {
#ifndef WIN32
#ifndef _WIN32
raise(SIGTSTP);
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions lib/UserInterface/textinput/StreamReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "textinput/StreamReader.h"

#ifdef WIN32
#ifdef _WIN32
# include "textinput/StreamReaderWin.h"
#else
# include "textinput/StreamReaderUnix.h"
Expand All @@ -25,7 +25,7 @@ namespace textinput {

StreamReader*
StreamReader::Create() {
#ifdef WIN32
#ifdef _WIN32
return new StreamReaderWin();
#else
return new StreamReaderUnix();
Expand Down
4 changes: 2 additions & 2 deletions lib/UserInterface/textinput/StreamReaderUnix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// Axel Naumann <[email protected]>, 2011-05-12
//===----------------------------------------------------------------------===//

#ifndef WIN32
#ifndef _WIN32

#include "textinput/StreamReaderUnix.h"

Expand Down Expand Up @@ -274,4 +274,4 @@ namespace textinput {
}
}

#endif // ifndef WIN32
#endif // ifndef _WIN32
4 changes: 2 additions & 2 deletions lib/UserInterface/textinput/StreamReaderWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// Axel Naumann <[email protected]>, 2011-05-12
//===----------------------------------------------------------------------===//

#ifdef WIN32
#ifdef _WIN32

#include "textinput/StreamReaderWin.h"

Expand Down Expand Up @@ -211,4 +211,4 @@ namespace textinput {
}
}
}
#endif // WIN32
#endif // _WIN32
4 changes: 2 additions & 2 deletions lib/UserInterface/textinput/TerminalConfigUnix.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef WIN32
#ifndef _WIN32

//===--- TerminalConfigUnix.cpp - termios storage -------------*- C++ -*-===//
//
Expand Down Expand Up @@ -143,4 +143,4 @@ bool TerminalConfigUnix::IsInteractive() const {



#endif // ndef WIN32
#endif // ifndef _WIN32
4 changes: 2 additions & 2 deletions lib/UserInterface/textinput/TerminalDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "textinput/TerminalDisplay.h"

#ifdef WIN32
#ifdef _WIN32
#include "textinput/TerminalDisplayWin.h"
#else
#include "textinput/TerminalDisplayUnix.h"
Expand All @@ -30,7 +30,7 @@ namespace textinput {

TerminalDisplay*
TerminalDisplay::Create() {
#ifdef WIN32
#ifdef _WIN32
return new TerminalDisplayWin();
#else
return new TerminalDisplayUnix();
Expand Down
4 changes: 2 additions & 2 deletions lib/UserInterface/textinput/TerminalDisplayUnix.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef WIN32
#ifndef _WIN32

//===--- TerminalDisplayUnix.cpp - Output To UNIX Terminal ------*- C++ -*-===//
//
Expand Down Expand Up @@ -326,4 +326,4 @@ namespace textinput {

}

#endif // #ifndef WIN32
#endif // #ifndef _WIN32
4 changes: 2 additions & 2 deletions lib/UserInterface/textinput/TerminalDisplayWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// Axel Naumann <[email protected]>, 2011-05-12
//===----------------------------------------------------------------------===//

#ifdef WIN32
#ifdef _WIN32
#include "textinput/TerminalDisplayWin.h"

#include "textinput/Color.h"
Expand Down Expand Up @@ -214,4 +214,4 @@ namespace textinput {

}

#endif // WIN32
#endif // ifdef _WIN32
13 changes: 13 additions & 0 deletions tools/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ubuntu:14.04

# original script: https://github.com/maddouri/cling-ubuntu-docker

ADD ./build-cling.sh /root/build-cling.sh

RUN /usr/bin/env bash /root/build-cling.sh

ENV PATH "$PATH:/opt/cling/bin"
ENV CLING "/opt/cling/bin/cling"
ENV CLING_COMMIT_SHA1 "/opt/cling/CLING_COMMIT_SHA1"

ENTRYPOINT "/opt/cling/bin/cling"
Loading