Bug 31390 - [display html] Undefined subroutine &bigint::hex
Summary: [display html] Undefined subroutine &bigint::hex
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gprofng (show other bugs)
Version: 2.42
: P3 enhancement
Target Milestone: ---
Assignee: Ruud van der Pas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-16 15:26 UTC by Letu Ren
Modified: 2024-02-29 20:32 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2024-02-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Letu Ren 2024-02-16 15:26:16 UTC
I'm using gprofng distributed by ArchLinux at commit `https://sourceware.org/binutils/docs/gprofng.html#Man-page-for-gprofng-display-html`. I encountered an error when using `gprofng display html test.1.er`.

```
Undefined subroutine &bigint::hex called at /usr/bin/gp-display-html line 4059, <MAP_XML> line 1.
```

test.1.er is created by `gprofng collect app ./a.out`.

I'm not quite familiar with Perl or gprofng. I just replace `display text` with `display html` in https://sourceware.org/binutils/docs/gprofng.html#Getting-Started.

Any suggestion is welcome. Thanks in advance.
Comment 1 Ruud van der Pas 2024-02-21 21:19:20 UTC
Thank you for the feedback.

I'm sorry you ran into this.

Technically, this is not a bug and this is why I have lowered the priority to P3. I have also labeled this as an enhancement, because it is a documentation issue.

The Perl code that implements the "gprofng display html" functionality, needs the bigint module. Unfortunately, this is not part of the standard module set and needs to be installed separately before running this tool.

This is not an ideal situation, but at the moment, the only thing I can do is to document this and give a recipe how to obtain and install this missing module.

This is the reason I made it an enhancement.

I will work on recipe for this and update this bugzilla once I have it.
Comment 2 Ruud van der Pas 2024-02-22 12:15:00 UTC
I have tried to reproduce the issue, but on Oracle Linux (OL), the perl-bignum package is installed as part of the Perl package.

I am unfortunately not familiar with ArchLinux, but hopefully a "yum install perl", or "yum install perl-bignum" works.

Otherwise, you may want to try using cpan and cpanm to install the bignum Perl module. This is well documented in this page: http://www.cpan.org/modules/INSTALL.html

I tried this myself and the following commands worked for me:

$ cpan App::cpanminus

I relied on the defaults, but did set it up such that I could use sudo for subsequent installations:

What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')
 [local::lib] sudo

Next, I used cpanm to install bignum:

$ cpanm --sudo bignum

This also pulled in some other modules. This is what I saw on my machine:

$ cpanm --sudo bignum
--> Working on bignum
Fetching http://www.cpan.org/authors/id/P/PJ/PJACKLAM/bignum-0.67.tar.gz ... OK
Configuring bignum-0.67 ... OK
==> Found dependencies: Math::BigRat, Math::BigInt
--> Working on Math::BigRat
Fetching http://www.cpan.org/authors/id/P/PJ/PJACKLAM/Math-BigInt-2.003002.tar.gz ... OK
Configuring Math-BigInt-2.003002 ... OK
Building and testing Math-BigInt-2.003002 ... OK
Successfully installed Math-BigInt-2.003002 (upgraded from 0.2614)
Building and testing bignum-0.67 ... OK
Successfully installed bignum-0.67 (upgraded from 0.49)
2 distributions installed
$

Please give this a try and let me know what your experiences are. If you still have an issue, I'll be happy to help to try to resolve it.
Comment 3 Ruud van der Pas 2024-02-22 12:33:45 UTC
I found that after installing module bignum, the error that you reported manifested itself. I will dig some deeper, but as a workaround, the following works for me.

At line 25 in file gp-display-html (e.g. $ sudo vi `which gp-display-html`) you could change "use bignum" by "use bigint". The program runs to completion then.
Comment 4 Letu Ren 2024-02-23 02:59:18 UTC
Thanks for your reply. I can confirm I have installed bignum module. And the wordround seems to work properly. Looking forward to an upstream patch to fix this issue.
Comment 5 Ruud van der Pas 2024-02-23 08:18:15 UTC
Thanks for the update! Great to hear that this works for you now.

I plan to work on a patch to eliminate the reliance on bignum and use bigint instead.
Comment 6 Sourceware Commits 2024-02-29 01:18:48 UTC
The master branch has been updated by Vladimir Mezentsev <vmezents@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3243d790ee32aa8eda69226d81b1e79dbd1dcd87

commit 3243d790ee32aa8eda69226d81b1e79dbd1dcd87
Author: Ruud van der Pas <ruud.vanderpas@oracle.com>
Date:   Tue Feb 27 18:29:55 2024 +0000

    gprofng: change use of bignum to use of bigint
    
    Change the statement "use bignum" to "use bigint".  This is sufficient
    for gp-display-html to work and removes the dependency on bignum.
    
    gprofng/ChangeLog
    2024-02-27  Ruud van der Pas  <ruud.vanderpas@oracle.com>
    
            PR 31390
            * gprofng/gp-display-html: One line change to "use bigint".
Comment 7 Ruud van der Pas 2024-02-29 20:32:50 UTC
A patch has been tested and submitted.