On Jul 11 10:57:21, Marc Espie wrote:
> Lots of fun last night and this morning.
>
> 1/ Turns out GNU libtool simply *removes* stuff it doesn't understand while
> linking.
>
> Case in point: libdns/ldns. It does link with
> libtool link  cc -o somelib  --export-symbols lib.def someobj.o
>
> notice the --export-symbols, that's not a valid gnu libtool option (the
> option is spelled -export-symbols).
> So it gets ignored !
>
> this did work by accident for us, since we used Getopt::Long which
> doesn't care if it's --export-symbols or -export-symbols...
>
> when I fixed that, suddenly, we got some different behavior, so
> our link stopped working.
>
> But I'll contend that's a fucking BUG in gnu libtool, since you can
> just mispell something, and hey, watch it ! magic trick! it's gone !!!
>
> (that also explains why some ports require gnu libtool...

Marc, could you please confirm that
this is why audio/opencore-amr builds
with USE_LIBTOOL=gnu but not otherwise?

With USE_LIBTOOL=yes, the linking fails with

libtool: link: cc -shared -fPIC -DPIC -o .libs/libopencore-amrnb.so.0.0
-I/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.3/oscl
-I/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.3/opencore/codecs_v2/au
dio/gsm_amr/amr_nb/dec/src
-I/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.3/opencore/codecs_v2/au
dio/gsm_amr/amr_nb/common/include
-I/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.3/opencore/codecs_v2/au
dio/gsm_amr/amr_nb/dec/include
-I/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.3/opencore/codecs_v2/au
dio/gsm_amr/common/dec/include
-I/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.3/opencore/codecs_v2/au
dio/gsm_amr/amr_nb/enc/src -x c -std=c99 -O2 -pipe .libs/wrapper.o .libs/agc.o
.libs/amrdecode.o .libs/a_refl.o .libs/b_cn_cod.o .libs/bgnscd.o
.libs/c_g_aver.o .libs/d1035pf.o .libs/d2_11pf.o .libs/d2_9pf.o
.libs/d3_14pf.o .libs/d4_17pf.o .libs/d8_31pf.o .libs/dec_amr.o
.libs/dec_gain.o .libs/dec_input_format_tab.o .libs/dec_lag3.o
.libs/dec_lag6.o .libs/d_gain_c.o .libs/d_gain_p.o .libs/d_plsf_3.o
.libs/d_plsf_5.o .libs/d_plsf.o .libs/dtx_dec.o .libs/ec_gains.o
.libs/ex_ctrl.o .libs/if2_to_ets.o .libs/int_lsf.o .libs/lsp_avg.o
.libs/ph_disp.o .libs/post_pro.o .libs/preemph.o .libs/pstfilt.o
.libs/qgain475_tab.o .libs/sp_dec.o .libs/wmf_to_ets.o .libs/amrencode.o
.libs/autocorr.o .libs/c1035pf.o .libs/c2_11pf.o .libs/c2_9pf.o
.libs/c3_14pf.o .libs/c4_17pf.o .libs/c8_31pf.o .libs/calc_cor.o
.libs/calc_en.o .libs/cbsearch.o .libs/cl_ltp.o .libs/cod_amr.o
.libs/convolve.o .libs/cor_h.o .libs/cor_h_x2.o .libs/cor_h_x.o
.libs/corrwght_tab.o .libs/div_32.o .libs/dtx_enc.o .libs/enc_lag3.o
.libs/enc_lag6.o .libs/enc_output_format_tab.o .libs/ets_to_if2.o
.libs/ets_to_wmf.o .libs/g_adapt.o .libs/gain_q.o .libs/g_code.o
.libs/g_pitch.o .libs/hp_max.o .libs/inter_36.o .libs/inter_36_tab.o
.libs/l_abs.o .libs/lag_wind.o .libs/lag_wind_tab.o .libs/l_comp.o
.libs/levinson.o .libs/l_extract.o .libs/lflg_upd.o .libs/l_negate.o
.libs/lpc.o .libs/ol_ltp.o .libs/pitch_fr.o .libs/pitch_ol.o .libs/p_ol_wgh.o
.libs/pre_big.o .libs/pre_proc.o .libs/prm2bits.o .libs/qgain475.o
.libs/qgain795.o .libs/q_gain_c.o .libs/q_gain_p.o .libs/qua_gain.o
.libs/s10_8pf.o .libs/set_sign.o .libs/sid_sync.o .libs/sp_enc.o
.libs/spreproc.o .libs/spstproc.o .libs/ton_stab.o .libs/vad1.o .libs/add.o
.libs/az_lsp.o .libs/bitno_tab.o .libs/bitreorder_tab.o .libs/c2_9pf_tab.o
.libs/div_s.o .libs/extract_h.o .libs/extract_l.o .libs/gains_tbl.o
.libs/gc_pred.o .libs/get_const_tbls.o .libs/gmed_n.o .libs/gray_tbl.o
.libs/grid_tbl.o .libs/int_lpc.o .libs/inv_sqrt.o .libs/inv_sqrt_tbl.o
.libs/l_deposit_h.o .libs/l_deposit_l.o .libs/log2.o .libs/log2_norm.o
.libs/log2_tbl.o .libs/lsfwt.o .libs/l_shr_r.o .libs/lsp_az.o .libs/lsp.o
.libs/lsp_lsf.o .libs/lsp_lsf_tbl.o .libs/lsp_tab.o .libs/mult_r.o
.libs/negate.o .libs/norm_l.o .libs/norm_s.o .libs/overflow_tbl.o
.libs/ph_disp_tab.o .libs/pow2.o .libs/pow2_tbl.o .libs/pred_lt.o
.libs/q_plsf_3.o .libs/q_plsf_3_tbl.o .libs/q_plsf_5.o .libs/q_plsf_5_tbl.o
.libs/q_plsf.o .libs/qua_gain_tbl.o .libs/reorder.o .libs/residu.o
.libs/round.o .libs/set_zero.o .libs/shr.o .libs/shr_r.o .libs/sqrt_l.o
.libs/sqrt_l_tbl.o .libs/sub.o .libs/syn_filt.o .libs/weight_a.o
.libs/window_tab.o -L.libs -lm
-Wl,-retain-symbols-file,/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.
3/amrnb/opencore-amrnb.sym
.libs/wrapper.o:1: error: stray '\177' in program
.libs/wrapper.o:1: error: stray '\1' in program
.libs/wrapper.o:1: error: stray '\2' in program
.libs/wrapper.o:1: error: stray '\1' in program
[...]

Note the "-x c ... file.o";
it treats the *.o files as C source and fails.
(Which itself is probably a bug in the non-gnu libtool, right?)


With USE_LIBTOOL=gnu, the linking line becomes

libtool: link: cc -shared  -fPIC -DPIC -o .libs/libopencore-amrnb.so.0.0
.libs/wrapper.o .libs/agc.o .libs/amrdecode.o .libs/a_refl.o .libs/b_cn_cod.o
.libs/bgnscd.o .libs/c_g_aver.o .libs/d1035pf.o .libs/d2_11pf.o .libs/d2_9pf.o
.libs/d3_14pf.o .libs/d4_17pf.o .libs/d8_31pf.o .libs/dec_amr.o
.libs/dec_gain.o .libs/dec_input_format_tab.o .libs/dec_lag3.o
.libs/dec_lag6.o .libs/d_gain_c.o .libs/d_gain_p.o .libs/d_plsf_3.o
.libs/d_plsf_5.o .libs/d_plsf.o .libs/dtx_dec.o .libs/ec_gains.o
.libs/ex_ctrl.o .libs/if2_to_ets.o .libs/int_lsf.o .libs/lsp_avg.o
.libs/ph_disp.o .libs/post_pro.o .libs/preemph.o .libs/pstfilt.o
.libs/qgain475_tab.o .libs/sp_dec.o .libs/wmf_to_ets.o .libs/amrencode.o
.libs/autocorr.o .libs/c1035pf.o .libs/c2_11pf.o .libs/c2_9pf.o
.libs/c3_14pf.o .libs/c4_17pf.o .libs/c8_31pf.o .libs/calc_cor.o
.libs/calc_en.o .libs/cbsearch.o .libs/cl_ltp.o .libs/cod_amr.o
.libs/convolve.o .libs/cor_h.o .libs/cor_h_x2.o .libs/cor_h_x.o
.libs/corrwght_tab.o .libs/div_32.o .libs/dtx_enc.o .libs/enc_lag3.o
.libs/enc_lag6.o .libs/enc_output_format_tab.o .libs/ets_to_if2.o
.libs/ets_to_wmf.o .libs/g_adapt.o .libs/gain_q.o .libs/g_code.o
.libs/g_pitch.o .libs/hp_max.o .libs/inter_36.o .libs/inter_36_tab.o
.libs/l_abs.o .libs/lag_wind.o .libs/lag_wind_tab.o .libs/l_comp.o
.libs/levinson.o .libs/l_extract.o .libs/lflg_upd.o .libs/l_negate.o
.libs/lpc.o .libs/ol_ltp.o .libs/pitch_fr.o .libs/pitch_ol.o .libs/p_ol_wgh.o
.libs/pre_big.o .libs/pre_proc.o .libs/prm2bits.o .libs/qgain475.o
.libs/qgain795.o .libs/q_gain_c.o .libs/q_gain_p.o .libs/qua_gain.o
.libs/s10_8pf.o .libs/set_sign.o .libs/sid_sync.o .libs/sp_enc.o
.libs/spreproc.o .libs/spstproc.o .libs/ton_stab.o .libs/vad1.o .libs/add.o
.libs/az_lsp.o .libs/bitno_tab.o .libs/bitreorder_tab.o .libs/c2_9pf_tab.o
.libs/div_s.o .libs/extract_h.o .libs/extract_l.o .libs/gains_tbl.o
.libs/gc_pred.o .libs/get_const_tbls.o .libs/gmed_n.o .libs/gray_tbl.o
.libs/grid_tbl.o .libs/int_lpc.o .libs/inv_sqrt.o .libs/inv_sqrt_tbl.o
.libs/l_deposit_h.o .libs/l_deposit_l.o .libs/log2.o .libs/log2_norm.o
.libs/log2_tbl.o .libs/lsfwt.o .libs/l_shr_r.o .libs/lsp_az.o .libs/lsp.o
.libs/lsp_lsf.o .libs/lsp_lsf_tbl.o .libs/lsp_tab.o .libs/mult_r.o
.libs/negate.o .libs/norm_l.o .libs/norm_s.o .libs/overflow_tbl.o
.libs/ph_disp_tab.o .libs/pow2.o .libs/pow2_tbl.o .libs/pred_lt.o
.libs/q_plsf_3.o .libs/q_plsf_3_tbl.o .libs/q_plsf_5.o .libs/q_plsf_5_tbl.o
.libs/q_plsf.o .libs/qua_gain_tbl.o .libs/reorder.o .libs/residu.o
.libs/round.o .libs/set_zero.o .libs/shr.o .libs/shr_r.o .libs/sqrt_l.o
.libs/sqrt_l_tbl.o .libs/sub.o .libs/syn_filt.o .libs/weight_a.o
.libs/window_tab.o   -lm  -O2
-Wl,-retain-symbols-file,/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.
3/amrnb/opencore-amrnb.sym

i.e. it removes the "-I... -x c -std=c99 -O2 -pipe"
which 'fixes' it and subsequently the linkage happens.

        Jan

Reply via email to