Note that there are some explanatory texts on larger screens.

plurals
  1. POStatically link cilk library on Mac with gcc
    primarykey
    data
    text
    <p>I'm trying to statically link the cilk library to my program, in order to be able to run the executable on environments that don't have the cilk libraries installed (since it is not so common).</p> <p>Here is the best I could come up with:</p> <pre><code>cilkc -Ofast -Wextra -pedantic -fwhole-program -flto -msse4.2 -m64 -lm -mtune=generic -funroll-loops -finline-functions -ffast-math -lpthread -lz -DUSE_GCC -Wc,-std=c99 -Wc,-pipe -DUSE_FILE32API /usr/local/lib/libcilk.a /usr/local/lib/cilk/libcilkrt0.a src/all.c src/CilkSearch.cilk </code></pre> <p>As stated, i manually link libcilk.a and libcilkrt0.a to prevent gcc to link to the shared libraries. This makes the program size increase from 266Kb to 344Kb, which makes me think the static linking succeeded.</p> <p>Sadly, though, when i inspect with otool the dependencies of my executable, i get:</p> <pre><code>bin/hayabusa: /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5) /usr/local/lib/libcilk.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0) /opt/local/lib/gcc47/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) </code></pre> <p>I understand zlib and gcc, which i didn't statically link yet. But why is the libcilk.0.dylib dependency still there if i manually linked to libcilk.a?</p> <p>I also actually try to run the program on another computer, but at startup the program terminates complaining that /usr/local/lib/libcilk.0.dylib cannot be loaded.</p> <p>So my question is, explicitly specifying the .a to gcc is not enough to drop the specified library dependency? What else should I do to have my libcilk linked statically and not loaded at runtime?</p> <p>I already know about the -static option, but i don't want every library including system ones to be statically linked, I only want the cilk library to be statically linked.<br> Is this possible at all?</p>
    singulars
    1. This table or related slice is empty.
    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. 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