<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi guys,<div class=""><br class=""></div><div class="">I’m wrapping three little native C libraries using SPM to a nice swifty modules. Say cmod1, cmod2, and cmod3. They all in the and are dependencies of a bigger project.</div><div class=""><br class=""></div><div class="">Since these legacy C libraries have headers in various ways incompatible with SPM I’m also providing my own custom module.modulemap inside of Sources/cmod1/include folder which exports only certain headers.</div><div class=""><br class=""></div><div class="">The module.modulemap is in pretty standard form with relative path to the header</div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">module cmod1 {</font></div><div class=""><font face="Menlo" class="">header “cmod1/header1.h”</font></div><div class=""><font face="Menlo" class="">export “*”</font></div><div class=""><font face="Menlo" class="">link “cmod1"</font></div><div class=""><font face="Menlo" class="">}&nbsp;</font></div><div class=""><br class=""></div><div class="">When using ``swift build`` to build the module, C sources compile fine but switc bails out when parsing modulemap because it can not find headers referenced from header1.h with an error message like this</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&lt;module-includes&gt;:1:10: note: in file included from &lt;module-includes&gt;:1:</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">#include “/projects/something/Sources/cmod1/include/cmod/header1.h"</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; ^</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">/projects/something/Sources/cmod1/include/cmod1/header1.h:18:10: error: ‘cmod1/header2.h' file not found</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><div style="font-family: Helvetica; font-size: 12px;" class="">Now I know that I can give swiftc correct -Xswiftc -Ipath switch and then it builds cleanly, but this means that plain ``swift build`` never succeeds…</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">Q1: Is my assumption correct that the ultimate goal of mine is to make the swift package build cleanly using just ``swift build`` without providing any commandline flags?</div><div style="font-family: Helvetica; font-size: 12px;" class="">Q2: When build of a certain package cmod1 requires command line flags -Xcc -Xlinker and -Xswiftc, what’s the correct way to pass them in when such package is a dependency of bigger project and which gets git pulled and compiled as part of outer package build?</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">thanks for your time, unfortunately the sources of these packages can not be made public yet but I think I can generate a simple broken project on github if anyone wants to take a look...</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">thanks,</div><div style="font-family: Helvetica; font-size: 12px;" class="">Martin</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div class=""><br class=""></div></div></body></html>