Missing edge labels when pack=true

graph {
    # pack=true
    a [label=aaa]
    b [label=bbb]
    c [label=ccc]
    d [label=ddd]
    a -- b [label=a_b]
    c -- d [label=c_d]

results in:
But if I uncomment the pack=true line the edge labels disappear:
How do I make the dot engine keep the labels when packing?

It is a bug. Please report it here: Issues · graphviz / graphviz · GitLab
But, you may be in luck. It is an odd bug in that the edge labels seem to be dropped “at the very last minute”. To see what I mean, run this command: dot -Tdot myfile.gv (with pack=true). You will see that the edge label is present (but with an incorrect position). Why the edge labels are then dropped is a mystery.
Here is a set of commands that will “recreate” the lost edge labels. It computes node, edge, and label placements (the dot command). Then uses gvpr (https://www.graphviz.org/pdf/gvpr.1.pdf) to remove the incorrect edge label position (lp - lp | Graphviz). Finally, we use neato -n (FAQ | Graphviz) to correctly compute the edge label position.

dot -Tdot myfile.gv >TEMP.dot
gvpr -c 'E[lp!=""]{$.lp=""}' >NEW.dot
neato -n -Tpng NEW.dot >myfile.png