<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
</head>
<body style='FONT:10pt Courier New;COLOR:#000000;background:;'><table style="Z-INDEX: 2; BORDER-BOTTOM: #c0c0c0 1px solid; POSITION: static; BORDER-LEFT: #c0c0c0 1px solid; BACKGROUND-COLOR: #ffffff; MARGIN-TOP: 17px; WIDTH: 500px; FONT-FAMILY: Tahoma,Arial; HEIGHT: 66px; MARGIN-LEFT: 12px; FONT-SIZE: 10pt; BORDER-TOP: #c0c0c0 1px solid; BORDER-RIGHT: #c0c0c0 1px solid; text-align: left;"> <tbody> <tr> <td style="padding: 7px 6px 6px 8px; margin: 0px 0px 0px 0px; border: 0px none; line-height: 130%; VERTICAL-ALIGN: top; width: 100%;" id="" creatediv="true"><div id="TABLEDIV"><div id="TABLEDIV">Hi,</div><div id="TABLEDIV"><br></div><div id="TABLEDIV" style="line-height: normal;"><span style="line-height: 16px;">no, I haven't. I assume the ".dylib" extension on Mac is pure convention, isn't it? And this convention is not used for instance by ROOT libraries installed via macports (</span><span style="line-height: 16px; font-size: 10pt;">https://trac.macports.org/browser/trunk/dports/science/root/Portfile). This is not a problem for </span><span style="line-height: 16px;">cmake when used with make on OS X but it is when used with Xcode. No "not a valid library name" warning shows up when used with make and linking is successful. </span></div><div id="TABLEDIV" style="line-height: normal;"><br></div><div id="TABLEDIV" style="line-height: normal;"><span style="line-height: 16px;">To give a minimal example, I use a directory with the following content:</span></div><div id="TABLEDIV" style="line-height: normal;"><span style="line-height: 16px;"><br></span></div><div id="TABLEDIV" style="line-height: normal;"><span style="line-height: 16px;">- empty directory build</span></div><div id="TABLEDIV" style="line-height: normal;"><span style="line-height: 16px;"><br></span></div><div id="TABLEDIV" style="line-height: normal;"><span style="line-height: 16px;">- file CMakeLists.txt:</span></div><div id="TABLEDIV" style="line-height: normal;"><span style="line-height: 16px;"><br></span></div><div id="TABLEDIV" style="line-height: normal;"><p style="margin: 0px; font-size: 11px; font-family: Menlo;">CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)</p><p style="margin: 0px; font-size: 11px; font-family: Menlo;">PROJECT(test CXX)</p><p style="margin: 0px; font-size: 11px; font-family: Menlo;">add_executable( myexe helloworld.cpp)</p><p style="margin: 0px; font-size: 11px; font-family: Menlo;">target_link_libraries(my exe /fullpath/mylib.so)</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;">- file helloworld.cpp :</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(197, 156, 156);"><span style="color: rgb(239, 118, 238);">#include</span><span style="color: rgb(0, 0, 0);"> </span><iostream></p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="color: rgb(53, 163, 39);">int</span> <span style="color: rgb(94, 52, 255);">main</span>(){</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;"> <span style="color: rgb(113, 194, 193);">std</span>::cout<<<span style="color: rgb(197, 156, 156);">"Hello world"</span><<<span style="color: rgb(113, 194, 193);">std</span>::endl;</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;">}</p><p style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;">- file mylib.cpp:</p><p style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="color: rgb(53, 163, 39);">void</span> <span style="color: rgb(94, 52, 255);">foo</span>(){</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo;">}</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;">Than I create the library with:</p><p style="margin: 0px; font-size: 11px; font-family: Menlo;">clang++ -dynamiclib -o mylib.so mylib.cpp</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"></p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;">After that the following works fine without any warning:</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;">cd build</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;">cmake ..</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;">make</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;">But the following gives the warning:</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;">cd build</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;">cmake -G Xcode ..</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;">And the build in Xcode fails. :(</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;">Cheers,</p><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;">Bjoern</p></div></div></td><td style="width: 0%; padding: 0px 0px 0px 0px;"></td> </tr> </tbody></table><br> <br><blockquote style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"><table style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; FONT: 10pt Arial; COLOR: black; BORDER-TOP: #c0c0c0 1px solid; BORDER-RIGHT: 0px" id="tobit_repfor" border="0" cellspacing="0" cellpadding="0" width="99%" cols="3"><tbody><tr bordercolorlight="#ffffff" bordercolor="#ffffff" bgcolor="#ffffff"><td style="BORDER-BOTTOM: 0px; PADDING-BOTTOM: 1px; PADDING-LEFT: 4px; PADDING-TOP: 1px" height="22" colspan="2"><div style="FONT: bold 9pt Arial">Original Message processed by David.fx12 </div></td><td style="BORDER-BOTTOM: 0px" align="right"><div style="FONT: 8pt Arial"><div style="FONT: 8pt Arial"><strong><font color="#808080"></font></strong> </div></div></td></tr></tbody></table><table id="tobit_repfor2" style="BORDER-RIGHT: #e0e0e0 1px solid; BORDER-TOP: 0px; FONT: 8pt Tahoma; BORDER-LEFT: #e0e0e0 1px solid; COLOR: black; BORDER-BOTTOM: #e0e0e0 1px solid" cellspacing="0" cols="2" cellpadding="0" width="99%" border="0"><tbody><tr style="PADDING-BOTTOM: 2px"><td style="PADDING-LEFT: 6px; BORDER-BOTTOM: #ffffff 1px solid" width="68" bgcolor="#efefef" height="18"><div style="FONT: 8pt Tahoma">Subject: </div></td><td style="PADDING-LEFT: 4px; BORDER-BOTTOM: #efefef 1px solid" bgcolor="#ffffff"><div style="FONT: 8pt Tahoma">Re: [CMake] .so libraries and Xcode (03-Mar-2014 19:04)</div></td></tr><tr style="PADDING-BOTTOM: 2px"><td style="PADDING-LEFT: 6px; BORDER-BOTTOM: #ffffff 1px solid" width="68" bgcolor="#efefef" height="18"><div style="FONT: 8pt Tahoma">From: </div></td><td style="PADDING-LEFT: 4px; BORDER-BOTTOM: #efefef 1px solid" bgcolor="#ffffff"><div style="FONT: 8pt Tahoma"><a href="mailto:lucas.soltic@orange.fr">Lucas Soltic <lucas.soltic@orange.fr></a></div></td></tr><tr style="PADDING-BOTTOM: 0px"><td style="PADDING-LEFT: 6px" width="68" bgcolor="#efefef" height="17"><div style="FONT: 8pt Tahoma">To: </div></td><td style="PADDING-LEFT: 4px" bgcolor="#ffffff"><div style="FONT: 8pt Tahoma"><a href="mailto:bjoern@apoambach.de">bjoern@apoambach.de</a></div></td></tr></tbody></table><div> </div><div><style>
html, body, textarea{
scrollbar-face-color: #E8E8E8;
scrollbar-highlight-color: #BEBEBE;
scrollbar-3dlight-color: #FFFFFF;
scrollbar-darkshadow-color: #FFFFFF;
scrollbar-shadow-color: #BEBEBE;
scrollbar-arrow-color: #BEBEBE;
scrollbar-track-color: #F7F7F7;
}
</style>Le 3 mars 2014 à 18:25, Bjoern Sarrazin <<a href="mailto:bjoern@apoambach.de">bjoern@apoambach.de</a>> a écrit :<br><div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<div style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-family: 'Courier New';"><table style="z-index: auto; border: 1px solid rgb(192, 192, 192); position: static; background-color: rgb(255, 255, 255); margin-top: 17px; width: 500px; font-family: Tahoma, Arial; height: 66px; margin-left: 12px; font-size: 10pt; text-align: left;"> <tbody> <tr> <td style="padding: 7px 6px 6px 8px; margin: 0px; border: 0px none; vertical-align: top; width: 100%;" id="" creatediv="true"><div id="TABLEDIV" style="line-height: 130%;">Hi!</div><div id="TABLEDIV" style="line-height: 130%;"><br></div><div id="TABLEDIV" style="line-height: 130%;">I'm trying to link shared libraries with filename extension ".so" (like the ROOT libraries from <a href="http://root.cern.ch">root.cern.ch</a>). This works fine using Makefiles, also on Mac OS. Using option -G Xcode however it does not work:</div><div id="TABLEDIV" style="line-height: 130%;"><br></div><div id="TABLEDIV" style="line-height: 130%;">I use something like</div><div id="TABLEDIV" style="line-height: 130%;"><br></div><div id="TABLEDIV"><div style="line-height: normal; margin: 0px; font-size: 11px; font-family: Menlo;">target_link_libraries(myexe /full/path/to/somelib.so)</div><div style="line-height: normal; margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="line-height: normal; margin: 0px; font-size: 11px; font-family: Menlo;">Running cake with -G Xcode prints a warning:</div><div style="line-height: normal; margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="line-height: normal; margin: 0px; font-size: 11px; font-family: Menlo;"> "Target "myexe" links to item /full/path/to/somelib.so which is a full-path but not a valid library file name."</div><div style="line-height: normal; margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="line-height: normal; margin: 0px; font-size: 11px; font-family: Menlo;">When I run the build step in Xcode the linking step fails with</div><div style="line-height: normal; margin: 0px; font-size: 11px; font-family: Menlo;"> <span style="text-indent: -12px;">ld: library not found for -lsomelib.so.</span></div><div style="line-height: normal; margin: 0px; font-size: 11px; font-family: Menlo;"><span style="text-indent: -12px;"><br></span></div><div style="line-height: normal; margin: 0px; font-size: 11px; font-family: Menlo;"><span style="text-indent: -12px;">What's going wrong here? I have this problem whenever I try to link a shared library with .so filename extension and option -G Xcode.</span></div><div style="line-height: normal; margin: 0px; font-size: 11px; font-family: Menlo;"><span style="text-indent: -12px;"><br></span></div><div style="text-indent: -12px; margin: 0px;"><font face="Menlo"><span style="font-size: 11px;"> As a work around everything works fine when I use</span></font></div><div style="text-indent: -12px; margin: 0px;"><font face="Menlo"><span style="font-size: 11px;"><br></span></font></div></div><div id="TABLEDIV" style="line-height: 130%;"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">LINK_DIRECTORIES( /full/path/to )</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">and add -lsomelib to the link flags of my exe. But this is an annoying workaround because I'd like to use FIND_LIBRARY to search for the library and FIND_LIBRARY returns /full/path/to/somelib.so. </div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">Cheers,</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">Bjorn</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><br></div></div></td> <td style="width: 0%; padding: 0px 0px 0px 0px;"><br></td></tr></tbody></table></div></blockquote></div><div><br></div>Hi,<div><br><div>Mac OS X libraries have a ".dylib" extension, not ".so". Thus somelib.so is "not a valid library file name".</div></div><div>Maybe your workaround works because you have somelib.dylib in your link directory?</div><div><br></div><div>Lucas</div>
</div></blockquote><div style='FONT:10pt Courier New'></DIV><div style='FONT:10pt Courier New'></DIV></body></html>