Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ranlib produces "has no symbols" msg

3,498 views
Skip to first unread message

Art Werschulz

unread,
Jan 20, 2010, 9:15:15 PM1/20/10
to
Hi.

Running Mac OS X 10.6.2 (Snow Leopard) ...

When running ranlib, I sometimes get error msgs saying that a particular
library entry has no symbols. This most recently happened with the FLTK
libraries, e.g.:
$ ranlib libfltk.a
ranlib: file: libfltk.a(Fl_x.o) has no symbols
ranlib: file: libfltk.a(fl_overlay_visual.o) has no symbols
ranlib: file: libfltk.a(fl_call_main.o) has no symbols
ranlib: file: libfltk.a(scandir.o) has no symbols
ranlib: file: libfltk.a(keysym2Ucs.o) has no symbols
ranlib: file: libfltk.a(utf8Input.o) has no symbols
ranlib: file: libfltk.a(utf8Utils.o) has no symbols
ranlib: file: libfltk.a(utf8Wrap.o) has no symbols

I did not have this problem with Mac OS X 10.5 (Leopard).

Has anybody run into this problem? If so, what's the fix?

Many thanks.

--
Art Werschulz (agw STRUDEL comcast.net)
... insert clever quote here ...

Chris McDonald

unread,
Jan 20, 2010, 9:35:31 PM1/20/10
to
Art Werschulz <a...@comcast.net> writes:

>Running Mac OS X 10.6.2 (Snow Leopard) ...

>When running ranlib, I sometimes get error msgs saying that a particular
>library entry has no symbols. This most recently happened with the FLTK
>libraries, e.g.:

Was the library stripped as part of it being built (cf man strip)?

--
Chris.

Art Werschulz

unread,
Jan 22, 2010, 3:04:06 PM1/22/10
to
Hi.

Chris McDonald <ch...@csse.uwa.edu.au> writes:

Not as far as I can tell.

I'm also getting the following msgs when trying to use these libraries:

ld: warning: in ../GUI/libbookgui.a, file is not of required architecture
ld: warning: in /usr/local/lib/libjpeg.dylib, file is not of required architecture

Again, this problem did not occur with Mac OS 10.5.

Suggestions? Thanks.

GreyCloud

unread,
Jan 22, 2010, 11:52:23 PM1/22/10
to
Hmmm... do a file /usr/local/lib/libjpeg.dylib and see how many archs it
was made for. Same for ../GUI/libbookgui.a
At least it is a start.

Art Werschulz

unread,
Jan 23, 2010, 7:34:59 PM1/23/10
to
Hi.

GreyCloud <mi...@cumulus.com> writes:

>>>> Running Mac OS X 10.6.2 (Snow Leopard) ...
>>>> When running ranlib, I sometimes get error msgs saying that a particular
>>>> library entry has no symbols. This most recently happened with the FLTK
>>>> libraries, e.g.:
>>> Was the library stripped as part of it being built (cf man strip)?
>>
>> Not as far as I can tell.
>>
>> I'm also getting the following msgs when trying to use these libraries:
>>
>> ld: warning: in ../GUI/libbookgui.a, file is not of required architecture
>> ld: warning: in /usr/local/lib/libjpeg.dylib, file is not of required architecture
>>
>> Again, this problem did not occur with Mac OS 10.5.
>>
>> Suggestions? Thanks.
>>
> Hmmm... do a file /usr/local/lib/libjpeg.dylib and see how many archs
> it was made for. Same for ../GUI/libbookgui.a
> At least it is a start.

agw@home:~$ file /usr/local/lib/libjpeg.dylib
/usr/local/lib/libjpeg.dylib: Mach-O 64-bit dynamically linked shared library x86_64
agw@home:~$ file /usr/local/lib/libbookgui.a
/usr/local/lib/libbookgui.a: current ar archive random library

GreyCloud

unread,
Jan 23, 2010, 9:58:18 PM1/23/10
to

Well, the first file only has one arch and the latest snowleopard files
have x86_64 and i386 archs in the dylibs. This is done for those that
are using Xcode and want to deliver a multiple arch package.
Strange that there weren't the usual three others of the G4, G5 and one
older one.

The libbookgui.a is a static library. The fact that the linker checked
the file associated with the current arch and what the library was
compiled to shows that they don't match.
Also, my system doesn't show these libs. What was the source of these
libs? It may help a lot in determing what is going on.

Art Werschulz

