http://www.perlmonks.org?node_id=1196261

SouthWind has asked for the wisdom of the Perl Monks concerning the following question:

I use 5.24 Strawberry Perl Portable Edition from http://strawberryperl.com/releases.html

I install OpenGL::Shader with cpan,it looks ok, but when I run test.pl, Perl say: #version directive missing.

D:\strawberryportable>cpan OpernGL::Shader Loading internal null logger. Install Log::Log4perl for logging messag +es CPAN: CPAN::SQLite loaded ok (v0.211) CPAN: LWP::UserAgent loaded ok (v6.26) CPAN: Time::HiRes loaded ok (v1.9742) Fetching with LWP: http://cpan.strawberryperl.com/authors/01mailrc.txt.gz CPAN: YAML::XS loaded ok (v0.65) Fetching with LWP: http://cpan.strawberryperl.com/modules/02packages.details.txt.gz Fetching with LWP: http://cpan.strawberryperl.com/modules/03modlist.data.gz Creating database file ... Done! D:\strawberryportable>perl test.pl Fragment shader: WARNING: 0:3: '' : #version directive missing
Then I download OpenGL::Shader from:

https://metacpan.org/pod/OpenGL::Shader

D:\strawberryportable\OpenGL-Shader-1.01>perl Makefile.PL Checking if your kit is complete... Looks good Generating a dmake-style Makefile Writing Makefile for OpenGL::Shader Writing MYMETA.yml and MYMETA.json <p> D:\strawberryportable\OpenGL-Shader-1.01>dmake cp Shader/Common.pm blib\lib\OpenGL\Shader\Common.pm cp Shader.pod blib\lib\OpenGL\Shader.pod cp Shader/Objects.pm blib\lib\OpenGL\Shader\Objects.pm cp Shader/GLSL.pm blib\lib\OpenGL\Shader\GLSL.pm cp Shader.pm blib\lib\OpenGL\Shader.pm cp Shader/ARB.pm blib\lib\OpenGL\Shader\ARB.pm cp shader-test.pl blib\lib\OpenGL\shader-test.pl cp Shader/CG.pm blib\lib\OpenGL\Shader\CG.pm <p> D:\strawberryportable\OpenGL-Shader-1.01>dmake test "D:\strawberryportable\perl\bin\perl.exe" "-MExtUtils::Command::MM" "- +MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, + 'blib\lib', 'blib\arch')" t/*.t t/OpenGL-Shader.t .. <p> ________________________________________<p> Testing OpenGL::Shader<p> ----------------------------------------<p> * ok: Installed: OpenGL v0.7 * ok: OpenGL::Shader module loaded: v1.01 Available shader types: ARB v1.0 - ARBfp1.0 and ARBvp1.0 Assembly GLSL v4.40 - OpenGL Shader Language * ok: 2 shader type(s) reported Use of uninitialized value $type in uc at D:\strawberryportable\OpenGL +-Shader-1.01\blib\lib/OpenGL/Shader/Common.pm line 109. Instantiated ARB v1.0 * ok: Loaded ARB shader from: fragment.arb, vertex.arb Use of uninitialized value $type in uc at D:\strawberryportable\OpenGL +-Shader-1.01\blib\lib/OpenGL/Shader/Common.pm line 109. Instantiated GLSL v4.40 * fail: Unable to load GLSL shader: Fragment shader: WARNING: 0:2: '' +: #version directive missing * skip: CG shader test <p> ________________________________________ t/OpenGL-Shader.t .. Failed 1/6 subtests (less 1 skipped subtest: 4 okay) Test Summary Report ------------------- t/OpenGL-Shader.t (Wstat: 0 Tests: 6 Failed: 1) Failed test: 5 Files=1, Tests=6, 1 wallclock secs ( 0.05 usr + 0.03 sys = 0.08 CPU +) Result: FAIL Failed 1/1 test programs. 1/6 subtests failed. dmake: Error code 255, while making 'test_dynamic' <p> D:\strawberryportable\OpenGL-Shader-1.01>dmake test "D:\strawberryportable\perl\bin\perl.exe" "-MExtUtils::Command::MM" "- +MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, + 'blib\lib', 'blib\arch')" t/*.t t/OpenGL-Shader.t .. ________________________________________ Testing OpenGL::Shader ---------------------------------------- * ok: Installed: OpenGL v0.7 * ok: OpenGL::Shader module loaded: v1.01 Available shader types: ARB v1.0 - ARBfp1.0 and ARBvp1.0 Assembly GLSL v4.40 - OpenGL Shader Language * ok: 2 shader type(s) reported Use of uninitialized value $type in uc at D:\strawberryportable\OpenGL +-Shader-1.01\blib\lib/OpenGL/Shader/Common.pm line 109. Instantiated ARB v1.0 * ok: Loaded ARB shader from: fragment.arb, vertex.arb Use of uninitialized value $type in uc at D:\strawberryportable\OpenGL +-Shader-1.01\blib\lib/OpenGL/Shader/Common.pm line 109. Instantiated GLSL v4.40 * fail: Unable to load GLSL shader: Fragment shader: WARNING: 0:2: '' +: #version directive missing * skip: CG shader test ________________________________________ t/OpenGL-Shader.t .. Failed 1/6 subtests (less 1 skipped subtest: 4 okay) Test Summary Report ------------------- t/OpenGL-Shader.t (Wstat: 0 Tests: 6 Failed: 1) Failed test: 5 Files=1, Tests=6, 0 wallclock secs ( 0.05 usr + 0.00 sys = 0.05 CPU +) Result: FAIL Failed 1/1 test programs. 1/6 subtests failed. dmake: Error code 255, while making 'test_dynamic'
How can I solve the problem?

Thanks!

Replies are listed 'Best First'.
Re: Unable to install OpenGL::Shader
by Corion (Patriarch) on Jul 29, 2017 at 08:15 UTC

    This is most likely because OpenGL shaders moved on a bit and now every shader program requires a #version directive at the start.

    You could add the appropriate line to the test shader, as discussed in this test report.

    A somewhat more recent version of OpenGL bindings is OpenGL::Modern, which also tries to be compatible to OpenGL and OpenGL::Shader, so maybe you want to try that if you want to do shader oriented programming.

Re: Unable to install OpenGL::Shader
by syphilis (Archbishop) on Jul 29, 2017 at 13:31 UTC
    How can I solve the problem?

    It's installing ok for me on Windows 7 with Strawberry portable 5.24.1 (archname=MSWin32-x64-multi-thread, uname='Win32 strawberry-perl 5.24.1.1 #1 Mon Jan 16 02:00:29 2017 x64'):
    "C:\_64\strawberry5.24.1\perl\bin\perl.exe" "-MExtUtils::Command::MM" +"-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness( +0, 'blib\lib', 'blib\arch')" t/*.t t/OpenGL-Shader.t .. ________________________________________ Testing OpenGL::Shader ---------------------------------------- * ok: Installed: OpenGL v0.7 * ok: OpenGL::Shader module loaded: v1.01 Available shader types: ARB v1.0 - ARBfp1.0 and ARBvp1.0 Assembly CG v1.00 - nVidia's Cg Shader Language GLSL v4.30 - OpenGL Shader Language * ok: 3 shader type(s) reported Use of uninitialized value $type in uc at C:\Users\sisyphus\.cpan\buil +d\OpenGL-Shader-1.01-0\blib\lib/OpenGL/Shader/Common.pm line 109. Instantiated ARB v1.0 * ok: Loaded ARB shader from: fragment.arb, vertex.arb Use of uninitialized value $type in uc at C:\Users\sisyphus\.cpan\buil +d\OpenGL-Shader-1.01-0\blib\lib/OpenGL/Shader/Common.pm line 109. Instantiated GLSL v4.30 * ok: Loaded GLSL shader from: fragment.glsl, vertex.glsl Use of uninitialized value $type in uc at C:\Users\sisyphus\.cpan\buil +d\OpenGL-Shader-1.01-0\blib\lib/OpenGL/Shader/Common.pm line 109. Instantiated CG v1.00 * ok: Loaded CG shader from: fragment.cg, vertex.cg ________________________________________ t/OpenGL-Shader.t .. ok All tests successful. Files=1, Tests=6, 1 wallclock secs ( 0.03 usr + 0.02 sys = 0.05 CPU +) Result: PASS BFREE/OpenGL-Shader-1.01.tar.gz dmake test -- OK
    One difference is that, according to the test output, I have "nVidia's Cg Shader Language" available but you apparently don't.
    I also seem to have a slightly older GLSL version.
    Does any of that account for the difference ?

    What version of Windows are you running ?
    What output does perl -V produce ?

    Cheers,
    Rob
      Thank you! I use Win10.
      D:\strawberryportable>perl -V Summary of my perl5 (revision 5 version 24 subversion 2) configuration +: Platform: osname=MSWin32, osvers=6.3, archname=MSWin32-x64-multi-thread uname='Win32 strawberry-perl 5.24.2.1 #1 Sun Jul 16 17:24:49 2017 +x64' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define use64bitint=define, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL +_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv + -fno-strict-aliasing -mms-bitfields', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='4.9.2', gccosandvers='' intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678 +, doublekind=3 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6, longdblkind=3 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='lo +ng long', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='g++.exe', ldflags ='-s -L"D:\strawberryportable\perl\lib\CORE" + -L"D:\strawberryportable\c\lib"' libpth=D:\strawberryportable\c\lib D:\strawberryportable\c\x86_64- +w64-mingw32\lib D:\strawberryportable\c\lib\gcc\x86_64-w64-mingw32\4. +9.2 libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 +-ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -l +mpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdl +g32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_3 +2 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 libc=, so=dll, useshrplib=true, libperl=libperl524.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=xs.dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -s -L"D:\strawberryportable\perl\ +lib\CORE" -L"D:\strawberryportable\c\lib"' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT +_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_PERLIO USE_PERL_ATOF Built under MSWin32 Compiled at Jul 16 2017 17:40:09 @INC: D:/strawberryportable/perl/site/lib D:/strawberryportable/perl/vendor/lib D:/strawberryportable/perl/lib .
        I use Win10

        Oh, yes - I see the same when I switch to Windows 10.
        Corion has already provided this link to the simplest solution.

        Cheers,
        Rob