Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I did some investigation and although I could not find a satisfying solution to the problem, I did find a half-solution. </p> <p>The problem of static builds boils down to 3 things: </p> <ol> <li><p>Building and linking the project's internal libraries. </p> <p>Pretty simple, one just has to flip the <code>BUILD_SHARED_LIBS</code> switch <code>OFF</code>.</p></li> <li><p>Finding static versions of external libraries. </p> <p>The only way seems to be setting <code>CMAKE_FIND_LIBRARY_SUFFIXES</code> to contain the desired file suffix(es) (it's a priority list).</p> <p>This solution is quite a "dirty" one and very much against CMake's cross-platform aspirations. IMHO this should be handled behind the scenes by CMake, but as far as I understood, because of the ".lib" confusion on Windows, it seems that the CMake developers prefer the current implementation.</p></li> <li><p>Linking statically against system libraries. </p></li> </ol> <p>CMake provides an option <a href="https://cmake.org/cmake/help/v2.8.8/cmake.html#prop_tgt:LINK_SEARCH_END_STATIC" rel="noreferrer"><code>LINK_SEARCH_END_STATIC</code></a> which based on the documentation: "End a link line such that static system libraries are used." One would think, this is it, the problem is solved. However, it seems that the current implementation is not up to the task. If the option is turned on, CMake generates a implicit linker call with an argument list that ends with the options passed to the linker, including <code>-Wl,-Bstatic</code>. However, this is not enough. Only instructing the linker to link statically results in an error, in my case: <code>/usr/bin/ld: cannot find -lgcc_s</code>. What is missing is telling gcc as well that we need static linking through the <code>-static</code> argument which is <em>not</em> generated to the linker call by CMake. I think this is a bug, but I haven't managed to get a confirmation from the developers yet. </p> <p>Finally, I think all this could and should be done by CMake behind the scenes, after all it's not so complicated, except that it's impossible on Windows - if that count as complicated...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload