phpv8 / v8js

V8 Javascript Engine for PHP — This PHP extension embeds the Google V8 Javascript Engine
http://pecl.php.net/package/v8js
MIT License
1.83k stars 200 forks source link

Where is $ORIGIN #261

Closed smebberson closed 8 years ago

smebberson commented 8 years ago

In the instructions for Linux https://github.com/phpv8/v8js/blob/php7/README.Linux.md is the line sudo chrpath -r '$ORIGIN' /usr/lib/libv8.so. What does $ORIGIN reference?

Thanks!

stesie commented 8 years ago

'$ORIGIN' is not an environment variable in this case, but literale value rpath should be set to. It means that accompanying libraries (i.e. libicu) are to be loaded from the same directory where libv8.so is in itself

smebberson commented 8 years ago

@stesie, sorry to be asking what is potentially a stupid question. But do you have any idea what it should be set to?

I'm trying to upgrade from V8Js 1.3.1 to 1.3.2 and I'm getting the error configure: error: Please provide V8 native blob as needed. I'm guessing because the build process has changed slightly?

The following is my build script for v8 (building on Alpine Linux):

ENV V8_VERSION=5.4.320

# Build v8
RUN apk --update upgrade && \
    apk add --update --no-cache --virtual .v8-build-dependencies bash curl git findutils g++ gcc icu-dev linux-headers make python && \
    cd /tmp && \
    git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git && \
    export "PATH=/tmp/depot_tools:$PATH" && \
    export V8_OUTPUT_DIR=/usr/local/v8 && \
    fetch v8 && \
    cd v8 && \
    git checkout $V8_VERSION && \
    gclient sync && \
    rm third_party/binutils/Linux_x64/Release/bin/* && \
    export PATH="/usr/x86_64-alpine-linux-musl/bin:$PATH" && \
    export GYP_DEFINES="linux_use_gold_flags=0" && \
    export GYPFLAGS="-Dv8_use_external_startup_data=0 -Dclang=0 -Dwerror= " && \
    make native library=shared snapshot=on -j 8 && \
    mkdir -p "$V8_OUTPUT_DIR/include" "$V8_OUTPUT_DIR/lib" && \
    cp -R include/* "$V8_OUTPUT_DIR/include" && \
    cp out/native/lib.target/lib* "$V8_OUTPUT_DIR/lib" && \
    chrpath -r "$ORIGIN" "$V8_OUTPUT_DIR/lib/libv8.so" && \
    echo -e "create $V8_OUTPUT_DIR/lib/libv8_libplatform.a\naddlib /tmp/v8/out/native/obj.target/src/libv8_libplatform.a\nsave\nend" | ar -M && \
    apk del .v8-build-dependencies && \
    rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
AlexMasterov commented 8 years ago

@smebberson try to add this:

echo -e "create ${$V8_OUTPUT_DIR}/lib/libv8_libbase.a\naddlib /tmp/v8/out/native/obj.target/src/libv8_libbase.a\nsave\nend" | ar -M
smebberson commented 8 years ago

Thanks @AlexMasterov. That worked a treat!