<p>This commit</p>
<ul>
<li>
<p>removes the python calls whose output is never actually used.</p>
</li>
<li>
<p>changes the include discovery to use python3(.x)-config. This is<br>
preferable because it also works for cross-compiling. Calling<br>
python3(.x) directly will always provide host flags, which for<br>
cross-compiling is not feasible.</p>
</li>
<li>
<p>updates LDFLAGS discovery to also work with >= Python 3.8. To<br>
achieve this python3(.x)-config is first run with the argument<br>
"--embed". If this does not succeed (exit status 1)<br>
python3(.x)-config is run again without "--embed". This is the<br>
method suggested by Python upstream to provide backwards<br>
compatibility. See [1] for more details.</p>
</li>
</ul>
<p>[1] <a rel="nofollow" href="https://docs.python.org/3/whatsnew/3.8.html">https://docs.python.org/3/whatsnew/3.8.html</a></p>
<p>Signed-off-by: Sebastian Kemper <a href="mailto:sebastian_ml@gmx.net">sebastian_ml@gmx.net</a></p>


<h4>Pre-Submission Checklist</h4>



<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Commit message has the format required by CONTRIBUTING guide</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Commits are split per component (core, individual modules, libs, utils, ...)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Each component has a single commit (if not, squash them into one commit)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> No commits to README files for modules (changes must be done to docbook files<br>
in <code>doc/</code> subfolder, the README file is autogenerated)</li>
</ul>
<h4>Type Of Change</h4>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Small bug fix (non-breaking change which fixes an issue)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> New feature (non-breaking change which adds new functionality)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Breaking change (fix or feature that would change existing functionality)</li>
</ul>
<h4>Checklist:</h4>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> PR should be backported to stable branches</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Tested changes locally</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Related to issue #XXXX (replace XXXX with an open issue number)</li>
</ul>
<h4>Description</h4>

<p>Hi all,</p>
<p>While trying to get app_python3 going on OpenWrt I stumbled over this. We're cross-compiling and I got the wrong includes (host includes instead of target includes).</p>
<p>And then there was also the "-lpython3.x" missing because we're using python 3.8 which doesn't provide this linker flags by default anymore. So once I tried to load the module on the target device it threw an error:</p>
<pre><code>Fri Apr 10 18:52:13 2020 daemon.err kamailio[15622]:  0(15622) ERROR: <core> [core/sr_module.c:512]: load_module(): could not open module </usr/lib/kamailio/modules/app_python3.so>: Error relocating /usr/lib/kamailio/modules/app_python3.so: PyTuple_New: symbol not found
Fri Apr 10 18:52:13 2020 daemon.err kamailio[15622]:  0(15622) CRITICAL: <core> [core/cfg.y:3543]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 124, column 12-27: failed to load module
</code></pre>
<p>This pull requested fixes this.</p>
<p>Kind regards,<br>
Seb</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/kamailio/kamailio/pull/2282'>https://github.com/kamailio/kamailio/pull/2282</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>app_python3: update Python3 detection mechanism</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2282/files#diff-20743ea3a54e1cf0bda1887167fef2fb">src/modules/app_python3/Makefile</a>
    (12)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/kamailio/kamailio/pull/2282.patch'>https://github.com/kamailio/kamailio/pull/2282.patch</a></li>
  <li><a href='https://github.com/kamailio/kamailio/pull/2282.diff'>https://github.com/kamailio/kamailio/pull/2282.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/2282">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZPEDEFRGTUNYQPJRP3RMFYB3ANCNFSM4MGKDWVA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZN5K27DAWI4QQAMKDLRMFYB3A5CNFSM4MGKDWVKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4I5LLMPQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/2282",
"url": "https://github.com/kamailio/kamailio/pull/2282",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>