unread,
Jan 23, 2010, 10:42:57 PM1/23/10
to
Hi.

GreyCloud <mi...@cumulus.com> writes:

>> agw@home:~$ file /usr/local/lib/libjpeg.dylib
>> /usr/local/lib/libjpeg.dylib: Mach-O 64-bit dynamically linked
>> shared library x86_64
>> agw@home:~$ file /usr/local/lib/libbookgui.a
>> /usr/local/lib/libbookgui.a: current ar archive random library
>>
>
> Well, the first file only has one arch and the latest snowleopard
> files have x86_64 and i386 archs in the dylibs. This is done for
> those that are using Xcode and want to deliver a multiple arch
> package.
> Strange that there weren't the usual three others of the G4, G5 and
> one older one.

This may be leftover from Leopard.

> The libbookgui.a is a static library. The fact that the linker
> checked the file associated with the current arch and what the library
> was compiled to shows that they don't match.

It was compiled from source, as follows:
g++ -I -Wall -time -O3 -DNDEBUG -c -o GUI.o GUI.cc
g++ -I -Wall -time -O3 -DNDEBUG -c -o Graph.o Graph.cc
g++ -I -Wall -time -O3 -DNDEBUG -c -o Simple_window.o Simple_window.cc
g++ -I -Wall -time -O3 -DNDEBUG -c -o Window.o Window.cc
ar rcs libbookgui.a GUI.o Graph.o Simple_window.o Window.o
The source is Bjarne Stroustrup's simple GUI, associated with his new
textbook.

> Also, my system doesn't show these libs. What was the source of these
> libs? It may help a lot in determing what is going on.

Note that when I ran
ranlib /usr/local/lib/lib*.a | grep "no symbols"
gave the following results:
ranlib: file: /usr/local/lib/libfltk.a(Fl_x.o) has no symbols
ranlib: file: /usr/local/lib/libfltk.a(fl_overlay_visual.o) has no symbols
ranlib: file: /usr/local/lib/libfltk.a(fl_call_main.o) has no symbols
ranlib: file: /usr/local/lib/libfltk.a(scandir.o) has no symbols
ranlib: file: /usr/local/lib/libfltk.a(keysym2Ucs.o) has no symbols
ranlib: file: /usr/local/lib/libfltk.a(utf8Input.o) has no symbols
ranlib: file: /usr/local/lib/libfltk.a(utf8Utils.o) has no symbols
ranlib: file: /usr/local/lib/libfltk.a(utf8Wrap.o) has no symbols
FLTK was compiled from source, built via the usual
make configure
make
make install

GreyCloud

unread,
Jan 25, 2010, 1:25:00 AM1/25/10
to

Hey, thnx for the heads up. What's the books title?

>> Also, my system doesn't show these libs. What was the source of these
>> libs? It may help a lot in determing what is going on.
>
> Note that when I ran
> ranlib /usr/local/lib/lib*.a | grep "no symbols"
> gave the following results:
> ranlib: file: /usr/local/lib/libfltk.a(Fl_x.o) has no symbols
> ranlib: file: /usr/local/lib/libfltk.a(fl_overlay_visual.o) has no symbols
> ranlib: file: /usr/local/lib/libfltk.a(fl_call_main.o) has no symbols
> ranlib: file: /usr/local/lib/libfltk.a(scandir.o) has no symbols
> ranlib: file: /usr/local/lib/libfltk.a(keysym2Ucs.o) has no symbols
> ranlib: file: /usr/local/lib/libfltk.a(utf8Input.o) has no symbols
> ranlib: file: /usr/local/lib/libfltk.a(utf8Utils.o) has no symbols
> ranlib: file: /usr/local/lib/libfltk.a(utf8Wrap.o) has no symbols
> FLTK was compiled from source, built via the usual
> make configure
> make
> make install
>

Instead of using ranlib, use nm to list symbols in a library. Do a man nm.
Also use libtool as it is supposed to replace ranlib and ar... at least
that is what it says when doing man ranlib.
Then if no symbols are there, then the file was stripped.
You may have to look into that configure file to look for any commands
that will strip this library.

Art Werschulz

unread,
Jan 25, 2010, 8:41:36 PM1/25/10
to
Hi.

GreyCloud <mi...@cumulus.com> writes:

>> The source is Bjarne Stroustrup's simple GUI, associated with his new
>> textbook.
>
> Hey, thnx for the heads up. What's the books title?
>

