<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="">Can you post the output from: `swift build --clean && swift build -v`, thanks.<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 14, 2015, at 4:30 PM, Valentin Radu via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hello all,<div class=""><br class=""></div><div class=""><br class=""></div><div class="">I’m having some strange issues on osx when trying to link a C library module. I’ve successfully did this before with another library, however, for some reason this one doesn’t work.</div><div class="">My module map looks like this:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">module</span> CFCGI [system] {</div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(232, 35, 0);" class=""><span style="" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">header</span><span style="" class=""> </span>"/usr/local/include/cfcgi/cfcgi.h"</div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(232, 35, 0);" class=""><span style="" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">link</span><span style="" class=""> </span>"cfcgi"</div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">export</span> *</div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class="">}</div></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">And the output:</span></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class="">swift build</div><div style="margin: 0px; line-height: normal;" class="">Compiling Swift Module 'April' (1 sources)</div><div style="margin: 0px; line-height: normal;" class="">Linking Executable: .build/debug/April</div><div style="margin: 0px; line-height: normal;" class="">Undefined symbols for architecture x86_64:</div><div style="margin: 0px; line-height: normal;" class=""> "_cfcgi_create", referenced from:</div><div style="margin: 0px; line-height: normal;" class=""> _main in main.swift.o</div><div style="margin: 0px; line-height: normal;" class=""> "_cfcgi_free", referenced from:</div><div style="margin: 0px; line-height: normal;" class=""> _main in main.swift.o</div><div style="margin: 0px; line-height: normal;" class=""> "_cfcgi_start_and_wait", referenced from:</div><div style="margin: 0px; line-height: normal;" class=""> _main in main.swift.o</div><div style="margin: 0px; line-height: normal;" class="">ld: symbol(s) not found for architecture x86_64</div></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">It looks like the linker ignores the `link "cfcgi”` part. </div><div style="margin: 0px; line-height: normal;" class="">I tried lots of things but failed to find the reason behind this. I’m starting to think this might be related to this paragraph in the clang docs:</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">"Automatic linking with the link directive is not yet widely implemented, because it requires support from both the object file format and the linker. The notion is similar to Microsoft Visual Studio’s #pragma comment(lib…).”</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">Unfortunately I find it a little vague and I can’t know for sure if it applies here.</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">So far, this is what I know for sure:</div><div style="margin: 0px; line-height: normal;" class="">- libcfcgi.a is in /usr/local/lib and it’s compiled for x86_64</div><div style="margin: 0px; line-height: normal;" class="">- libcfcgi.a contains the above mentioned symbols, tested it with nm and linked it in a small C program </div><div style="margin: 0px; line-height: normal;" class="">- I’m on osx and build with the swift-2.2-SNAPSHOT-2015-12-01-a toolchain</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">Any input on this would be greatly appreciated!</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">Valentin Radu</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=cbMbdH1LnH6O78Q-2BHw3jtU8ikibH470Fh9meAJKpwSr-2FW9TRNjOy6aTRGKk9xb7L4UML5l6gWg60sbOmyIXi0qMbpwg-2FLO-2BSOpz5lwl-2FnIK1ALmPCKSJtuZ788wJzxk4U0vAIiayd5YBnOifXy-2FGz-2B-2BZxkZjqaOeDA-2Be0jvQCRdWtKFYw7W3CgBGze9pUoONaJ7s2ZvqumyMeMfNn2qDM-2BV81dWrev6LxvcpGKQCIAE-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</div>
_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-dev<br class=""></div></blockquote></div><br class=""></div></body></html>