WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit ec94cd5b authored by Kunshan Wang's avatar Kunshan Wang
Browse files

Fixes for Linux.

`cbinding/refimpl2-config` now puts `libmurefimpl2start.so` on the
"rpath" of the binary.
parent bc6c4d55
...@@ -21,13 +21,14 @@ endif ...@@ -21,13 +21,14 @@ endif
ifeq ($(OS),OSX) ifeq ($(OS),OSX)
CFLAGS += -I $(JAVA_HOME)/include/darwin CFLAGS += -I $(JAVA_HOME)/include/darwin
LDFLAGS += -L $(JAVA_HOME)/jre/lib/server -l jvm -rpath $(JAVA_HOME)/jre/lib/server
endif endif
ifeq ($(OS),LINUX) ifeq ($(OS),LINUX)
CFLAGS += -I $(JAVA_HOME)/include/linux CFLAGS += -I $(JAVA_HOME)/include/linux
LDFLAGS += -L $(JAVA_HOME)/jre/lib/amd64/server -l jvm -Wl,-rpath,$(JAVA_HOME)/jre/lib/amd64/server
endif endif
LDFLAGS += -L $(JAVA_HOME)/jre/lib/server -l jvm -rpath $(JAVA_HOME)/jre/lib/server
.PHONY: all .PHONY: all
all: libs tests all: libs tests
...@@ -48,7 +49,7 @@ classpath.h: classpath.txt ...@@ -48,7 +49,7 @@ classpath.h: classpath.txt
tests: test_client tests: test_client
test_client: test_client.c libmurefimpl2start.so test_client: test_client.c libmurefimpl2start.so
$(CC) $(CFLAGS) `./refimpl2-config --istart --cflags --libs` -o $@ $< $(CC) `./refimpl2-config --istart --cflags --libs` -o $@ $<
.PHONY: clean veryclean .PHONY: clean veryclean
......
...@@ -11,9 +11,13 @@ compile`. Then come here and type `make JAVA_HOME=/path/to/the/java/home`. ...@@ -11,9 +11,13 @@ compile`. Then come here and type `make JAVA_HOME=/path/to/the/java/home`.
This will produce the `libmurefimpl2start.so` dynamic library that contains code This will produce the `libmurefimpl2start.so` dynamic library that contains code
that starts the JVM and creates the MuVM instance for your client written in C. that starts the JVM and creates the MuVM instance for your client written in C.
This library will **hard code the classpath and the JVM path** into the shared This library will **hard code the classpath and the JVM library path** into the
object, so it only works for this particular `microvm-refimpl2` repository you shared object, so it only works for this particular `microvm-refimpl2`
cloned. repository you cloned. This is because as this reference implementation is a
research project, it is unlikely to install it into any well-known places such
as `/usr`. Hard-coding the JVM's `libjvm.so` path using "rpath" eliminates the
need to put the JVM library path to `LD_LIBRARY_PATH`, since JVM is seldom
installed into `/usr/lib`.
## Usage ## Usage
...@@ -36,7 +40,10 @@ function provides more options. ...@@ -36,7 +40,10 @@ function provides more options.
Use the `refimpl2-config` script with the `--istart` flag to indicate your Use the `refimpl2-config` script with the `--istart` flag to indicate your
program will create the Mu reference implementation instance. Such clients need program will create the Mu reference implementation instance. Such clients need
to link against `libmurefimpl2start.so`. to link against `libmurefimpl2start.so`, and it will **hard-code its location
using rpath** for the same reason why it hard-codes the classpath and JVM
locations, otherwise your executable file will require `libmurefimpl2start.so`
to be on the `LD_LIBRARY_PATH` to execute.
For example: For example:
......
...@@ -27,7 +27,8 @@ if '--istart' in args: ...@@ -27,7 +27,8 @@ if '--istart' in args:
if '--cflags' in args: if '--cflags' in args:
print("-I {} ".format(whereami), end="") print("-I {} ".format(whereami), end="")
if '--libs' in args: if '--libs' in args:
print("-L {} -l murefimpl2start ".format(whereami), end="") print("-L {} -l murefimpl2start -Wl,-rpath,{}".format(
whereami, whereami), end="")
else: else:
if '--cflags' in args: if '--cflags' in args:
print("-I {} ".format(whereami), end="") print("-I {} ".format(whereami), end="")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment