hoehermann / purple-gowhatsapp

Pidgin/libpurple plug-in for WhatsApp Web.
GNU General Public License v3.0
289 stars 34 forks source link

build error - Linux Mint 20.3 #192

Closed kszwaba closed 7 months ago

kszwaba commented 8 months ago

I downloaded the latest purple-gowhatsapp snapshoot from github I get an error when trying to compile with command cmake . .

~/git/purple-gowhatsapp-whatsmeow/build$ cmake ..

CMake Error at CMakeLists.txt:25 (find_package):

  By not providing "FindPurple.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Purple", but
  CMake did not find one.

  Could not find a package configuration file provided by "Purple" with any
  of the following names:

    PurpleConfig.cmake
    purple-config.cmake

  Add the installation prefix of "Purple" to CMAKE_PREFIX_PATH or set
  "Purple_DIR" to a directory containing one of the above files.  If "Purple"
  provides a separate development package or SDK, be sure it has been
  installed.

My OS is: NAME="Linux Mint" VERSION="20.3 (Una)"

Package: pidgin-dev Version: 1:2.13.0-2.2ubuntu4 Package: pidgin Version: 1:2.13.0-2.2ubuntu4 Package: golang Version: 2:1.13~1ubuntu2 Package: golang-go Version: 2:1.13~1ubuntu2 Package: libpurple-bin Version: 1:2.13.0-2.2ubuntu4 Package: libpurple-dev Version: 1:2.13.0-2.2ubuntu4 CMakeOutput.log

Nardol commented 8 months ago

I downloaded the latest purple-gowhatsapp snapshoot from github I get an error when trying to compile with command cmake . .

What do you mean exactly?

~/git/purple-gowhatsapp-whatsmeow/build$ cmake ..

CMake Error at CMakeLists.txt:25 (find_package):

By not providing "FindPurple.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Purple", but CMake did not find one.

Could not find a package configuration file provided by "Purple" with any of the following names:

PurpleConfig.cmake
purple-config.cmake

It looks the purple-cmake git submodule is missing.

Maybe git submodule update --init in the source directory could help?

kszwaba commented 8 months ago

Howto pull submodule to my git repository ? after applying /usr/src/git# git submodule update --init nothing was changed /usr/src/git/.git# cat /usr/src/git/.git/config

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
kszwaba commented 8 months ago

What do you mean exactly

/usr/src/git# git clone https://github.com/hoehermann/purple-gowhatsapp/ purple-gowhatsapp

kszwaba commented 8 months ago

O.K. I apply: git clone https://github.com/hoehermann/purple-gowhatsapp/ purple-cmake cd purple-cmake usr/src/git/purple-cmake# git submodule update --init

Module has been registered

Zarejestrowano podmoduł „submodules/purple-cmake” (https://github.com/hoehermann/purple-cmake-template) w „submodules/purple-cmake”
Klonowanie do „/usr/src/git/purple-cmake/submodules/purple-cmake”...
Ścieżka podmodułu „submodules/purple-cmake”: wybrano „efd162171d7fdf2cdc25702b14a356e7983802b4”

/usr/src/git/purple-cmake/build# cmake ..

-- The C compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking for module 'gdk-pixbuf-2.0'
--   Found gdk-pixbuf-2.0, version 2.40.0
-- Checking for module 'opusfile'
--   Found opusfile, version 0.9+20170913
-- Checking for module 'purple'
--   Found purple, version 2.13.0
-- PURPLE_INCLUDE_DIRS: /usr/include/libpurple;/usr/include/glib-2.0;/usr/lib/x86_64-linux-gnu/glib-2.0/include
-- PURPLE_LIBRARY_DIRS: /usr/lib;/usr/lib/x86_64-linux-gnu
-- PURPLE_LIBRARIES: purple;glib-2.0
-- PURPLE_PLUGIN_DIR: /usr/lib/purple-2
-- PURPLE_DATA_DIR: /usr/share
-- PIXBUF_INCLUDE_DIRS: /usr/include/gdk-pixbuf-2.0;/usr/include/libmount;/usr/include/blkid;/usr/include/glib-2.0;/usr/lib/x86_64-linux-gnu/glib-2.0/include
-- OPUSFILE_INCLUDE_DIRS: /usr/include/opus
-- OPUSFILE_LINK_LIBRARIES: /usr/lib/libopusfile.so
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/src/git/purple-cmake/build

but after apply: /usr/src/git/purple-cmake/build# cmake --build . there is another problem ...

[  4%] Building C object src/go/CMakeFiles/purple-dummy.dir/purple-dummy.c.o
[  8%] Building C object src/go/CMakeFiles/purple-dummy.dir/__/c/constants.c.o
[ 12%] Linking C static library libpurple-dummy.a
[ 12%] Built target purple-dummy
[ 16%] Updating go modules...
go: finding go.mau.fi/whatsmeow latest
github.com/hoehermann/purple-gowhatsapp/src/go imports
    go.mau.fi/whatsmeow/binary/proto imports
    embed: malformed module path "embed": missing dot in first path element
github.com/hoehermann/purple-gowhatsapp/src/go imports
    golang.org/x/net/http2 imports
    io/fs: malformed module path "io/fs": missing dot in first path element
github.com/hoehermann/purple-gowhatsapp/src/go imports
    go.mau.fi/whatsmeow imports
    golang.org/x/crypto/curve25519 imports
    crypto/ecdh: malformed module path "crypto/ecdh": missing dot in first path element
make[2]: *** [src/go/CMakeFiles/purple-go-whatsapp.dir/build.make:97: /usr/src/git/purple-cmake/src/go/go.mod] Błąd 1
make[2]: *** Kasuję plik '/usr/src/git/purple-cmake/src/go/go.mod'
make[1]: *** [CMakeFiles/Makefile2:197: src/go/CMakeFiles/purple-go-whatsapp.dir/all] Błąd 2
make: *** [Makefile:156: all] Błąd 2
Nardol commented 8 months ago

Have you read and followed exactly steps provided in the repository? Because when you cloned this repository (the one this issue is on) you cd to the directory when it is cloned, then git submodule update --init should clone the submodule repository.

Then you can build.

hoehermann commented 8 months ago

Hi @kszwaba, thank you for the report and @Nardol for offering assistance. Well done.

malformed module path "embed": missing dot in first path element

I think I saw this with an old version of the go compiler. This project needs at least go 1.20. Please check with go version.

kszwaba commented 8 months ago

Sulution for compile:

sudo apt remove golang* sudo add-apt-repository ppa:longsleep/golang-backports sudo apt update sudo apt install golang-1.21* # export PATH=$PATH:/usr/lib/go-1.21/bin

/usr/src/git/purple-cmake/build# go version

go version go1.21.7 linux/amd64

make clean cmake --build . compilation.log

kszwaba commented 8 months ago

Another problem after running pidgin with compiled module libwhatsmeow.so :( : pidgin --debug

plugins: probing /home/kszwaba/.purple/plugins/libwhatsmeow.so
plugins: /home/kszwaba/.purple/plugins/libwhatsmeow.so is not loadable: undefined symbol: g_memdup2

$ apt show libglib2.0-0

Package: libglib2.0-0
Version: 2.64.6-1~ubuntu20.04.6
Nardol commented 8 months ago

I think your version of glib2 is too old, g_memdup2 requires version 2.68 or higher if I remember correctly.

kszwaba commented 8 months ago

Is it possible to make "purple-gowhatsapp" backwards compatible with Ubuntu 20.04/Mint 20.3 with libglib2-2.64 or sharing on github the latest version compatible with these distros ?

hoehermann commented 8 months ago

Actually, it should be compatible. I used it on Ubuntu 18.04 just a couple of weeks ago. In the code, there is a switch which detects the availability of g_memdup2 and falls back to g_memdup if necessary. In fact, the win32 releases are built against glib 2.24.2.

Could it be that on your system, CMake detects a recent version of glib and puts it in the include path, but then an older version is used when executing the program?

hoehermann commented 7 months ago

Closing due to lack of response. In case new information is available, feel free to re-open this issue.