Bug 235233 - net/asterisk15 links with installed libasteriskssl.so
Summary: net/asterisk15 links with installed libasteriskssl.so
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Guido Falsi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-27 09:34 UTC by Alexander Pravkin
Modified: 2019-01-28 19:01 UTC (History)
0 users

See Also:
madpilot: maintainer-feedback+


Attachments
tantive fix (1.02 KB, patch)
2019-01-27 10:48 UTC, Guido Falsi
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pravkin 2019-01-27 09:34:52 UTC
Having an asterisk13 installed, build of net/asterisk15 tries to link "asterisk" binary with /usr/local/lib/libasteriskssl.so instead of just builded .../work/asterisk-15.7.1/main/libasteriskssl.so, and fails (because api is slightly changed).

Tail of output from `make build`:
cc  -o libasteriskssl.so.1 -pthread -Wl,-rpath,/usr/local/lib -fstack-protector   -L/usr/local/lib -Wl,-rpath,/usr/local/lib -Wl,-soname=libasteriskssl.so.1 -shared -Wl,--version-script,libasteriskssl.exports,--warn-common  -Wl,-rpath,/usr/local/lib -fstack-protector  libasteriskssl.o  -L/usr/local/lib -L/usr/local/lib -lssl -lcrypto
/bin/ln -sf libasteriskssl.so.1 libasteriskssl.so ;\

