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

Building/Linking Ubuntu 16.10 #1773

Closed
jbylund opened this issue Mar 17, 2017 · 12 comments
Closed

Building/Linking Ubuntu 16.10 #1773

jbylund opened this issue Mar 17, 2017 · 12 comments

Comments

@jbylund
Copy link

jbylund commented Mar 17, 2017

Without making any modifications (from git head) on trying to build pipelinedb I get:

 ../../src/timezone/localtime.o ../../src/timezone/strftime.o ../../src/timezone/pgtz.o ../../src/port/libpgport_srv.a ../../src/common/libpgcommon_srv.a -lpthread /usr/lib/libzmq.a -lstdc++ -lrt -lcrypt -ldl -lm -o pipelinedb
gcc: error: /usr/lib/libzmq.a: No such file or directory
Makefile:60: recipe for target 'pipelinedb' failed
make[3]: *** [pipelinedb] Error 1

If I additionally create this link:

sudo ln --symbolic --force /usr/lib/x86_64-linux-gnu/libzmq.a /usr/lib/libzmq.a

I get a whole bunch of undefined symbol issues:

/usr/lib/libzmq.a(src_libzmq_la-ctx.o): In function `zmq::ctx_t::ctx_t()':
(.text+0x6ddd): undefined reference to `sodium_init'
/usr/lib/libzmq.a(src_libzmq_la-ctx.o): In function `zmq::ctx_t::~ctx_t()':
(.text+0x7491): undefined reference to `randombytes_close'
/usr/lib/libzmq.a(src_libzmq_la-zmq_utils.o): In function `zmq_curve_keypair':
(.text+0x36c): undefined reference to `crypto_box_keypair'
/usr/lib/libzmq.a(src_libzmq_la-zmq_utils.o): In function `zmq_curve_public':
(.text+0x3f4): undefined reference to `crypto_scalarmult_base'
/usr/lib/libzmq.a(src_libzmq_la-curve_client.o): In function `zmq::curve_client_t::encode(zmq::msg_t*)':
(.text+0x1c8): undefined reference to `crypto_box_afternm'
/usr/lib/libzmq.a(src_libzmq_la-curve_client.o): In function `zmq::curve_client_t::decode(zmq::msg_t*)':

Finally if I apply this diff:

diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 6404232..4b39317 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -600,7 +600,7 @@ TAS         = @TAS@
 #
 # Link to ZMQ
 
-LIBS := -lpthread /usr/lib/libzmq.a -lstdc++ $(LIBS)
+LIBS := -lpthread /usr/lib/libzmq.a /usr/lib/x86_64-linux-gnu/libsodium.a -lstdc++ $(LIBS)
 
 
 ##########################################################################

Pipeline builds successfully, of course I think the correct thing to do is ask pkg-config where the lib for libsodium lives.

@derekjn
Copy link
Contributor

derekjn commented Mar 17, 2017

@jbylund thanks for the writeup! How did you build/install ZMQ?

@jbylund
Copy link
Author

jbylund commented Mar 18, 2017

I had installed via apt-get: apt-get install libzmq3-dev
but now I see in the readme you recommend building from source. I'll give that another go (probably Monday), and let you know.

@derekjn
Copy link
Contributor

derekjn commented Mar 18, 2017

@jbylund sounds good, I think that may be the underlying issue here. Have a good weekend!

@jbylund
Copy link
Author

jbylund commented Mar 22, 2017

Sorry, looks good after building zmq from source.

But still might be nice to have configure check zmq (would that be out of place)?

@derekjn
Copy link
Contributor

derekjn commented Mar 22, 2017

Thanks @jbylund. configure does check for the existence of -lzmq, but it doesn't inspect how the library was built.

@derekjn derekjn closed this as completed Mar 22, 2017
@luizkava
Copy link

I had the same problem...
How did you solved it ?

When I put de command make, appear "gcc: error: /usr/lib/libzmq.a: No such file or directory"

@jbylund
Copy link
Author

jbylund commented Jan 31, 2018

You want to try to install zmq from source https://gist.github.com/usmanm/32a54a6b0f1f29d7737f86e29f837afa

@SebAlbert
Copy link

I have the same problem, and, well, I installed it from source, as I do with nearly everything on Gentoo. I'm a bit reluctant to install it "from source manually" (as described there) while there exists a maintained ebuild doing it inside Gentoo's Portage system.

Is there some way to fix this from the side of PipelineDB's configuration, or by manually doing something after ZeroMQ is in place?

@SebAlbert
Copy link

Okay, I came around it by instructing Gentoo's Portage to build the static libs for zmq. Still, is there a rationale behind relying on static linking rather than shared libraries?

@derekjn
Copy link
Contributor

derekjn commented Mar 11, 2018

Still, is there a rationale behind relying on static linking rather than shared libraries?

@SebAlbert the reason we use static linking is that it simplifies our binary packages by quite a bit. PipelineDB binaries just work out of the box without relying on ZMQ existing as a shared library on the host system. However, when building from source I agree with you that it does make sense to also support shared libraries.

It just hasn't come up as an issue very often so it's not something we've added support for at this point. If it is a significant pain point for you then we can look at adding support for builds against a ZMQ shared library, and we'd definitely welcome any pull requests as well!

@SebAlbert
Copy link

It's fine with me for the time being, since luckily the Gentoo system supports that on demand, too. What's keeping me from compiling PipelineDB myself from source now is #1829, so that would be more important from my point of view.

@peschue
Copy link

peschue commented Oct 4, 2018

I replaced "/usr/lib/libzmq.a" in src/Makefile.global.in with "-lzmq" on openSUSE Leap 42.3 to make linking work against the zeromq-devel package.

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

5 participants