Bug 210635

Summary: devel/libdlna: fix build in presence of itself
Product: Ports & Packages Reporter: Dmitry Marakasov <amdmi3>
Component: Individual Port(s)Assignee: Dmitry Marakasov <amdmi3>
Status: Closed FIXED    
Severity: Affects Many People CC: malus.x
Priority: --- Flags: bugzilla: maintainer-feedback? (malus.x)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch none

Description Dmitry Marakasov freebsd_committer freebsd_triage 2016-06-27 18:53:00 UTC
Created attachment 171880 [details]
Patch

libdlna does not always build in presence of older version of itself in the system:

#############################################
#         Linking shared objects            #
#############################################
cc -shared -Wl,-soname,libdlna.so.0 profiles.lo containers.lo image_jpeg.lo image_png.lo audio_aac.lo audio_ac3.lo audio_amr.lo audio_atrac3.lo audio_g726.lo audio_lpcm.lo audio_mp2.lo audio_mp3.lo audio_wma.lo av_mpeg1.lo av_mpeg2.lo av_mpeg4_part2.lo av_mpeg4_part10.lo av_wmv9.lo upnp_dms.lo \
  -L/usr/local/lib -fstack-protector -lavformat -lavcodec -o libdlna.so.0.2.3
ln -sf libdlna.so.0.2.3 libdlna.so.0
ln -sf libdlna.so.0 libdlna.so
gmake[2]: выход из каталога «/usr/ports/devel/libdlna/work/libdlna-0.2.3/src»
cc test-libdlna.c -O2 -pipe  -I/usr/local/include -fstack-protector -fno-strict-aliasing -W -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT -O2 -pipe  -I/usr/local/include -fstack-protector -fno-strict-aliasing -Isrc -L/usr/local/lib -fstack-protector -Lsrc -ldlna -lavformat -lavcodec -o test-libdlna
/usr/bin/ld: /usr/local/lib/libdlna.so: invalid string offset 2534 >= 1241 for section `.dynstr'
/usr/bin/ld: /usr/local/lib/libdlna.so: invalid string offset 2617 >= 1241 for section `.dynstr'
/usr/bin/ld: /usr/local/lib/libdlna.so: invalid string offset 1461 >= 1241 for section `.dynstr'
/usr/bin/ld: warning: libavformat.so.1, needed by /usr/local/lib/libdlna.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libavcodec.so.1, needed by /usr/local/lib/libdlna.so, not found (try using -rpath or -rpath-link)
/usr/local/lib/libdlna.so: undefined reference to `no symbol'
/usr/local/lib/libdlna.so: undefined reference to `av_open_input_file@LIBAVFORMAT_52'
/usr/local/lib/libdlna.so: undefined reference to `av_register_all@LIBAVFORMAT_52'
/usr/local/lib/libdlna.so: undefined reference to `av_find_stream_info@LIBAVFORMAT_52'
/usr/local/lib/libdlna.so: undefined reference to `av_close_input_file@LIBAVFORMAT_52'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[1]: *** [Makefile:36: test-libdlna] Ошибка 1
gmake[1]: выход из каталога «/usr/ports/devel/libdlna/work/libdlna-0.2.3»
*** Error code 1

Note "-L/usr/local/lib -fstack-protector -Lsrc -ldlna" - system library path get into the flags before local one, so test may not build. Fix this by placing local library search directory before LDFLAGS.

Also:
- Add license
- Strip library
- Switch to USES=localbase

post-patch target was merged into the Makefile patch to avoid confusion of having both REINPLACE_CMD and patch for the same file.
Comment 1 commit-hook freebsd_committer freebsd_triage 2016-07-12 19:44:51 UTC
A commit references this bug:

Author: amdmi3
Date: Tue Jul 12 19:44:45 UTC 2016
New revision: 418443
URL: https://svnweb.freebsd.org/changeset/ports/418443

Log:
  - Add LICENSE
  - Switch to USES=localbase
  - Cosmetic fixes
  - Strip library
  - Fix library paths order to fix build in presence of older version of itself

  PR:		210635
  Submitted by:	amdmi3
  Approved by:	maintainer timeout (malus.x@gmail.com, 2 weeks)

Changes:
  head/devel/libdlna/Makefile
  head/devel/libdlna/files/patch-Makefile