title: How to statically link a Chicken Scheme program that uses extensions?
body: <p>I have need to compile and <strong>statically link</strong> a Chicken program. I expect to use many extensions, most notably <code>http-client</code>.</p>
  
  <p>I can compile the source with the following command:</p>
  
  <pre><code>csc -compile-syntax -static linux-setup.scm
  </code></pre>
  
  <p>or</p>
  
  <pre><code>csc -R http-client -compile-syntax -static linux-setup.scm
  </code></pre>
  
  <p>But when I run it, I get the following error:</p>
  
  <pre><code>Error: (require) cannot load extension: http-client
  
      Call history:
  
      ##sys#require           &lt;--
  </code></pre>
  
  <p>I have also tried <code>(declare (uses http-client))</code> in the source, with no success:</p>
  
  <pre><code>linux-setup.o: In function `f_369':
  /mnt/data/Documents/Programming/chicken-scheme/linux-setup/linux-setup.c:219:
   undefined reference to `C_http_2dclient_toplevel'
  collect2: error: ld returned 1 exit status
  
  Error: shell command terminated with non-zero exit status 256: 'gcc' 'linux-setup.o'
   -o 'linux-setup' -L"/usr/lib"  -Wl,-R"/usr/lib" -static '/usr/lib/libchicken.a' -lm -ldl
  </code></pre>
  
  <p>Static linking is something I <strong>need</strong>. This is not an XY problem. I <strong>need</strong> my executables to run on a freshly-installed Linux system with no dependancies. This is the primary reason I switched from Common Lisp to Scheme in the first place.</p>
  
  <p>What am I doing wrong, please?</p>