forked from eclipse-openj9/openj9
-
Notifications
You must be signed in to change notification settings - Fork 1
Running the linter for OpenJ9
Nazim Bhuiyan edited this page Dec 7, 2017
·
7 revisions
git clone https://github.com/ibmruntimes/openj9-openjdk-jdk9.git
- Copy/download this Dockerfile
- Build the Docker image:
docker build -t openj9build -f Dockerfile .
- Run the docker image with the cloned repo in step 1 mounted:
docker run --rm -it -v$PWD:/sandbox -v$HOME/open/jdk-9+181.openj9:/sdk openj9build /bin/bash
- The Dockerfile is not set up to install llvm and clang packages that are required for OMRChecker. Therefore, run the following command to get what is required:
apt-get update && apt-get install clang-3.8 llvm-3.8 libclang-3.8-dev llvm-3.8-dev
root@9280bacfa0b7:~# cd /sandbox/openj9-openjdk-jdk9/
root@9280bacfa0b7:/sandbox/openj9-openjdk-jdk9/# bash ./get_source.sh
root@9280bacfa0b7:/sandbox/openj9-openjdk-jdk9/# bash ./configure --with-freemarker-jar=/root/freemarker.jar
root@9280bacfa0b7:/sandbox/openj9-openjdk-jdk9/# make images
- The next step is to find where the linter.mk file is located under
build/
. It should be inbuild/linux-x86_64-normal-server-release/vm/compiler/trj9
- In
openj9-openjdk-jdk9/omr/tools/compiler/OMRChecker/test.py
modify the variablebase
in the constructor forclass OMRChecker
such that it looks like this:
class OMRChecker(tool.Tool):
'''A wrapper providing an interface for interacting with OMRChecker.'''
def __init__(self, checker):
base = [os.environ['CLANG'], '-fsyntax-only', '-Xclang', '-load', '-Xclang', checker, '-Xclang', '-add-plugin', '-Xclang', 'omr-checker']
super(OMRChecker, self).__init__(lambda args: base + args)
- In the same directory, you will need to modify the
Makefile
to build the plugin shared library object using clang-3.8. For that, you would have to replaceCXX
under# Build rules
withCLANG
. It should look like this:
#
# Build rules
#
$(OMRCHECKER_OBJECT): $(CHECKER_O)
$(CLANG) $(LDFLAGS) -o $@ $^
$(CHECKER_O): $(CHECKER_CPP) $(CHECKER_HPP)
$(CLANG) $(CXXFLAGS) -c -o $@ $<
- cd to
/build/linux-x86_64-normal-server-release/vm/compiler/trj9
- Set environment variables:
export J9SRC=/sandbox/openj9-openjdk-jdk9/build/linux-x86_64-normal-server-release/vm/ OMRCHECKER_DIR=/sandbox/openj9-openjdk-jdk9/omr/tools/compiler/OMRChecker/ LLVM_CONFIG=llvm-config-3.8 CLANG=clang++-3.8 CXX_PATH=clang++-3.8
- Now, run the linter:
root@9280bacfa0b7:/sandbox/openj9-openjdk-jdk9/build/linux-x86_64-normal-server-release/vm/compiler/trj9# make -f linter.mk