c++  -o asterisk -Wl,--export-dynamic -Wl,--version-script,asterisk.exports -Wl,--dynamic-list,asterisk.dynamics -Wl,-rpath,/usr/local/lib -fstack-protector   -L/usr/local/lib -Wl,-rpath,/usr/local/lib  -Wl,-rpath,/usr/local/lib -fstack-protector  abstract_jb.o acl.o adsi.o alaw.o alertpipe.o aoc.o app.o ast_expr2.o ast_expr2f.o asterisk.o astfd.o astmm.o astobj2.o astobj2_container.o astobj2_hash.o astobj2_rbtree.o audiohook.o autochan.o autoservice.o backtrace.o bridge.o bridge_after.o bridge_basic.o bridge_channel.o bridge_roles.o bucket.o callerid.o ccss.o cdr.o cel.o channel.o channel_internal_api.o chanvars.o cli.o codec.o codec_builtin.o config.o config_options.o conversions.o core_local.o core_unreal.o crypt.o data_buffer.o datastore.o db.o devicestate.o dial.o dns.o dns_core.o dns_naptr.o dns_query_set.o dns_recurring.o dns_srv.o dns_system_resolver.o dns_test.o dns_tlsa.o dnsmgr.o dsp.o endpoints.o enum.o event.o features.o features_config.o file.o fixedjitterbuf.o format.o format_cache.o format_cap.o format_compatibility.o frame.o framehook.o fskmodem.o global_datastores.o hashtab.o heap.o http.o image.o indications.o io.o iostream.o jitterbuf.o json.o libasteriskpj.o loader.o lock.o logger.o manager.o manager_bridges.o manager_channels.o manager_endpoints.o manager_mwi.o manager_system.o max_forwards.o md5.o media_cache.o media_index.o message.o mixmonitor.o named_acl.o named_locks.o netsock.o netsock2.o optional_api.o options.o parking.o pbx.o pbx_app.o pbx_builtins.o pbx_functions.o pbx_hangup_handler.o pbx_ignorepat.o pbx_include.o pbx_sw.o pbx_switch.o pbx_timing.o pbx_variables.o pickup.o plc.o poll.o presencestate.o privacy.o rtp_engine.o say.o sched.o sdp_srtp.o security_events.o sem.o sha1.o sip_api.o slinfactory.o smoother.o sorcery.o sounds.o srv.o stasis.o stasis_bridges.o stasis_cache.o stasis_cache_pattern.o stasis_channels.o stasis_endpoints.o stasis_message.o stasis_message_router.o stasis_system.o stdtime/localtime.o strcompat.o stream.o stringfields.o strings.o stun.o syslog.o taskprocessor.o tcptls.o tdd.o term.o test.o threadpool.o threadstorage.o timing.o translate.o udptl.o ulaw.o uri.o utils.o uuid.o version.o xml.o xmldoc.o -L. -lasteriskssl   buildinfo.o  -L/usr/local/lib -lxml2 -lz -llzma -L/usr/lib -lm  -lsqlite3  -L/usr/local/lib -lssl -lcrypto -L/usr/local/lib -ljansson   -luuid   -lBlocksRuntime -lrt    -lm -pthread -lcrypto  -L/usr/local/lib -ledit -lncurses
ast_expr2.o: In function `ast_yyparse':
ast_expr2.c:(.text+0x3afb): warning: powl has lower than advertised precision
/usr/local/lib/libasteriskssl.so: undefined reference to `ast_register_file_version'
/usr/local/lib/libasteriskssl.so: undefined reference to `ast_unregister_file_version'
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [Makefile:320: asterisk] Error 1
gmake[3]: Leaving directory '/usr/ports.local/usr/ports/net/asterisk15/work/asterisk-15.7.1/main'
gmake[2]: *** [Makefile:386: main] Error 2
gmake[2]: Leaving directory '/usr/ports.local/usr/ports/net/asterisk15/work/asterisk-15.7.1'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/net/asterisk15
*** Error code 1

Stop.
make: stopped in /usr/ports/net/asterisk15


The workaround is to delete installed version, then build and install new, but it's not obvious.

Looks like `-L/usr/local/lib` appears too early in the link command, so /usr/local/... takes higher priority. And it's no matter which version of asterisk is installed, it will link with installed .so if found, so this will affect an upgrade within the same major version. And even "successful" upgrade can break things.

Likely asterisk13 have the same problem too, but build does not fail just because libasteriskssl api is the same.
Comment 1 Guido Falsi freebsd_committer freebsd_triage 2019-01-27 09:48:34 UTC
This needs investigation. I'll try to find a fix.

Anyway as a general suggestion, if you care for correctness in the software you run you should really build it in isolation using a tool like poudriere.
Comment 2 Guido Falsi freebsd_committer freebsd_triage 2019-01-27 10:48:47 UTC
Created attachment 201435 [details]
tantive fix

I created a small patch. It contains also some cosmetic fixes, but the relevant line is the LDFLAGS one.

Could you please test this and confirm it fixes the issue on your system?

Thanks.
Comment 3 Alexander Pravkin 2019-01-28 14:56:58 UTC
Yes, builds fine (asterisk15-15.7.1). Resulting link command:

c++  -o asterisk -Wl,--export-dynamic -Wl,--version-script,asterisk.exports -Wl,--dynamic-list,asterisk.dynamics -L. -Wl,-rpath,/usr/local/lib -fstack-protector   -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L. -Wl,-rpath,/usr/local/lib -fstack-protector  abstract_jb.o acl.o adsi.o alaw.o alertpipe.o aoc.o app.o ast_expr2.o ast_expr2f.o asterisk.o astfd.o astmm.o astobj2.o astobj2_container.o astobj2_hash.o astobj2_rbtree.o audiohook.o autochan.o autoservice.o backtrace.o bridge.o bridge_after.o bridge_basic.o bridge_channel.o bridge_roles.o bucket.o callerid.o ccss.o cdr.o cel.o channel.o channel_internal_api.o chanvars.o cli.o codec.o codec_builtin.o config.o config_options.o conversions.o core_local.o core_unreal.o crypt.o data_buffer.o datastore.o db.o devicestate.o dial.o dns.o dns_core.o dns_naptr.o dns_query_set.o dns_recurring.o dns_srv.o dns_system_resolver.o dns_test.o dns_tlsa.o dnsmgr.o dsp.o endpoints.o enum.o event.o features.o features_config.o file.o fixedjitterbuf.o format.o format_cache.o format_cap.o format_compatibility.o frame.o framehook.o fskmodem.o global_datastores.o hashtab.o heap.o http.o image.o indications.o io.o iostream.o jitterbuf.o json.o libasteriskpj.o loader.o lock.o logger.o manager.o manager_bridges.o manager_channels.o manager_endpoints.o manager_mwi.o manager_system.o max_forwards.o md5.o media_cache.o media_index.o message.o mixmonitor.o named_acl.o named_locks.o netsock.o netsock2.o optional_api.o options.o parking.o pbx.o pbx_app.o pbx_builtins.o pbx_functions.o pbx_hangup_handler.o pbx_ignorepat.o pbx_include.o pbx_sw.o pbx_switch.o pbx_timing.o pbx_variables.o pickup.o plc.o poll.o presencestate.o privacy.o rtp_engine.o say.o sched.o sdp_srtp.o security_events.o sem.o sha1.o sip_api.o slinfactory.o smoother.o sorcery.o sounds.o srv.o stasis.o stasis_bridges.o stasis_cache.o stasis_cache_pattern.o stasis_channels.o stasis_endpoints.o stasis_message.o stasis_message_router.o stasis_system.o stdtime/localtime.o strcompat.o stream.o stringfields.o strings.o stun.o syslog.o taskprocessor.o tcptls.o tdd.o term.o test.o threadpool.o threadstorage.o timing.o translate.o udptl.o ulaw.o uri.o utils.o uuid.o version.o xml.o xmldoc.o -L. -lasteriskssl   buildinfo.o  -L/usr/local/lib -lxml2 -lz -llzma -L/usr/lib -lm  -lsqlite3  -L/usr/local/lib -lssl -lcrypto -L/usr/local/lib -ljansson   -luuid   -lBlocksRuntime -lrt    -lm -pthread -lcrypto  -L/usr/local/lib -ledit -lncurses

-L. appears twice (like some -W too), but no matter.

With similar patch, asterisk13 builds successfully too.
Comment 4 commit-hook freebsd_committer freebsd_triage 2019-01-28 19:00:53 UTC
A commit references this bug:

Author: madpilot
Date: Mon Jan 28 19:00:16 UTC 2019
New revision: 491510
URL: https://svnweb.freebsd.org/changeset/ports/491510

Log:
  - Force asterisk ports to prefer newly compiled libasteriskssl.so
    to already installed one when compiling the port on live system
    where asterisk is already present.
  - While here Make some minor cosmetic changes.

  PR:		235233
  Submitted by:	pfduch@yandex.ru

Changes:
  head/net/asterisk13/Makefile
  head/net/asterisk15/Makefile
  head/net/asterisk16/Makefile
Comment 5 Guido Falsi freebsd_committer freebsd_triage 2019-01-28 19:01:59 UTC
Fix committed.

Thanks for reporting.