The similar problem with static libraries on MacOSX is discussed here: old.nabble.com/Install-fails-for-gcc42--....
Up vote 3 down vote favorite 1 share g+ share fb share tw.
Greetings all, I have a static library which I later link with my application. My development environment is CMake, GCC (Linux, Mac), MinGW (Windows). I can compile the static library without any problem on Linux and Windows.
(I can even build shared libraries in my application on Mac). EDIT: I compiled the library as a SHARED library and it worked fine! I have configured CMakeFile as follows to build the static library: add_library(centi STATIC ${base_srcs} ${crv_srcs} ${node_srcs} ${trnk_srcs} ${defl_srcs} ${infl_srcs} ${track_srcs} ${callback_srcs} ${extract_srcs}) During linking phase, it gives following errors and build the "libcenti.
A" somehow. Linking C static library lib/libcenti. A /usr/bin/ranlib: file: lib/libcenti.
A(crv_in_rgn_to_bnry_img.c. O) has no symbols /usr/bin/ranlib: file: lib/libcenti. A(crv_initialize_by_circle.c.
O) has no symbols /usr/bin/ranlib: file: lib/libcenti. A(crv_initialize_flgs.c. O) has no symbols /usr/bin/ranlib: file: lib/libcenti.
A(crv_nodal_interval_min_and_max.c. O) has no symbols /usr/bin/ranlib: file: lib/libcenti. A(crv_remove_all_nodes.c.
O) has no symbols /usr/bin/ranlib: file: lib/libcenti. A(crv_reset_nodal_forces.c. O) has no symbols /usr/bin/ranlib: file: lib/libcenti.
A(crv_set_center_coords.c. O) has no symbols /usr/bin/ranlib: file: lib/libcenti. A(crv_set_left_ptch_rgn_pixs.c.
O) has no symbols /usr/bin/ranlib: file: lib/libcenti. A(crv_set_out_rgn_mean_and_var.c. O) has no symbols /usr/bin/ranlib: file: lib/libcenti.
A(crv_set_para.c. O) has no symbols /usr/bin/ranlib: file: lib/libcenti. A(crv_set_right_ptch_rgn_pixs.c.
O) has no symbols /usr/bin/ranlib: file: lib/libcenti. A(crv_to_in_rgn_hist.c. O) has no symbols /usr/bin/ranlib: file: lib/libcenti.
A(crv_to_out_rgn_pixs.c. O) has no symbols /usr/bin/ranlib: file: lib/libcenti. A(trnk_initialize_by_circle.c.
O) has no symbols /usr/bin/ranlib: file: lib/libcenti. A(trnk_initialize_by_image_frame.c. O) has no symbols /usr/bin/ranlib: file: lib/libcenti.
A(trnk_stk_paint_nodes_and_pixs.c. O) has no symbols /usr/bin/ranlib: file: lib/libcenti. A(trnk_stk_to_inner_defl_ordn.c.
O) has no symbols But when I link above library with my application, it gives "Undefined symbols" errors: Undefined symbols: "_setActiveDrawingTrunk", referenced from: RzPluginAlgoCnty::initCallBacks() in RzPluginAlgoCnty.cpp. O RzPluginAlgoCnty::clearCallBacks() in RzPluginAlgoCnty.cpp. O _trnk_trck_ordn in libcenti.
A(trnk_trck_ordn.c. O) _trnk_trck_ordn in libcenti. A(trnk_trck_ordn.c.
O) _trnk_trck_ordn in libcenti. A(trnk_trck_ordn.c. O) _trnk_trck_ordn in libcenti.
A(trnk_trck_ordn.c. O) _bg_trnk_trck_ordn in libcenti. A(trnk_trck_ordn.c.
O) _bg_trnk_trck_ordn in libcenti. A(trnk_trck_ordn.c. O) _extract_contour_update_tracking in libcenti.
A(extract_contour_update_tracking.c. O) _extract_contour_update_tracking in libcenti. A(extract_contour_update_tracking.c.
O) "_updateCurveUICallBack", referenced from: RzPluginAlgoCnty::initCallBacks() in RzPluginAlgoCnty.cpp. O RzPluginAlgoCnty::initBulkCallBacks() in RzPluginAlgoCnty.cpp. O RzPluginAlgoCnty::clearCallBacks() in RzPluginAlgoCnty.cpp.
O _bg_trnk_trck_ordn in libcenti. A(trnk_trck_ordn.c. O) _bg_trnk_trck_ordn in libcenti.
A(trnk_trck_ordn.c. O) _crv_update_1time in libcenti. A(crv_update_ordn.c.
O) _crv_update_1time in libcenti. A(crv_update_ordn.c. O) ld: symbol(s) not found Any tips?
Should I add any special parameters when building static libraries on Mac? EDIT: I compiled the library as a SHARED library and it worked fine! C++ osx gcc cmake static-libraries link|improve this question edited Feb 10 '11 at 6:28 asked Feb 8 '11 at 3:23Ashika Umanga Umagiliya88711036 90% accept rate.
The similar problem with static libraries on MacOSX is discussed here: old.nabble.com/Install-fails-for-gcc42--... and here lists.macosforge.org/pipermail/macports-... Try to do a full clean and run a not-parallel build. And this guide recommends to install macports, then "sudo port install autogen autoconf automake nano libtool libsdl patchutils subversion wget gmake", and then export PATH="/usr/local/bin:/usr/local/sbin:$PATH.
1 the can be problems as Mac ar is non-standard. – osgx Feb 17 '11 at 1:01 @umanga, did you solve your problem? How?
– osgx Feb 21 '11 at 7:13.
The warnings from ranlib indicate that those object files contained no operational code. You need to review each corresponding source file to see whether the code it contains should be compiled on Mac. It may be that the code was ported elsewhere but the conditional compilation doesn't recognize Mac correctly.
It isn't a 'slam dunk' diagnosis; the missing symbols are clearly in two groups - those related to trnk and those related to crv - and the files are likewise in two groups (prefixed trnk and crv), but it could be that the files define different functions. So, I would go looking at the source files corresponding to the empty object files and see if you can see the missing functions (probably ignore the leading underscore on the reported missing symbol names). If those functions are defined in those files, then you have to look at the complaints from ranlib.
Occasionally, if you ran out of disk space at an inconvenient moment, you could have zero-size object files (which contain no symbols, therefore). In that case, simply remove the empty object files (and free up some space, but you must already have done that) and build again.
Thanks you for the answer. – Ashika Umanga Umagiliya Feb 21 '11 at 6:45.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.