<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>48475</bug_id>
          
          <creation_ts>2023-11-16 19:59:18 +0300</creation_ts>
          <short_desc>отключить debuginfo для ocaml bytecode executable</short_desc>
          <delta_ts>2024-09-21 21:47:36 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>rpm-build</component>
          <version>unstable</version>
          <rep_platform>x86_64</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P5</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>46782</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Anton Farygin">rider</reporter>
          <assigned_to name="placeholder@altlinux.org">placeholder</assigned_to>
          <cc>arseny</cc>
    
    <cc>glebfm</cc>
    
    <cc>imz</cc>
    
    <cc>iv</cc>
    
    <cc>ldv</cc>
    
    <cc>mike</cc>
    
    <cc>placeholder</cc>
    
    <cc>rider</cc>
    
    <cc>vt</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>237332</commentid>
    <comment_count>0</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2023-11-16 19:59:18 +0300</bug_when>
    <thetext>При сборке bytecode-only версии ocaml нарвался на то, что собранные в /usr/bin программы просят дать им ocaml код для исполнения вместо выполнения своих функций.

Оказываетя, что ocaml при сборке bytecode бинарей использует секцию debuginfo для размещения bytecode.
Предлагаю отключить debuginfo для всех бинарей, у которых в конце есть сигнатура &quot;Caml1999X0[0-9][0-9]&quot;
$ tail -c 12 /usr/src/tmp/ocaml-findlib-buildroot/usr/bin/ocamlfind
Caml1999X031


В принципе помогает 
%set_debuginfo_skiplist %_bindir/*

Но т.к. это придётся делать в каждом потенциально неизвестном пакете, то лучше для всех подобных файлов добавить исключение на уровне rpm-build</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>237347</commentid>
    <comment_count>1</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2023-11-16 22:29:29 +0300</bug_when>
    <thetext>* Есть ли инфа или спецификация на такое необычное использование .debug_* секций?
* Есть ли примеры бинарей?
* Что сделали в Федоре?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>237348</commentid>
    <comment_count>2</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2023-11-16 22:33:36 +0300</bug_when>
    <thetext>Кстати, разве не вариант сделать %set_debuginfo_skiplist %_bindir/*
 в rpm-build-ocaml?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>237351</commentid>
    <comment_count>3</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2023-11-16 22:52:28 +0300</bug_when>
    <thetext>сейчас я дособираю сборочное задание с ocaml - пойму сколько бинарей это затрагивает. Есть вероятность, что совсем немного - эта схема линковки старая и в современных проектах от неё ушли.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>237352</commentid>
    <comment_count>4</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2023-11-16 23:03:14 +0300</bug_when>
    <thetext>подробнее про этот режим сборки можно почитать тут:
https://v2.ocaml.org/releases/4.14/htmlman/comp.html
-custom</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>237355</commentid>
    <comment_count>5</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2023-11-17 00:03:26 +0300</bug_when>
    <thetext>Спасибо.

&gt; Unix:  Never use the strip command on executables produced by ocamlc
&gt; -custom, this would remove the bytecode part of the executable.

Пока предположу, что с байткодом там не секция .debug_info а какая-то другая. И надо использовать %brp_strip_none %_bindir/*, а может даже %brp_strip_debug хватит.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>237374</commentid>
    <comment_count>6</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2023-11-17 08:34:05 +0300</bug_when>
    <thetext>%brp_strip_none %_bindir/* не помогает, я первым делом попробовал.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>237375</commentid>
    <comment_count>7</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2023-11-17 08:37:07 +0300</bug_when>
    <thetext>воспроизводится при сборке пакета ocaml-findlib из задания 333652 для архитектуры i586
после установки надо запустить ocamlfind из %buildroot

Но сейчас он собран в режиме -no-custom - надо убрать это из configure</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>242257</commentid>
    <comment_count>8</comment_count>
    <who name="Ivan A. Melnikov">iv</who>
    <bug_when>2024-02-28 08:59:21 +0300</bug_when>
    <thetext>(In reply to Anton Farygin from comment #4)
&gt; подробнее про этот режим сборки можно почитать тут:
&gt; https://v2.ocaml.org/releases/4.14/htmlman/comp.html
&gt; -custom

-custom выглядит как достаточно жуткая вещь.

Возможно, нам стоит вслед за dune[1][2] переходить на -output-complete-exe[3].

[1] https://github.com/ocaml/dune/issues/2505
[2] https://github.com/ocaml/dune/pull/2692
[3] https://github.com/ocaml/ocaml/pull/8872 &quot;The idea is to deprecate -custom in a follow-up PR.&quot;


Это сработало для unison (https://git.altlinux.org/tasks/341561/, проверял на loongarch64, в хешере на i586 прошёл начало туторила) и coccinelle (в Сизифе, тоже проверял).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>242259</commentid>
    <comment_count>9</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2024-02-28 09:06:45 +0300</bug_when>
    <thetext>Да, согласен.

custom почти не осталось в репозитории.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>243792</commentid>
    <comment_count>10</comment_count>
    <who name="Vitaly Chikunov">vt</who>
    <bug_when>2024-03-30 16:33:15 +0300</bug_when>
    <thetext>&gt; Это сработало для unison (...) и coccinelle (в Сизифе, тоже проверял).

@iv, Про coccinelle, а почему только для этих архитектур а не для всех?

  %ifnarch %ocaml_native_arch
  # see https://bugzilla.altlinux.org/48475
  find . -name Makefile | xargs sed -r  -i &apos;s/-custom\s/-output-complete-exe /g&apos;
  %endif</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>246795</commentid>
    <comment_count>11</comment_count>
    <who name="Ivan A. Melnikov">iv</who>
    <bug_when>2024-05-27 10:59:38 +0300</bug_when>
    <thetext>(In reply to Vitaly Chikunov from comment #10)
&gt; &gt; Это сработало для unison (...) и coccinelle (в Сизифе, тоже проверял).
&gt; 
&gt; @iv, Про coccinelle, а почему только для этих архитектур а не для всех?

Скорее всего, я следовал заведённой ещё в %e2k традиции не трогать то, что работает.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>251896</commentid>
    <comment_count>12</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2024-09-21 18:28:57 +0300</bug_when>
    <thetext>А у нас кроме i586 остались ещё не нативные архитектуры ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>251901</commentid>
    <comment_count>13</comment_count>
    <who name="Ivan A. Melnikov">iv</who>
    <bug_when>2024-09-21 20:12:33 +0300</bug_when>
    <thetext>(In reply to Anton Farygin from comment #12)
&gt; А у нас кроме i586 остались ещё не нативные архитектуры ?

Как минимум loongarch64 и %e2k.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>251904</commentid>
    <comment_count>14</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2024-09-21 21:47:36 +0300</bug_when>
    <thetext>для loongarch есть вот такой PR:
https://github.com/ocaml/ocaml/pull/11974</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>