Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphics module not installing or acting weird #26

Open
sumanstats opened this issue May 20, 2021 · 17 comments
Open

Graphics module not installing or acting weird #26

sumanstats opened this issue May 20, 2021 · 17 comments

Comments

@sumanstats
Copy link

I am trying to use PDL(https://metacpan.org/pod/PDL) and for plotting the ndarrays, I need Graphics libraries. So I tried to install PDL::Graphics::PGPLOT

cpanm PDL::Graphics::PGPLOT
--> Working on PDL::Graphics::PGPLOT
Fetching http://www.cpan.org/authors/id/E/ET/ETJ/PDL-2.047.tar.gz ... OK
Configuring PDL-2.047 ... OK
Building and testing PDL-2.047 ... OK
Successfully installed PDL-2.047
1 distribution installed

and PDL::Graphics::PLplot

C:\strawberry-perl-5.32.1.1-64bit-PDL>cpanm PDL::Graphics::PLplot
--> Working on PDL::Graphics::PLplot
Fetching http://www.cpan.org/authors/id/D/DH/DHUNT/PDL-Graphics-PLplot-0.74.tar.gz ... OK
Configuring PDL-Graphics-PLplot-0.74 ... OK
Building and testing PDL-Graphics-PLplot-0.74 ... OK
Successfully installed PDL-Graphics-PLplot-0.74
1 distribution installed

Trying to use those libraries throw error:

pdl> use PDL::Grpahics::PGPLOT
Compile error: Can't locate PDL/Grpahics/PGPLOT.pm in @INC (you may need to install the PDL::Grpahics::PGPLOT module) (@INC contains: C:/strawberry-perl-5.32.1.1-64bit-PDL/perl/site/lib/MSWin32-x64-multi-thread C:/strawberry-perl-5.32.1.1-64bit-PDL/perl/site/lib C:/strawberry-perl-5.32.1.1-64bit-PDL/perl/vendor/lib C:/strawberry-perl-5.32.1.1-64bit-PDL/perl/lib) at (eval 414) line 7.
BEGIN failed--compilation aborted at (eval 414) line 7.
pdl> use PDL::Grpahics::PLplot
Compile error: Can't locate PDL/Grpahics/PLplot.pm in @INC (you may need to install the PDL::Grpahics::PLplot module) (@INC contains: C:/strawberry-perl-5.32.1.1-64bit-PDL/perl/site/lib/MSWin32-x64-multi-thread C:/strawberry-perl-5.32.1.1-64bit-PDL/perl/site/lib C:/strawberry-perl-5.32.1.1-64bit-PDL/perl/vendor/lib C:/strawberry-perl-5.32.1.1-64bit-PDL/perl/lib) at (eval 422) line 7.
BEGIN failed--compilation aborted at (eval 422) line 7.

To practice examples on http://pdl.perl.org/?page=FirstSteps I again tried installing PDL::Graphics::Simple

C:\strawberry-perl-5.32.1.1-64bit-PDL>cpanm PDL::Graphics::Simple
--> Working on PDL::Graphics::Simple
Fetching http://www.cpan.org/authors/id/Z/ZO/ZOWIE/PDL-Graphics-Simple-1.005.tar.gz ... OK
Configuring PDL-Graphics-Simple-1.005 ... OK
Building and testing PDL-Graphics-Simple-1.005 ... FAIL
! Installing PDL::Graphics::Simple failed. See C:\strawberry-perl-5.32.1.1-64bit-PDL\data\.cpanm\work\1621510604.10224\build.log for details. Retry with --force to force install it.

but it fails. Using --force however installs but using it in program fails:

pdl> use PDL::Graphics::Simple
pdl> imag (sin(rvals(200,200)+1))
Trying gnuplot (PDL::Graphics::Gnuplot)...PDL::Graphics::SImple: Gnuplot exists but yours doesn't support either the x11 or wxt terminal
Trying pgplot (PDL::Graphics::PGPLOT::Window)...nope
Trying plplot (PDL::Graphics::PLplot)...nope
Trying prima (PDL::Graphics::Prima)...nope
Runtime error: Sorry, all known plotting engines failed.  Install one and try again.
pdl>

Looking at the error Gnuplot exists but yours doesn't support either the x11 or wxt terminal, I don't know what to do.

How to get over this error and use PDL with strawberry perl?
Any help?

@sisyphus
Copy link

sisyphus commented May 20, 2021 via email

@sisyphus
Copy link

sisyphus commented May 21, 2021 via email

@sumanstats
Copy link
Author

Thank you for looking into the issue.
I hope strawberry would look into these intricacies and make it easier for a beginner who want to start with scientific programming in perl.

@sisyphus
Copy link

sisyphus commented May 30, 2021 via email

@zmughal
Copy link

zmughal commented Oct 24, 2021

Please try PDL-Graphics-PLplot-0.79.

This may have been fixed by PDLPorters/pdl-graphics-plplot#16. You may see an issue with interactive plotting, but plotting to files should work.

@sisyphus
Copy link

A straight out cpan -i PDL::Graphics::PLplot failed to install Alien::PLplot, so I broke it up into a few steps:

> set ALIEN_INSTALL_TYPE=share
> cpan -i Alien::cmake3

Then I installed Alien::PLplot the ol' fashioned manual way. (I've no reason to doubt that cpan -i Alien::PLplot would have worked just as well)

