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

Still can't build statically on Linux #1831

Closed
arielf opened this issue Apr 6, 2019 · 4 comments
Closed

Still can't build statically on Linux #1831

arielf opened this issue Apr 6, 2019 · 4 comments

Comments

@arielf
Copy link
Collaborator

arielf commented Apr 6, 2019

Describe the bug

Following the build instructions for static linking of vw

Don't end up with a statically linked executable in build/vowpalwabbit/vw

To Reproduce

Steps to reproduce the behavior:

  1. CMAKE_OPTS='-DCMAKE_BUILD_TYPE=Release -DSTATIC_LINK_VW=ON'
  2. make clean
  3. mkdir -p build
  4. ( cd build && cmake .. ${CMAKE_OPTS} )
  5. make VERBOSE=1 -j
  6. file build/vowpalwabbit/vw
    Outputs:
build/vowpalwabbit/vw: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=94e1e27f8b5f324b626fd92ad47521d46bb1479b, not stripped

Expected behavior

file build/vowpalwabbit/vw should say the executable is statically linked

Observed Behavior

file build/vowpalwabbit/vw says the executable is dynamically linked

Environment

What version of VW did you use? latest https://github.com/VowpalWabbit/vowpal_wabbit/ HEAD as of 2019-04-05
What OS or language did you use? Ubuntu 18.04, c++

Additional context

Related things I noticed:

Flags are sometimes specified as On and sometimes as ON in the CMakeLists.txt files and documentation. The cmake documentation like this seem to imply that cmake variables are case sensitive and the two are not the same. Changing everything to ON in my build tree, doesn't seem to be sufficient to fix the issue though.

CMakeLists.txt also defines a switch set(unix_static_flag -static) but I'm not able to find where is this setting is being used.

Several test/unit_test/*.cc files have:

#ifndef STATIC_LINK_VW
#define BOOST_TEST_DYN_LINK
#endif

Wouldn't this ifndef always be false, given that both OFF and ON define this variable?
Is this mixing of C-preprocessor variables and Cmake variable a bug?

@jackgerrits
Copy link
Member

Hi @arielf,

I just looked into this and it seems like #1807 regressed this. Was a really simple typo that made it through. I've put out a PR to fix it.

Here is the output for file build/vowpalwabbit/vw I got:

vowpalwabbit/vw: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32, BuildID[sha1]=8ad541cb9beb89066299c61ad2bde713c668697e, not stripped

@arielf
Copy link
Collaborator Author

arielf commented Apr 9, 2019

Thanks @jackgerrits for the debug and quick fix. Highly appreciated!

@kumpera
Copy link
Collaborator

kumpera commented Apr 9, 2019

Sorry for that. Cmake is really weird :(

@arielf
Copy link
Collaborator Author

arielf commented Apr 13, 2019

No problem @kumpera . Thanks for all you work improving vw !

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