On 2009-06-06 08:07:01 -0500, Bill Hoffman <bill.hoff...@kitware.com> said:

Bob Tanner wrote:
On 2009-06-05 17:37:11 -0500, Bob Tanner <tan...@real-time.com> said:

First question, how to I add "-c" to ranlib evocation?

Sorry for the follow-up to my post, but here is the work-around I used.

IF (UNIX)
MESSAGE (STATUS "Unix")
IF (APPLE)
SET(CMAKE_C_CREATE_STATIC_LIBRARY
"<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
"<CMAKE_RANLIB> -c <TARGET> "
)
ENDIF (APPLE)
ENDIF (UNIX)
I am confused about why you have to do this.  What is an internal
library?   We create and use static libraries all the time on Mac OSX
and never have this problem???

Internal library meaning static library used only internally to the netrek server code base.

If I do not 'ranlib -c' on my libnetrek.a I get non_lazy_ptr link errors for every executable that links to my libnetrek.a.

http://software.intel.com/en-us/articles/intelr-fortran-compiler-for-mac-os-non_lazy_ptr-unresolved-references-from-linking/

Explains
why this is happening and make references on how to fix the issue.

But changing ranlib to "ranlib -c" this resolved all my linking problems.

OSX 10.5.7?
gcc-4.2?
Xcode-3.1.2

I'm running cmake out of darwin ports. My port list is below.

 bzip2 @1.0.5_2 (active)
 cabextract @1.2_0 (active)
 cmake @2.6.4_0 (active)
 gdbm @1.8.3_1 (active)
 gmp @4.3.1_0 (active)
 ipcalc @0.38_0 (active)
 libnet11 @1.1.2.1_1 (active)
 libpcap @1.0.0_0 (active)
 lzo2 @2.03_0+darwin_9 (active)
 mtr @0.75_0 (active)
 ncurses @5.7_0 (active)
 ncursesw @5.7_0 (active)
 netcat @1.10_2 (active)
 nmap @4.76_0 (active)
 openssl @0.9.8k_0 (active)
 openvpn2 @2.0.9_1 (active)
 p7zip @4.65_0 (active)
 pcre @7.9_0 (active)
 pkgconfig @0.23_1 (active)
 readline @6.0.000_1 (active)
 tcptraceroute @1.5beta7_1 (active)
 zlib @1.2.3_2 (active)

As a side note, another open source project, crossfire, experiences the same problem when I attempt to link to a static library when not 'ranlib -c''d.

--
Bob Tanner <tan...@real-time.com>                  | Phone : (952 943-8700
http://www.real-time.com, Linux, OSX, VMware | Fax   : (952)943-8500
Key fingerprint = F785 DDFC CF94 7CE8 AA87 3A9D 3895 26F1 0DDB E378


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to