Then I installed PDL-Graphics-PLplot-0.79 via the same manual method. (Again, I believe cpan -i PDL-Graphics-PLplot would also have worked.)

The 'gmake test' step produced some noise (see attached plplot_tests.txt) - though I think all of that noise is expected.

plplot_tests.txt

@zmughal
Copy link

zmughal commented Oct 25, 2021

Thank you for testing that @sisyphus! Yes, that noise is expected from the tests on Windows.

@shawnlaffan
Copy link
Contributor

shawnlaffan commented May 28, 2023

Testing PDL::Graphics::PLplot with the current 5.36.1 dev release results in test failures.

It looks like the system crashes on test 17 when it tries to call

$pl->shadeplot ($z, $nsteps, BOX => [-1, 1, -1, 1], PALETTE => 'RAINBOW')

Wrapping the code in an eval has no effect.

If I run plplot.t under gdb then all tests pass and the script completes normally. I'm not sure what to make of that.

perl -Mblib t\plplot.t
ok 1 - An object of class 'PDL::Graphics::PLplot' isa 'PDL::Graphics::PLplot'
ok 2 - Simple line plot
ok 3 - Simple line plot with LINEWIDTH specified
ok 4 - Symbol plot
ok 5 - Lines and symbols
ok 6 - Sample layer statistics plot
ok 7 - Setting pagesize
ok 8 - Line plot with gaps (plgapline)
ok 9 - Setting JUSTify = 1
ok 10 - Printing text inside and outside of plot window
ok 11 - Colored symbol plot with key
ok 12 - Colored symbol plot with key: reverse rainbow
ok 13 - Colored symbol plot with key, via low level interface
ok 14 - plgvpd call works correctly
ok 15 - plgvpw call works correctly
ok 16 - 3D color plot, low level interface

Edit - I set the PLPLOT env vars to the relevant share dir before running the build.

@shawnlaffan
Copy link
Contributor

Setting set disable-randomization off in gdb replicates the crash (setting courtesy stackoverflow).

Backtrace below after compiling with gmake OPTIMIZE=-g.

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ffeea63b564 in ?? () from C:\ST5EA9~1\data\.cpanm\work\1685253152.33120\PDL-Graphics-PLplot-0.83\blib\arch\auto\PDL\Graphics\PLplot\PLplot.xs.dll
(gdb) bt
#0  0x00007ffeea63b564 in ?? ()
   from C:\ST5EA9~1\data\.cpanm\work\1685253152.33120\PDL-Graphics-PLplot-0.83\blib\arch\auto\PDL\Graphics\PLplot\PLplot.xs.dll