Programming: Principles and Practice Using C++
The book's website is
http://www.stroustrup.com/Programming

GreyCloud

unread,
Jan 26, 2010, 5:05:22 PM1/26/10
to
Art Werschulz wrote:
> Hi.
>
> GreyCloud <mi...@cumulus.com> writes:
>
>>> The source is Bjarne Stroustrup's simple GUI, associated with his new
>>> textbook.
>> Hey, thnx for the heads up. What's the books title?
>>
>
> Programming: Principles and Practice Using C++
> The book's website is
> http://www.stroustrup.com/Programming
>

I checked it out and it looks like an excellent book.
Hopefully, they also supplied the library code.

Art Werschulz

unread,
Jan 27, 2010, 7:36:09 PM1/27/10
to
Hi.

GreyCloud <mi...@cumulus.com> writes:

>> Programming: Principles and Practice Using C++
>> The book's website is http://www.stroustrup.com/Programming
>
> I checked it out and it looks like an excellent book.
> Hopefully, they also supplied the library code.

The library code is on the website, along with all the other code
examples from the text.

GreyCloud

unread,
Jan 28, 2010, 1:59:01 PM1/28/10
to
Art Werschulz wrote:
> Hi.
>
> GreyCloud <mi...@cumulus.com> writes:
>
>>> Programming: Principles and Practice Using C++
>>> The book's website is http://www.stroustrup.com/Programming
>> I checked it out and it looks like an excellent book.
>> Hopefully, they also supplied the library code.
>
> The library code is on the website, along with all the other code
> examples from the text.
>
I know. I now have the code and I'm looking thru it.
There are enough #ifndef or #ifdef on which platform you are building
for. I've went thru a similar problem with a more formal text book
written by Holub and found it to be a problem when one library is left
out and you have to purchase the extra disk, which is why I made the
last comment about supplying the library code.
Hopefully, the static declarations on these functions are correct, as it
caused me great problems in building code in the past. It shouldn't,
but it does. Statics are file scope only for functions.

Were I of any help to you?

Art Werschulz

unread,
Feb 2, 2010, 6:59:13 PM2/2/10
to
Hi.

It turns out the fix was to downgrade to FLTK 1.1.10. Everything was
fine after that.

GreyCloud

unread,
Feb 3, 2010, 12:10:56 AM2/3/10
to
Art Werschulz wrote:
> Hi.
>
> It turns out the fix was to downgrade to FLTK 1.1.10. Everything was
> fine after that.

That is rather strange.
It could be that there were various versions of FLTK for different
platforms and I'm presuming that that one would've worked under a MS
windows.

adam.m...@gmail.com

unread,
Oct 3, 2016, 12:19:51 AM10/3/16
to
This error still happens on OS X 10 El Capitan. The result is that even a small test program fails the linking phase with FLTK.

/Applications/CLion.app/Contents/bin/cmake/bin/cmake --build /Users/adam/Library/Caches/CLion2016.2/cmake/generated/fltk_test-f06748b0/f06748b0/Debug --target all -- -j 8
Scanning dependencies of target fltk_test
[ 50%] Building CXX object CMakeFiles/fltk_test.dir/main.cpp.o
[100%] Linking CXX executable fltk_test
Undefined symbols for architecture x86_64:
"fl_define_FL_SHADOW_LABEL()", referenced from:
_main in main.cpp.o
"Fl::run()", referenced from:
_main in main.cpp.o
"Fl_Box::Fl_Box(int, int, int, int, char const*)", referenced from:
_main in main.cpp.o
"Fl_Group::end()", referenced from:
_main in main.cpp.o
"Fl_Window::show(int, char**)", referenced from:
_main in main.cpp.o
"Fl_Window::Fl_Window(int, int, char const*)", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [fltk_test] Error 1
make[1]: *** [CMakeFiles/fltk_test.dir/all] Error 2
make: *** [all] Error 2


/usr/bin/ar cr ../lib/libfltk.a ...
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(Fl_x.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(fl_dnd.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(fl_overlay_visual.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(fl_call_main.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(scandir.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(keysym2Ucs.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(utf8Input.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(utf8Utils.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(utf8Wrap.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(Fl_x.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(fl_dnd.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(fl_overlay_visual.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(fl_call_main.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(scandir.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(keysym2Ucs.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(utf8Input.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(utf8Utils.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libfltk.a(utf8Wrap.o) has no symbols
0 new messages