You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by Andrzej <bo...@wp.pl> on 2017/08/30 21:49:22 UTC

Problem writing .so - libevent

I want write shared object using native client classes.
My BUCK:
cxx_binary(
     name="hbNativeLib",
     srcs=[
         "hbNativeLib.cpp",
     ],
     deps=[":core", "//connection:connection"],
     compiler_flags = ['-fPIC'],
     link_style="shared",)
//-fPIC here is needed?

I have error:
/usr/bin/ld: 
/usr/src/hbase/hbase-native-client/buck-out/gen/third-party/gen_libevent/gen_libevent/libevent.a(event.o): 
relocation R_X86_64_PC32 against symbol `event_global_current_base_' can 
not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
clang: error: linker command failed with exit code 1 (use -v to see 
invocation)

Problem is because libevent is system library (?)
is possible install it with -fPIC or not using this library?

Re: Problem writing .so - libevent

Posted by Andrzej <bo...@wp.pl>.
W dniu 31.08.2017 o 02:43, Andrzej pisze:
> I try

I changed library "event" to be dynamic.
Two problems:
buck build //core:core - nothing to build

buck build //core:hbNativeLib - give me

|=> //core:hbNativeLib#binary...  6.8s (running c++ link[1.0s])
/usr/bin/ld: warning: libif_if.so, needed by 
/usr/src/hbase/hbase-native-client/buck-out/gen/core/core#default,shared/libcore_core.so, 
not found (try using -rpath or -rpath-link)

/usr/bin/ld: warning: libutils_utils.so, needed by 
/usr/src/hbase/hbase-native-client/buck-out/gen/core/core#default,shared/libcore_core.so, 
not found (try using -rpath or -rpath-link)

....

libif_if.so exists in buck-out/gen/if/if#default,shared - 33 MB
libutils_utils.so - buck-out/gen/utils/utils#default,shared/ - 1.1 MB

But if is posssible, I want only ultimate hbNativeLib be shared, not 
libif_if,libutils_utils

Re: Couldn't get dependency '//third-party:folly'

Posted by Andrzej <bo...@wp.pl>.
W dniu 14.09.2017 o 12:36, Andrzej pisze:
> On Mint I can rebuild native client, but on new environment, Ubuntu:
> sudo ./bin/start-docker.sh
> buck build //core:core
> 
> it says:
> BUILD FAILED: Couldn't get dependency '//third-party:folly' of target 
> '//core:core':
> No build file at third-party/BUCK when resolving target 
> //third-party:folly.

And directory is small: <200 MB instead of 3.6 GB in previous Linux

Re: Couldn't get dependency '//third-party:folly'

Posted by Andrzej <bo...@wp.pl>.
W dniu 14.09.2017 o 14:12, Ted Yu pisze:
> Please check that hbase-native-client/third-party/BUCK has the following:
> 
> folly = add_system_libs(
>      ['folly'],
>      lib_dir='/usr/local/lib',
>      exported_deps=tp_dep_rules,)
> 
> The folly lib is built when docker is built.

Now compiling, it seems that `sudo ./bin/start-docker.sh` is not enough.
Now I have add user to docker group and restarted docker before calling 
start-docker.sh

Re: Couldn't get dependency '//third-party:folly'

Posted by Ted Yu <yu...@gmail.com>.
Please check that hbase-native-client/third-party/BUCK has the following:

folly = add_system_libs(
    ['folly'],
    lib_dir='/usr/local/lib',
    exported_deps=tp_dep_rules,)

The folly lib is built when docker is built.

On Thu, Sep 14, 2017 at 3:36 AM, Andrzej <bo...@wp.pl> wrote:

> On Mint I can rebuild native client, but on new environment, Ubuntu:
> sudo ./bin/start-docker.sh
> buck build //core:core
>
> it says:
> BUILD FAILED: Couldn't get dependency '//third-party:folly' of target
> '//core:core':
> No build file at third-party/BUCK when resolving target
> //third-party:folly.
>
>

Couldn't get dependency '//third-party:folly'

Posted by Andrzej <bo...@wp.pl>.
On Mint I can rebuild native client, but on new environment, Ubuntu:
sudo ./bin/start-docker.sh
buck build //core:core

it says:
BUILD FAILED: Couldn't get dependency '//third-party:folly' of target 
'//core:core':
No build file at third-party/BUCK when resolving target //third-party:folly.


Re: How force rebuild with buck on docker?

Posted by Ted Yu <yu...@gmail.com>.
Have you tried removing buck-out directory (under hbase-native-client) ?

On Fri, Sep 22, 2017 at 7:01 AM, Andrzej <bo...@wp.pl> wrote:

> W dniu 05.09.2017 o 17:25, Ted Yu pisze:
>
>> Have you tried running the following command ?
>>
>> buck clean
>>
>
> Nothing helps, removed megabytes but not forces to rebuild
>

Re: How force rebuild with buck on docker?

Posted by Andrzej <bo...@wp.pl>.
W dniu 05.09.2017 o 17:25, Ted Yu pisze:
> Have you tried running the following command ?
> 
> buck clean

Nothing helps, removed megabytes but not forces to rebuild

Re: How force rebuild with buck on docker?

Posted by Ted Yu <yu...@gmail.com>.
Have you tried running the following command ?

buck clean

bq. now it doesn't rebuild

Did you mean that buck build didn't detect the change you made to the
source file ?

On Tue, Sep 5, 2017 at 8:08 AM, Andrzej <bo...@wp.pl> wrote:

> In BUCK I have modified simple-client:
> cxx_binary(
>     name="hbNative",
>     srcs=[
>         "hbNative.cpp",
>     ],
>     compiler_flags=['-w'],
>     deps=[":core", "//connection:connection"],)
>
> Previously I build it, but now it doesn't rebuild.
> Next I have deleted hbNative in HBASE-14850/hbase-native-client/buck-out/gen/core/
> but then I have Error getting output size:
> root@securecluster:/usr/src/hbase/hbase-native-client# buck build
> //core:hbNative
> Error getting output size for //core:hbNative#binary.
> java.nio.file.NoSuchFileException: /usr/src/hbase/hbase-native-cl
> ient/buck-out/gen/core/hbNative
> java.nio.file.NoSuchFileException: /usr/src/hbase/hbase-native-cl
> ient/buck-out/gen/core/hbNative
> ....
>

How force rebuild with buck on docker?

Posted by Andrzej <bo...@wp.pl>.
In BUCK I have modified simple-client:
cxx_binary(
     name="hbNative",
     srcs=[
         "hbNative.cpp",
     ],
     compiler_flags=['-w'],
     deps=[":core", "//connection:connection"],)

Previously I build it, but now it doesn't rebuild.
Next I have deleted hbNative in 
HBASE-14850/hbase-native-client/buck-out/gen/core/ but then I have Error 
getting output size:
root@securecluster:/usr/src/hbase/hbase-native-client# buck build 
//core:hbNative
Error getting output size for //core:hbNative#binary.
java.nio.file.NoSuchFileException: 
/usr/src/hbase/hbase-native-client/buck-out/gen/core/hbNative
java.nio.file.NoSuchFileException: 
/usr/src/hbase/hbase-native-client/buck-out/gen/core/hbNative
....

Re: Problem writing .so - libevent

Posted by Andrzej <bo...@wp.pl>.
W dniu 31.08.2017 o 02:36, Ted Yu pisze:
> In my docker VM, I see:
> 
> /usr/lib/x86_64-linux-gnu/libevent.a

True, in my usual Linux I see only libevent.so, but in docker I see both

> You can try building //core:core first which should generate libevent.a
> (dependency).

I try

Re: Problem writing .so - libevent

Posted by Ted Yu <yu...@gmail.com>.
In my docker VM, I see:

/usr/lib/x86_64-linux-gnu/libevent.a

You can try building //core:core first which should generate libevent.a
(dependency).

Cheers

On Wed, Aug 30, 2017 at 5:28 PM, Andrzej <bo...@wp.pl> wrote:

> W dniu 31.08.2017 o 00:35, Ted Yu pisze:
>
>> libevent.a is system library.
>>
>>> From hbase-native-client/third-party/BUCK :
>>>
>>
>> system_libs = [
>>      "lzma",
>>      "event",
>>
>
> Just problem, that libevent.a is system library. Is possible install other
> version or recompile it anyway? From where is copied to docker environment?
> In /usr/ I have /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5 but docker
> say that libevent.a.
>

Re: Problem writing .so - libevent

Posted by Andrzej <bo...@wp.pl>.
W dniu 31.08.2017 o 00:35, Ted Yu pisze:
> libevent.a is system library.
>>From hbase-native-client/third-party/BUCK :
> 
> system_libs = [
>      "lzma",
>      "event",

Just problem, that libevent.a is system library. Is possible install 
other version or recompile it anyway? From where is copied to docker 
environment? In /usr/ I have /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5 
but docker say that libevent.a.

Re: Problem writing .so - libevent

Posted by Ted Yu <yu...@gmail.com>.
libevent.a is system library.
From hbase-native-client/third-party/BUCK :

system_libs = [
    "lzma",
    "event",

On Wed, Aug 30, 2017 at 3:31 PM, Andrzej <bo...@wp.pl> wrote:

> W dniu 31.08.2017 o 00:27, Ted Yu pisze:
>
>> Were you using docker ?
>> Was libevent.a generated ?
>>
>> In my docker VM, I have:
>>
>> -rw-r--r-- 1 root root 506746 Aug 16 16:08
>> buck-out/gen/third-party/gen_libevent/gen_libevent/libevent.a
>>
>
> The same:
> full path:
> /home/andrzej/code/hbase/hbase-native-client/buck-out/gen/
> third-party/gen_libevent/gen_libevent/libevent.a
>
> Is libevent.a generated but I can't find sources
> Notabene: in my /usr/ is not libevent.a but libevent.so
>

Re: Problem writing .so - libevent

Posted by Andrzej <bo...@wp.pl>.
W dniu 31.08.2017 o 00:27, Ted Yu pisze:
> Were you using docker ?
> Was libevent.a generated ?
> 
> In my docker VM, I have:
> 
> -rw-r--r-- 1 root root 506746 Aug 16 16:08
> buck-out/gen/third-party/gen_libevent/gen_libevent/libevent.a

The same:
full path:
/home/andrzej/code/hbase/hbase-native-client/buck-out/gen/third-party/gen_libevent/gen_libevent/libevent.a 


Is libevent.a generated but I can't find sources
Notabene: in my /usr/ is not libevent.a but libevent.so

Re: Problem writing .so - libevent

Posted by Ted Yu <yu...@gmail.com>.
Were you using docker ?
Was libevent.a generated ?

In my docker VM, I have:

-rw-r--r-- 1 root root 506746 Aug 16 16:08
buck-out/gen/third-party/gen_libevent/gen_libevent/libevent.a

Cheers

On Wed, Aug 30, 2017 at 2:49 PM, Andrzej <bo...@wp.pl> wrote:

> I want write shared object using native client classes.
> My BUCK:
> cxx_binary(
>     name="hbNativeLib",
>     srcs=[
>         "hbNativeLib.cpp",
>     ],
>     deps=[":core", "//connection:connection"],
>     compiler_flags = ['-fPIC'],
>     link_style="shared",)
> //-fPIC here is needed?
>
> I have error:
> /usr/bin/ld: /usr/src/hbase/hbase-native-client/buck-out/gen/third-party/
> gen_libevent/gen_libevent/libevent.a(event.o): relocation R_X86_64_PC32
> against symbol `event_global_current_base_' can not be used when making a
> shared object; recompile with -fPIC
> /usr/bin/ld: final link failed: Bad value
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
> Problem is because libevent is system library (?)
> is possible install it with -fPIC or not using this library?
>