title: Building Boost Python Debug
body: <p>I am definitely not a <code>bjam</code> expert, so pardon my ignorance if it's something really stupid.</p>
  
  <p>I am trying to build a <code>debug</code> version of <code>boost::python</code> using <a href="http://www.mantidproject.org/Building_Boost_Python" rel="nofollow">this tutorial</a>.</p>
  
  <p>I have built <code>Python 3.3.0</code> in my folder <code>C:\Development\Python-3.3.0</code>. The build is valid, the <code>.lib</code>, <code>.dll</code> and <code>.exe</code> are all present in the <code>PCBuild</code> folder. I tested the interpreter and it works properly.</p>
  
  <p>I am using the following command line:</p>
  
  <pre><code>bjam --user-config=user-config.jam --with-python python-debugging=on threading=multi variant=debug link=shared stage
  </code></pre>
  
  <p>My issue comes from <code>user-config.jam</code>. I tried following the specifications of the tutorial, using the following:</p>
  
  <pre><code>using python : 3.3 : C:\\Development\\Python-3.3.0\\PCBuild\\python_d.exe
      : C:\\Development\\Python-3.3.0\\Include C:\\Development\\Python-3.3.0\\PC
      : C:\\Development\\Python-3.3.0\\PCBuild
      : &lt;python-debugging&gt;on ;
  </code></pre>
  
  <p>But the linking fails... for some reason, it doesn't seem to pick up that I want it to use 3.3, here's a part of the output log:</p>
  
  <pre><code>...updating 10 targets...
  msvc.link.dll bin.v2\libs\python\build\msvc-11.0\debug\python-debugging-on\threa
  ding-multi\boost_python-vc110-mt-gyd-1_52.dll
  LINK : fatal error LNK1104: cannot open file 'python26_d.lib'
  
          call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.b
  at" x86 &gt;nul
  link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /MACHINE:X86 /subsystem:console /out:"b
  in.v2\libs\python\build\msvc-11.0\debug\python-debugging-on\threading-multi\boos
  t_python-vc110-mt-gyd-1_52.dll" /IMPLIB:"bin.v2\libs\python\build\msvc-11.0\debu
  g\python-debugging-on\threading-multi\boost_python-vc110-mt-gyd-1_52.lib" /LIBPA
  TH:"C:\Development\Python-3.3.0\PCBuild"   @"bin.v2\libs\python\build\msvc-11.0\
  debug\python-debugging-on\threading-multi\boost_python-vc110-mt-gyd-1_52.dll.rsp
  "
  </code></pre>
  
  <p>I tried making modifications to the <code>user-config.jam</code>. At first, I didn't escape the <code>\</code>, and surprisingly, it was detecting that I wanted to build 3.3 but the <code>/LIBPATH</code> was wrong (no backslashes):</p>
  
  <pre><code>...updating 10 targets...
  msvc.link.dll bin.v2\libs\python\build\msvc-11.0\debug\python-debugging-on\threa
  ding-multi\boost_python-vc110-mt-gyd-1_52.dll
  LINK : fatal error LNK1181: cannot open input file 'python33_d.lib'
  
          call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.b
  at" x86 &gt;nul
  link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /MACHINE:X86 /subsystem:console /out:"b
  in.v2\libs\python\build\msvc-11.0\debug\python-debugging-on\threading-multi\boos
  t_python-vc110-mt-gyd-1_52.dll" /IMPLIB:"bin.v2\libs\python\build\msvc-11.0\debu
  g\python-debugging-on\threading-multi\boost_python-vc110-mt-gyd-1_52.lib" /LIBPA
  TH:"C:DevelopmentPython-3.3.0PCBuild"   @"bin.v2\libs\python\build\msvc-11.0\deb
  ug\python-debugging-on\threading-multi\boost_python-vc110-mt-gyd-1_52.dll.rsp"
  </code></pre>
  
  <p>As you can see, it's looking for <code>python33_d.lib</code>, which is what is desired, but <code>/LIBPATH</code> doesn't contain the <code>\</code>. I also tried replacing with <code>/</code> which again goes back to trying to link <code>python26_d.lib</code>.</p>
  
  <p>If it can be useful, I uninstalled any previously installed version of Python.</p>
  
  <p>How can I make my <code>jam</code> file properly require the version 3.3 and provide the right paths?</p>
  
  <p><strong>Edit:</strong> Playing a bit more around, I removed the "space" before the <code>;</code>... just doing that makes it look for the right version <code>3.3</code>, but it's trying to link the release version from a relative <code>libs</code> folder... worst case I wouldn't mind copying the libs from <code>PCBuild</code> to <code>libs</code></p>
  
  <pre><code>using python : 3.3 : C:\\Development\\Python-3.3.0\\PCBuild\\python_d.exe
      : C:\\Development\\Python-3.3.0\\Include C:\\Development\\Python-3.3.0\\PC
      : C:\\Development\\Python-3.3.0\\PCBuild
      : &lt;python-debugging&gt;on;
  </code></pre>
  
  <p>The funny part is that it's the closest to what I'm trying to achieve, but it outputs </p>
  
  <pre><code>C:\Development\boost_1_52_0\boost_1_52_0\user-config.jam:4: syntax error at EOF
  </code></pre>
  
  <p>The <code>jam</code> parser seems pretty weak... any hints or tip would be helpful</p>
  
  <p><strong>Edit 2:</strong> trying to simplify the problem, I changed my <code>user-config.jam</code> to contain nothing but:</p>
  
  <pre><code>using python : 3.3 ;
  </code></pre>
  
  <p>And use the following command line:</p>
  
  <pre><code>bjam --user-config=user-config.jam --with-python threading=multi variant=release link=shared stage
  </code></pre>
  
  <p>As expected, it can't find the <code>.lib</code></p>
  
  <pre><code>...updating 4 targets...
  msvc.link.dll bin.v2\libs\python\build\msvc-11.0\release\threading-multi\boost_p
  ython3-vc110-mt-1_52.dll
  LINK : fatal error LNK1181: cannot open input file 'python33.lib'
  
          call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.b
  at" x86 &gt;nul
  link /NOLOGO /INCREMENTAL:NO /DLL /MACHINE:X86 /subsystem:console /out:"bin.v2\l
  ibs\python\build\msvc-11.0\release\threading-multi\boost_python3-vc110-mt-1_52.d
  ll" /IMPLIB:"bin.v2\libs\python\build\msvc-11.0\release\threading-multi\boost_py
  thon3-vc110-mt-1_52.lib" /LIBPATH:"C:\Development\Python-3.3.0\libs"   @"bin.v2\
  libs\python\build\msvc-11.0\release\threading-multi\boost_python3-vc110-mt-1_52.
  dll.rsp"
  </code></pre>
  
  <p>So I decided to clone my <code>PCBuild</code> folder into <code>libs</code> so that all the libs I built would be accessible... but after doing so, without changing the <code>.jam</code> or the command line... it's now looking for Python 2.6?!?</p>
  
  <pre><code>...updating 4 targets...
  msvc.link.dll bin.v2\libs\python\build\msvc-11.0\release\threading-multi\boost_p
  ython3-vc110-mt-1_52.dll
  LINK : fatal error LNK1104: cannot open file 'python26.lib'
  
          call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.b
  at" x86 &gt;nul
  link /NOLOGO /INCREMENTAL:NO /DLL /MACHINE:X86 /subsystem:console /out:"bin.v2\l
  ibs\python\build\msvc-11.0\release\threading-multi\boost_python3-vc110-mt-1_52.d
  ll" /IMPLIB:"bin.v2\libs\python\build\msvc-11.0\release\threading-multi\boost_py
  thon3-vc110-mt-1_52.lib" /LIBPATH:"C:\Development\Python-3.3.0\libs"   @"bin.v2\
  libs\python\build\msvc-11.0\release\threading-multi\boost_python3-vc110-mt-1_52.
  dll.rsp"
  </code></pre>
  
  <p>The more I dig in, the more confused I am... also, one fails with a <code>LNK1104</code> and the other one with <code>LNK1181</code>...</p>