SRI-CSL / OCCAM

OCCAM: Object Culling and Concretization for Assurance Maximization
BSD 3-Clause "New" or "Revised" License
26 stars 10 forks source link

OCCAM on darwin #1

Closed ianamason closed 8 years ago

ianamason commented 8 years ago

It looks hard coded that OCCAM can't work on darwin.

For example, in genconfig.py:

libprevirt = os.getenv('OCCAM_LIB') + '/libprevirt.so'

ianamason commented 8 years ago

brew install protobuf-c

need to fix the library generation step in the src/Makefile too.

ianamason commented 8 years ago

OK so the C++ compiles fine on my darwin, need to fix the python. Not today.

ianamason commented 8 years ago

Python fixed, not sure if the libprevirt loads properly. Since opt does not recognize the library's args.

ianamason commented 8 years ago

seems like libhello does not work either (using the OCCAM/src Makefile). lets try a global install of llvm-3.5 with

brew install homebrew/versions/llvm35

rather than use my local build from source.

ianamason commented 8 years ago

no luck with the brew install. Trying a rebuild from source via:

../configure --prefix=/Users/iam/LLVM/llvm-3.5-install --enable-shared --enable-keep-symbols
ianamason commented 8 years ago

Bingo.

Though the build failed near the end with some missing ocaml symbols. It did build the libLLVM-3.5.1.dylib that seems to work, at least with hello ...

ianamason commented 8 years ago

OK that got the previrtualization to work on my mac. Had to explicity link with my new dylib

/Users/iam/LLVM/llvm-3.5-install/lib/libLLVM-3.5.1.dylib

but that can be fixed. Now the next issue is:

driver.run: prog clang++
driver.run: args ['/var/folders/b6/9ghp1z8d7vz9ht4btx1yk5g40000gn/T/tmpwjEl2r.o', u'-L/usr/lib', u'-L/usr/local/lib', '-Wl,-static', '-Wl,-call_shared', u'-onweb']
ld: unknown option: -call_shared
clang: error: linker command failed with exit code 1 (use -v to see invocation)

which is probably not that surprising since I seem to be picking up the cupertino clang++

lappy-lazuli:nweb iam$ which clang++
/usr/bin/clang++
lappy-lazuli:nweb iam$
ianamason commented 8 years ago

Actually I think the problem here is not with clang but with the flags?

-Wl,-static -Wl,-call_shared

which seem a little optimistic for a mac.

ianamason commented 8 years ago

@ashish-gehani looks like just a little more TLC will get this puppy working on my mac.

ianamason commented 8 years ago

10bbdbc5c63e8d8ddc404508065f58ef2911f0af

ianamason commented 8 years ago

Trying to build 3.5 with:

../configure --prefix=/Users/iam/LLVM/llvm-3.5-install --enable-shared --enable-keep-symbols --disable-bindings

to see if I can avoid the ocaml problems.

ianamason commented 8 years ago

Ok so that avoided the ocaml problems. I guess when we start doing big examples I should rebuild with:

--enable-optimized
ashish-gehani commented 8 years ago

On OS X, install Google Protocol Buffers (with MacPorts):

sudo port install protobuf-c protobuf-cpp
ianamason commented 8 years ago

modulo instructions this is toast.