Linking error when compiling on Debian, G3 PPC

Support for HandBrake on Linux, Solaris, and other Unix-like platforms
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
smur
Posts: 5
Joined: Sun Apr 20, 2008 8:25 pm

Linking error when compiling on Debian, G3 PPC

Post by smur »

Hello -

I have run into a linker error while trying to compile HandBrakeCLI 0.9.1 on a G3 iBook ('Tangerine toilet seat') running Debian Etch PPC Linux.

I Googled all the relevant bits to no avail. I believe the issues is a missing or misplaced library, but I cannot tell which library, etc. 'man ld' did not help either - there is no '-lz' flag that I can identify. FYI, yes, ld is located in the /usr/bin directory.

Here is the error message I get (note, I ran jam the prior evening and everything compiled ok, the below quote is from subsequent 'jam' to get error message so there is no detailed compiler audit trail, but I can re-produce if necessary):

ME@NAME:/usr/local/src/HandBrake$ jam
...found 467 target(s)...
...updating 1 target(s)...

Link HandBrakeCLI
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status

g++ -o HandBrakeCLI test/test.o test/parsecsv.o libhb/libhb.a contrib/lib/liba52.a contrib/lib/libavformat.a contrib/lib/libavcodec.a contrib/lib/libavutil.a contrib/lib/libdca.a contrib/lib/libdvdread.a contrib/lib/libmp4v2.a contrib/lib/libfaac.a contrib/lib/libmp3lame.a contrib/lib/libmpeg2.a contrib/lib/libvorbis.a contrib/lib/libvorbisenc.a contrib/lib/libogg.a contrib/lib/libsamplerate.a contrib/lib/libx264.a contrib/lib/libxvidcore.a contrib/lib/libmkv.a contrib/lib/libswscale.a contrib/lib/libdvdcss.a -lz -lpthread

...failed Link HandBrakeCLI ...
...failed updating 1 target(s)...
ME@NAME:/usr/local/src/HandBrake$

This is, I believe, right at the end of the jam process.

Any help would be greatly appreciated. If I have posted to the wrong forum in error, my apologies - I searched the site, but did not find anything directly relevant to the issue or to these issues in general to guide where to post.

Thanks in advance -

SR
User avatar
s55
HandBrake Team
Posts: 10360
Joined: Sun Dec 24, 2006 1:05 pm

Re: Linking error when compiling on Debian, G3 PPC

Post by s55 »

Wrong forum. Moving to *Nix

Probably an version of ld that's too old or new.

You might have luck throwing /usr/bin/ld: cannot find -lz into google
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Re: Linking error when compiling on Debian, G3 PPC

Post by rhester »

zlib is a compression library. Install package zlib1g-dev.

Rodney
smur
Posts: 5
Joined: Sun Apr 20, 2008 8:25 pm

Re: Linking error when compiling on Debian, G3 PPC

Post by smur »

@Rodney

Many thanks, now it builds fine. I'll test the executable today. For my own sanity, would you mind telling me how you identified zlib1g-dev as the missing library? Obviously, I missed the clue in my own error message that you saw immediately.

Best,

SR
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Re: Linking error when compiling on Debian, G3 PPC

Post by rhester »

-lz means "link to library zlib" - you always append 'lib' to the text that follows the 'l'. Since you're compiling, you needed the dev package, so a quick trip to "apt-cache search zlib | grep dev" did the trick. =)

Rodney
smur
Posts: 5
Joined: Sun Apr 20, 2008 8:25 pm

Re: Linking error when compiling on Debian, G3 PPC

Post by smur »

@Rodney -

Thank you. As I am setting up the Debian box as a learning lab for Linux development, and your post and related explanation just saved me from some serious headaches down the road - I don't know how long it would have taken me to figure out the conventions you mentioned (e.g., 'always append lib to the letter after the -l...'). I appreciate it and will pass that on if the opportunity presents.

Best,

SR
Post Reply