#1  0x00007ffec32f1c3c in perl536!Perl_clear_defarray () from C:\strawberry_5361_gcc13_20230528\perl\bin\perl536.dll
#2  0x00007ffec333ea22 in perl536!Perl_runops_standard () from C:\strawberry_5361_gcc13_20230528\perl\bin\perl536.dll
#3  0x00007ffec33022a4 in perl_run () from C:\strawberry_5361_gcc13_20230528\perl\bin\perl536.dll
#4  0x00007ffec334d95f in perl536!RunPerl () from C:\strawberry_5361_gcc13_20230528\perl\bin\perl536.dll
#5  0x00007ff663b61340 in ?? ()
#6  0x00007ff663b61146 in ?? ()
#7  0x00007fff811026ad in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\System32\kernel32.dll
#8  0x00007fff819aa9f8 in ntdll!RtlUserThreadStart () from C:\WINDOWS\SYSTEM32\ntdll.dll
#9  0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

@shawnlaffan
Copy link
Contributor

FWIW, the backtrace looks similar to the last parts of the one for OpenGL.

@shawnlaffan
Copy link
Contributor

Also FWIW, there are similar test failures under linux with perl 5.37.x so this would not seem to be Strawberry Perl specific.
http://matrix.cpantesters.org/?dist=PDL-Graphics-PLplot+0.83

This one, for example, also crashes on test 17: http://www.cpantesters.org/cpan/report/6c4cf676-cc37-11ed-95c7-b1478086ef20

@mohawk2
Copy link

mohawk2 commented May 28, 2023

Is this fixed by the vmem change?

@shawnlaffan
Copy link
Contributor

Is this fixed by the vmem change?

No. This strawberry build includes the vmem change.

@mohawk2
Copy link

mohawk2 commented May 28, 2023

I'm a bit lost, because it's not at all clear what function it's crashing in (and the same is true of the OpenGL problem, though thanks for capturing the info onto an issue). Would it be possible to tell gdb to break in a plausible function, possibly the actual PLplot plsstrm (one of the first functions called by shadeplot, though might also be called by others), and seeing what bad data is causing the problem?

@shawnlaffan
Copy link
Contributor

I'm sure it's possible but it's best done by someone familiar with the process.

If anyone wants to have a go then the relevant Strawberry perl version can be downloaded from https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/tag/dev_5.36.1_20230528_gcc13

@shawnlaffan
Copy link
Contributor

If it helps, the set of patches and other settings used for the build are below.

HAS_BUILTIN_EXPECT is disabled due to stability issues (#85). Would it be possible for HAS_BUILTIN_CHOOSE_EXPR to have similar issues?

patch => { #DST paths are relative to the perl src root
'<dist_sharedir>/msi/files/perlexe.ico' => 'win32/perlexe.ico',
'<dist_sharedir>/perl-5.36/perlexe.rc.tt' => 'win32/perlexe.rc',
'<dist_sharedir>/perl-5.36/perl_pr19663.diff' => '*',
'<dist_sharedir>/perl-5.36/rt142390.patch' => '*',
'<dist_sharedir>/perl-5.36/perl_pr20008.diff' => '*',
'<dist_sharedir>/perl-5.36/perl_pr20136.patch' => '*',
'<dist_sharedir>/perl-5.36/perl_pr19912_commit1.patch' => '*',
#'<dist_sharedir>/perl-5.36/GNUmakefile' => 'win32/GNUmakefile',
'config_H.gc' => {
I_DBM => 'define',
I_GDBM => 'define',
I_NDBM => 'define',
#HAS_BUILTIN_EXPECT => 'define',
HAS_BUILTIN_CHOOSE_EXPR => 'define',
},
'config.gc' => { # see Step.pm for list of default updates
d_builtin_choose_expr => 'define',
#d_builtin_expect => 'define',
d_mkstemp => 'define',
d_ndbm => 'define',
#d_symlink => 'undef', # many cpan modules fail tests when defined
i_db => 'define',
i_dbm => 'define',
i_gdbm => 'define',
i_ndbm => 'define',
#myuname => 'Win32 strawberry-perl 5.36.0.1 #1 Sat 04 Mar 2023 x64 tempvaluesonly',
osvers => '10',
},
},

@shawnlaffan
Copy link
Contributor

Disabling HAS_BUILTIN_CHOOSE_EXPR and d_builtin_choose_expr makes no difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants