FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: en-trust am 20 April 2020, 11:53:16

Titel: Cannot load module allergy
Beitrag von: en-trust am 20 April 2020, 11:53:16
Ich wollte mir nur das allergy definieren und erhalte dann die Meldung Cannot load...

Habe dann mal reload 60_allergy.pm ausgeführt...

Can't locate XML/Simple.pm in @INC (you may need to install the XML::Simple module) (@INC contains: ./FHEM/lib ./lib . /opt/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/armv7l-linux /opt/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3 /opt/perlbrew/perls/perl-5.20.3/lib/5.20.3/armv7l-linux /opt/perlbrew/perls/perl-5.20.3/lib/5.20.3 ./FHEM) at ./FHEM/60_allergy.pm line 26.
BEGIN failed--compilation aborted at ./FHEM/60_allergy.pm line 26.


Kann das Modul nicht mit Perl 5.20.3 ?
Titel: Antw:Cannot load module allergy
Beitrag von: KölnSolar am 20 April 2020, 12:01:45
doch, aber Dir fehlt noch ein Paket. Müsste mit apt-get dieses libxml-simple-perl sein.

Grüße Markus
Titel: Antw:Cannot load module allergy
Beitrag von: en-trust am 20 April 2020, 12:40:59
Das ist aber installiert...

sudo apt-get install libxml-simple-perl
Reading package lists... Done
Building dependency tree
Reading state information... Done
libxml-simple-perl is already the newest version (2.22-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Titel: Antw:Cannot load module allergy
Beitrag von: betateilchen am 20 April 2020, 12:45:39
Es mag schon sein, dass das Paket in Deinem Betriebssystem installiert ist. Aber in Deiner perlbrew Umgebung scheint es nicht gefunden zu werden, schau Dir doch mal die Pfade an, die in @INC enthalten sind.
Titel: Antw:Cannot load module allergy
Beitrag von: Otto123 am 20 April 2020, 13:13:38
Falls der Tipp von betateilchen nicht weiterhilft, es gab letztens offenbar auch mal einfach "kaputt" gegangen:
https://forum.fhem.de/index.php/topic,110160.msg1042559.html#msg1042559
Titel: Antw:Cannot load module allergy
Beitrag von: en-trust am 20 April 2020, 13:29:43
Vielleicht liegts auch an den unterschiedlichen Perls ? Für fhem nutze ich wegen der Speicherproblematik 5.20.3 zusätzlich zur 5.24.1

perl -V | tail
  @INC:
    /etc/perl
    /usr/local/lib/arm-linux-gnueabihf/perl/5.24.1
    /usr/local/share/perl/5.24.1
    /usr/lib/arm-linux-gnueabihf/perl5/5.24
    /usr/share/perl5
    /usr/lib/arm-linux-gnueabihf/perl/5.24
    /usr/share/perl/5.24
    /usr/local/lib/site_perl
    /usr/lib/arm-linux-gnueabihf/perl-base


Neuinstallation des Moduls war erfolglos.
Ich vermute mit apt-get installiere ich das Paket für die 24er Version aber nicth die 20er. Frage wäre wie ich das dann für die 20iger hinbekomme.
Titel: Antw:Cannot load module allergy
Beitrag von: en-trust am 21 April 2020, 08:59:59
Niemand eine Idee ?  :'(
Titel: Antw:Cannot load module allergy
Beitrag von: Christoph Morrison am 21 April 2020, 13:35:58
Zitat von: en-trust am 21 April 2020, 08:59:59
Niemand eine Idee ?  :'(

Doch, nimm mal cpan-minus (https://perlbrew.pl/Perlbrew-and-Friends.html) und mach das dann in deiner perlbrew-Umgebung.
Titel: Antw:Cannot load module allergy
Beitrag von: en-trust am 22 April 2020, 07:40:26
Bin in das Perl für fhem Verzeichnis gewechselt und habe das Modul installiert.

pi@raspberrypi:/opt/perlbrew/perls/perl-5.20.3 $ sudo cpan XML::Simple
Writing /root/.cpan/Metadata
XML::Simple is up to date (2.25).


muss ich da noch mehr tun ?
Titel: Antw:Cannot load module allergy
Beitrag von: Christoph Morrison am 22 April 2020, 10:38:58
Zitat von: en-trust am 22 April 2020, 07:40:26
muss ich da noch mehr tun ?

Lesen und machen, was ich dir im Posting vorher verlinkt habe?
Titel: Antw:Cannot load module allergy
Beitrag von: en-trust am 22 April 2020, 12:50:05
Würde ich ja gerne. Aber selbst der switch klappt nicht, obwohl 5.20.3 installiert ist.

pi@raspberrypi:~ $ perlbrew switch perl-5.20.3
perl-5.20.3 is not installed
pi@raspberrypi:~ $ perlbrew switch /opt/perlbrew/perls/perl-5.20.3/
/opt/perlbrew/perls/perl-5.20.3/ is not installed


Ich hatte mir wegen der Speicherproblematik zusätzlich nach der Anleitung 5.20.3 dazu installiert.

https://forum.fhem.de/index.php/topic,84372.msg880712.html#msg880712
Titel: Antw:Cannot load module allergy
Beitrag von: Christoph Morrison am 22 April 2020, 19:13:07
Zitat von: en-trust am 22 April 2020, 12:50:05
pi@raspberrypi:~ $ perlbrew switch perl-5.20.3
perl-5.20.3 is not installed
pi@raspberrypi:~ $ perlbrew switch /opt/perlbrew/perls/perl-5.20.3/
/opt/perlbrew/perls/perl-5.20.3/ is not installed


Das ist aber ein anderes Problem. Vorher hattest du einfach im "Standardperl" installiert, nicht im perlbrew-Environment. Installiere dir die 5.20.3 doch einfach noch mal und dann machst du was ich verlinkt habe.
Übrigens: Du willst wirklich den Standard-CPAN nicht verwenden. Nimm einfach cpan-minus (kurz cpanm). Viel weniger Schmerzen mit CPAN als mit dem default client.
Titel: Antw:Cannot load module allergy
Beitrag von: en-trust am 28 September 2020, 15:36:40
Nach längerer Pause habe ich perl 5.20.3 nochmal installiert. Wobei es mittlerweile ja auch schon 5.33 gibt. Es denn das Speicherproblem mit einer der neueren Versionen gelöst und kann fhem damit laufen ? Dann würde sich mein Problem ja erübrigen. Denn trotz verwandter Version findet fhem immernoch kein allergy module bzw. kann es laden.


pi@raspberrypi:~ $ perl -V | tail
    PERLBREW_ROOT="/home/pi/perl5/perlbrew"
    PERLBREW_SKIP_INIT="1"
    PERLBREW_VERSION="0.88"
    PERL_LOCAL_LIB_ROOT=""
  @INC:
    /home/pi/perl5/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/armv7l-linux
    /home/pi/perl5/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3
    /home/pi/perl5/perlbrew/perls/perl-5.20.3/lib/5.20.3/armv7l-linux
    /home/pi/perl5/perlbrew/perls/perl-5.20.3/lib/5.20.3


pi@raspberrypi:~ $ perl -V
Summary of my perl5 (revision 5 version 20 subversion 3) configuration:

  Platform:
    osname=linux, osvers=5.4.51-v7+, archname=armv7l-linux
    uname='linux raspberrypi 5.4.51-v7+ #1326 smp fri jul 17 10:45:25 bst 2020 armv7l gnulinux '
    config_args='-de -Dprefix=/home/pi/perl5/perlbrew/perls/perl-5.20.3 -Aeval:scriptdir=/home/pi/perl5/perlbrew/perls/perl-5.20.3/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='6.3.0 20170516', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/arm-linux-gnueabihf/6/include-fixed /usr/include/arm-linux-gnueabihf /usr/lib /lib/arm-linux-gnueabihf /lib /usr/lib/arm-linux-gnueabihf
    libs=-lpthread -lnsl -lgdbm -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.24.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.24'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'


Characteristics of this binary (from libperl):
  Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
                        PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
                        USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
                        USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO
                        USE_PERL_ATOF
  Locally applied patches:
        Devel::PatchPerl 1.90
  Built under linux
  Compiled at Sep 28 2020 14:10:21
  %ENV:
    PERL5LIB=""
    PERLBREW_LIB=""
    PERLBREW_MANPATH="/home/pi/perl5/perlbrew/perls/perl-5.20.3/man"
    PERLBREW_PATH="/home/pi/perl5/perlbrew/bin:/home/pi/perl5/perlbrew/perls/perl-5.20.3/bin"
    PERLBREW_PERL="perl-5.20.3"
    PERLBREW_ROOT="/home/pi/perl5/perlbrew"
    PERLBREW_SKIP_INIT="1"
    PERLBREW_VERSION="0.88"
    PERL_LOCAL_LIB_ROOT=""
  @INC:
    /home/pi/perl5/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/armv7l-linux
    /home/pi/perl5/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3
    /home/pi/perl5/perlbrew/perls/perl-5.20.3/lib/5.20.3/armv7l-linux
    /home/pi/perl5/perlbrew/perls/perl-5.20.3/lib/5.20.3
    .
pi@raspberrypi:~ $


reload des 60 Moduls ergab...
Can't locate XML/Simple.pm in @INC (you may need to install the XML::Simple module) (@INC contains: ./FHEM/lib ./lib ./FHEM . /opt/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/armv7l-linux /opt/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3 /opt/perlbrew/perls/perl-5.20.3/lib/5.20.3/armv7l-linux /opt/perlbrew/perls/perl-5.20.3/lib/5.20.3) at ./FHEM/60_allergy.pm line 26.
BEGIN failed--compilation aborted at ./FHEM/60_allergy.pm line 26.


das Modul xml:simple hatte ich aber ins 20.3 mit cpan XML::Simple hinzugefügt.

perlbrew list-modules
App::cpanminus
Date::Parse
Email::Date::Format
Email::Simple
Encode
Encode::Locale
ExtUtils::Config
ExtUtils::Helpers
ExtUtils::InstallPaths
File::Listing
HTML::Parser
HTML::Tagset
HTTP::Cookies
HTTP::Daemon
HTTP::Date
HTTP::Message
HTTP::Negotiate
IO::HTML
LWP::MediaTypes
Module::Build::Tiny
Net::HTTP
Test::Fatal
Test::LeakTrace
Test::Needs
Test::RequiresInternet
Time::Local
Try::Tiny
URI
WWW::RobotRules
XML::NamespaceSupport
XML::Parser
XML::SAX
XML::SAX::Base
XML::SAX::Expat
XML::Simple
libwww::perl

Titel: Antw:Cannot load module allergy
Beitrag von: en-trust am 29 September 2020, 16:56:24
Bin ratlos...
Ein reload des allergy.pm sagt...
Can't locate XML/Simple.pm in @INC (you may need to install the XML::Simple module) (@INC contains: ./FHEM/lib ./lib ./FHEM . /opt/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/armv7l-linux /opt/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3 /opt/perlbrew/perls/perl-5.20.3/lib/5.20.3/armv7l-linux /opt/perlbrew/perls/perl-5.20.3/lib/5.20.3) at ./FHEM/60_allergy.pm line 26.
BEGIN failed--compilation aborted at ./FHEM/60_allergy.pm line 26.


perl -V hingegen...
  @INC:
    /home/pi/perl5/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/armv7l-linux
    /home/pi/perl5/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3
    /home/pi/perl5/perlbrew/perls/perl-5.20.3/lib/5.20.3/armv7l-linux
    /home/pi/perl5/perlbrew/perls/perl-5.20.3/lib/5.20.3


perlbrew und xml_simple hab ich alles ohne sudo neu installiert. Aber irgendwie fehlt die Referenz zum genutzen perl.
Titel: Antw:Cannot load module allergy
Beitrag von: Christoph Morrison am 29 September 2020, 16:58:19
Du hast irgendwo eine Umgebungsvariable gesetzt (bekommen). Guck mal in .profile oder .bashrc.
Titel: Antw:Cannot load module allergy
Beitrag von: en-trust am 30 September 2020, 10:11:09
.profile
# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi


und in bashrc seh ich nichts Auffälliges.

Hat das gggf. noch was damit zu tun ?
ZitatDann noch /etc/init.d/fhem anpassen. Änderungen sind fett.

#!/bin/bash
# description: Start or stop the fhem server
# Added by Alex Peuchert

### BEGIN INIT INFO
# Provides:             fhem.pl
# Required-Start:       $local_fs $remote_fs
# Required-Stop:        $local_fs $remote_fs
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    FHEM server
### END INIT INFO

export PERLBREW_ROOT=/opt/perlbrew
source /opt/perlbrew/etc/bashrc
perlbrew use perl-5.20.3

Inhalt dieser /opt/perlbrew/etc/bashrc...
export PERLBREW_SHELLRC_VERSION=0.85
export PERLBREW_ROOT=/opt/perlbrew


__perlbrew_reinit() {
    if [[ ! -d "$PERLBREW_HOME" ]]; then
        mkdir -p "$PERLBREW_HOME"
    fi

    [ -f "$PERLBREW_HOME/init" ] && rm "$PERLBREW_HOME/init"
    echo '# DO NOT EDIT THIS FILE' > "$PERLBREW_HOME/init"
    command perlbrew env $1 | \grep PERLBREW_ >> "$PERLBREW_HOME/init"
    . "$PERLBREW_HOME/init"
    __perlbrew_set_path
}

__perlbrew_purify () {
    local path patharray outsep
    IFS=: read -r${BASH_VERSION+a}${ZSH_VERSION+A} patharray <<< "$1"
    for path in "${patharray[@]}" ; do
        case "$path" in
            (*"$PERLBREW_HOME"*) ;;
            (*"$PERLBREW_ROOT"*) ;;
            (*) printf '%s' "$outsep$path" ; outsep=: ;;
        esac
    done
}

__perlbrew_set_path () {
    export MANPATH=$PERLBREW_MANPATH${PERLBREW_MANPATH:+:}$(__perlbrew_purify "$(manpath 2>/dev/null)")
    export PATH=${PERLBREW_PATH:-$PERLBREW_ROOT/bin}:$(__perlbrew_purify "$PATH")
    hash -r
}

__perlbrew_set_env() {
    local code
    code="$($perlbrew_command env $@)" || return $?
    eval "$code"
}

__perlbrew_activate() {
    [[ -n $(alias perl 2>/dev/null) ]] && unalias perl 2>/dev/null

    if [[ -n "$PERLBREW_PERL" ]]; then
        __perlbrew_set_env "$PERLBREW_PERL${PERLBREW_LIB:+@}$PERLBREW_LIB"
    fi

    __perlbrew_set_path
}

__perlbrew_deactivate() {
    __perlbrew_set_env
    unset PERLBREW_PERL
    unset PERLBREW_LIB
    __perlbrew_set_path
}

perlbrew () {
    local exit_status
    local short_option
    export SHELL

    if [[ $1 == -* ]]; then
        short_option=$1
        shift
    else
        short_option=""
    fi

    case $1 in
        (use)
            if [[ -z "$2" ]] ; then
                echo -n "Currently using ${PERLBREW_PERL:-system perl}"
                [ -n "$PERLBREW_LIB" ] && echo -n "@$PERLBREW_LIB"
                echo
            else
                __perlbrew_set_env "$2" && { __perlbrew_set_path ; true ; }
                exit_status="$?"
            fi
            ;;

        (switch)
              if [[ -z "$2" ]] ; then
                  command perlbrew switch
              else
                  perlbrew use $2 && { __perlbrew_reinit $2 ; true ; }
                  exit_status=$?
              fi
              ;;

        (off)
            __perlbrew_deactivate
            echo "perlbrew is turned off."
            ;;

        (switch-off)
            __perlbrew_deactivate
            __perlbrew_reinit
            echo "perlbrew is switched off."
            ;;

        (*)
            command perlbrew $short_option "$@"
            exit_status=$?
            ;;
    esac
    hash -r
    return ${exit_status:-0}
}

[[ -z "$PERLBREW_ROOT" ]] && export PERLBREW_ROOT="$HOME/perl5/perlbrew"
[[ -z "$PERLBREW_HOME" ]] && export PERLBREW_HOME="$HOME/.perlbrew"

if [[ ! -n "$PERLBREW_SKIP_INIT" ]]; then
    if [[ -f "$PERLBREW_HOME/init" ]]; then
        . "$PERLBREW_HOME/init"
    fi
fi

perlbrew_bin_path="${PERLBREW_ROOT}/bin"
if [[ -f $perlbrew_bin_path/perlbrew ]]; then
    perlbrew_command="$perlbrew_bin_path/perlbrew"
else
    perlbrew_command="perlbrew"
fi
unset perlbrew_bin_path

__perlbrew_activate


Titel: Antw:Cannot load module allergy
Beitrag von: en-trust am 30 September 2020, 15:06:46
Habe die /etc/init.d/fhem jetzt auch mal geändert...

#!/bin/bash
# description: Start or stop the fhem server
# Added by Alex Peuchert

### BEGIN INIT INFO
# Provides:             fhem.pl
# Required-Start:       $local_fs $remote_fs
# Required-Stop:        $local_fs $remote_fs
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    FHEM server
### END INIT INFO

#export PERLBREW_ROOT=/opt/perlbrew
export PERLBREW_ROOT=/home/pi/perl5/perlbrew
#source /opt/perlbrew/etc/bashrc
source /home/pi/perl5/perlbrew/etc/bashrc
perlbrew switch perl-5.20.3


fhem zeigt beim reload aber immernoch...
Can't locate XML/Simple.pm in @INC (you may need to install the XML::Simple module) (@INC contains: ./FHEM/lib ./lib ./FHEM . /opt/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/armv7l-linux /opt/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3 /opt/perlbrew/perls/perl-5.20.3/lib/5.20.3/armv7l-linux /opt/perlbrew/perls/perl-5.20.3/lib/5.20.3) at ./FHEM/60_allergy.pm line 26.
BEGIN failed--compilation aborted at ./FHEM/60_allergy.pm line 26.
Titel: Antw:Cannot load module allergy
Beitrag von: en-trust am 13 Oktober 2020, 08:56:19
Nach langem suchen bin ich fündig geworden. Manchmal dauert es eben etwas länger. Ich musste einfach nur...

/opt/perlbrew/perls/perl-5.20.3/bin/cpan

...und dort dann sämtlich fehlende Module installieren. Dann klappte auch der reload...