<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thanks for taking the time to explain that.<div class=""><br class=""></div><div class="">I will try it out on a few Xcode versions.</div><div class=""><br class=""></div><div class="">We might do well to put this into a wki page or a short screen-capture video.</div><div class=""><br class=""></div><div class="">People seem highly likely to me to need to know how to do this soon if not already now, building things with Xcode using universal libraries arm64/Intel that MacPorts can provide.</div><div class=""><br class=""></div><div class="">If we get this working as smoothly as it hopefully will, we should link to it prominently from the very front page of <a href="http://MacPorts.org" class="">MacPorts.org</a>.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Ken</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 29, 2021, at 1:17 PM, Andrew Udvare <<a href="mailto:audvare@gmail.com" class="">audvare@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><br class=""><blockquote type="cite" class="">On 2021-01-29, at 12:40, Ken Cunningham <<a href="mailto:ken.cunningham.webuse@gmail.com" class="">ken.cunningham.webuse@gmail.com</a>> wrote:<br class=""><br class="">I was working on an Xcode project in the Xcode GUI the other day (Apple's ld64-530) and needed various parts  that I know MacPorts supplies.<br class=""><br class=""><br class="">But it is not simple or intuitive to know how to add headers and libraries from MacPorts to an Xcode project, I found.<br class=""><br class=""><br class="">I did see how to add header search paths (that was not trivially easy to find, but could be found), but I had to add "/opt/local/include" which brought in everything from MacPorts, rather than just the bit I wanted. And then there are the libraries, and then the install_names will be all wrong.<br class=""><br class=""></blockquote>You should have /opt/local/include as one of the header search paths if you intend to link with a dylib that is in /opt/local/lib. But then you must also have the correct rpath in the binary too.<br class=""><blockquote type="cite" class=""><br class="">So, as I was working through this I thought -- in 20 years, this must have come up many times -- where is the wiki page on how to do this? And -- there must be many people out there who use Xcode all day long who know how to make this work smoothly much better than I do.<br class=""><br class=""><br class="">Does anyone have the recipe for happy use of MacPorts headers and libraries in an Xcode GUI project?<br class=""></blockquote><br class="">You can add /opt/local/Library/Frameworks as one of the Framework search paths.<br class=""><br class="">Not required but you should have /opt/local/lib as a library lookup path.<br class=""><br class="">These last two are not required if you link only in the following way:<br class=""><br class="">When you go to the project settings, you can click on 'Build Phases' and then under 'Link Binary With Libraries', click the + button and add frameworks from /opt/local/Library/Frameworks and dylibs from /opt/local/lib. In the dialog, on the bottom left, choose Add Other then Add Files. Then hit Command+Shift+G and type /opt/local. Browse to find the library (dylib)/framework you want to add.<br class=""><br class="">The resulting binary should have commands similar to (otool -l):<br class=""><br class="">Load command 36<br class="">          cmd LC_RPATH<br class="">      cmdsize 48<br class="">         path /opt/local/Library/Frameworks (offset 12)<br class=""><br class="">For any directly linked framework:<br class=""><br class="">Load command 33<br class="">          cmd LC_LOAD_DYLIB<br class="">      cmdsize 64<br class="">         name @rpath/Commandant.framework/Commandant (offset 24)<br class="">   time stamp 2 Wed Dec 31 19:00:02 1969<br class="">      current version 1.0.0<br class="">compatibility version 1.0.0<br class=""><br class="">And possibly:<br class=""><br class="">Load command 77<br class="">          cmd LC_RPATH<br class="">      cmdsize 32<br class="">         path /opt/local/lib (offset 12)<br class=""><br class="">I've patched many projects to use frameworks from MacPorts, most recently mas: <a href="https://github.com/Tatsh/ports/tree/master/sysutils/mas" class="">https://github.com/Tatsh/ports/tree/master/sysutils/mas</a><br class=""><br class="">Andrew</div></div></blockquote></div><br class=""></div></body></html>