Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsect283k1_ubuntu.so: cannot open shared object file #7

Closed
jerkyrs opened this issue Jun 4, 2018 · 16 comments
Closed

libsect283k1_ubuntu.so: cannot open shared object file #7

jerkyrs opened this issue Jun 4, 2018 · 16 comments
Assignees

Comments

@jerkyrs
Copy link
Contributor

jerkyrs commented Jun 4, 2018

  1. what i did
    built the server as per instructions and ran make server
    I tried this both on a dedicated Centos7 build as well as using Docker container
[iotex@localhost ~]$ docker attach 75df525c0e90
root@75df525c0e90:/go/src/github.com/iotexproject/iotex-core# make run
go build -o ./bin/server -v ./server
./bin/server -config=e2etests/config_local_delegate.yaml -log-level=debug
./bin/server: error while loading shared libraries: libsect283k1_ubuntu.so: cannot open shared object file: No such file or directory
Makefile:59: recipe for target 'run' failed
make: *** [run] Error 127

There is also no running process in docker container, by running the following inside of container or in my build directory

root@c8290f10f0c2:/go# iotex-server
iotex-server: error while loading shared libraries: libsect283k1_ubuntu.so: cannot open shared object file: No such file or directory
@zjshen14
Copy link
Contributor

zjshen14 commented Jun 4, 2018

This is because you've not setup LD_LIBRARY_PATH. libsect283k1_ubuntu.so isn't in a standard shared lib dir. See http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html.

BTW, be aware that the lib will still not work for you because you're in centos instead of ubuntu. We've not supported centos yet.

@zjshen14 zjshen14 self-assigned this Jun 4, 2018
@jerkyrs
Copy link
Contributor Author

jerkyrs commented Jun 4, 2018

where do i get this library from? i appreciate that it won't work on Centos7 but the container i assume should have this library installed. Is this library custom or is it provided by Ubuntu repositories? I do not see much reference outside of this project

@zjshen14
Copy link
Contributor

zjshen14 commented Jun 4, 2018

Yes, this is our custom library.

@jerkyrs
Copy link
Contributor Author

jerkyrs commented Jun 4, 2018

is it available on a repository somewhere, a bit stuck without it.

@zjshen14
Copy link
Contributor

zjshen14 commented Jun 4, 2018

It's under <project_root>/crypto/lib/libsect283k1_ubuntu.so

@jerkyrs
Copy link
Contributor Author

jerkyrs commented Jun 4, 2018

I only see Header files here, is there C file to compile to Shared library? I assume i would need to do something like the following assuming i had the C

gcc -c sect283k1.c -fPIC
ld -shared --soname libsect283k1_centos.so sect283k1.o

@jerkyrs
Copy link
Contributor Author

jerkyrs commented Jun 4, 2018

So temporary work around

export LD_LIBRARY_PATH=/go/src/github.com/iotexproject/iotex-core/crypto/lib/:$LD_LIBRARY_PATH
iotex-server -config /etc/iotex/config.yaml -log-path /var/log/iotex/server.log &

We can set this in Dockerfile ENV

ENV LD_LIBRARY_PATH=/go/src/github.com/iotexproject/iotex-core/crypto/lib/:$LD_LIBRARY_PATH

@zjshen14
Copy link
Contributor

zjshen14 commented Jun 4, 2018

  1. for make run, please wait for the fix tonight
  2. Dockerfile doesn't need setting LD_LIBRARY_PATH

@zjshen14
Copy link
Contributor

zjshen14 commented Jun 5, 2018

The problem should have been fixed. make run should work from project root dir (mac os and ubuntu). Feel free to reopen the issue if you find it's not.

@zjshen14 zjshen14 closed this as completed Jun 5, 2018
@jerkyrs
Copy link
Contributor Author

jerkyrs commented Jun 5, 2018

How can i compile the library for centos, are we missing the C files. It works as expected now for Docker container i can start iotex-server without shared library.

@zjshen14
Copy link
Contributor

zjshen14 commented Jun 5, 2018

It works as expected now for Docker container i can start iotex-server without shared library.

You're actually using the shared library. You don't need to setup LD_LIBRARY_PATH because we cp the library to the standard path.

@jerkyrs
Copy link
Contributor Author

jerkyrs commented Jun 5, 2018

How can i build it for Centos though ?

@zjshen14
Copy link
Contributor

zjshen14 commented Jun 5, 2018

We currently only ship the library binary, so that you're not able to build it on centos. We're still testing it with different linux distributions.

@jerkyrs
Copy link
Contributor Author

jerkyrs commented Jun 5, 2018

i assume sect283k1 is your lightweight ECC implementation ?

@wyh136
Copy link

wyh136 commented Jun 29, 2018

copy /go/src/github.com/iotexproject/iotex-core/crypto/lib/ibsect283k1_ubuntu.so /usr/lib
make run

problem solved.

@jerkyrs
Copy link
Contributor Author

jerkyrs commented Jun 29, 2018

@wyh136 bit of a hack but yes that will work, if you get any updates to this library in future you need to ensure you are using latest version so that should be done within your build, Iotex actually have a working Docker image (sort of most recent has bug)

From Dockerfile

 cp $GOPATH/src/github.com/iotexproject/iotex-core/crypto/lib/libsect283k1_ubuntu.so /usr/lib/ 

As this is part of Dockerfile it is updated each time you pull latest and re-run docker build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants