Closed DNS closed 8 months ago
What python version are you running with?
@kralverde Python 3.9.18
Ah i see the issue; using "|" as a union type declaration is only valid 3.10+, could you try using that version for now?
Unfortunately, FreeBSD 14 only support Python 3.9 https://www.freshports.org/lang/python
Newer Python 3.10 & 3.11 are available, but seems broken (no pip, no base modules, no qt5 modules, etc).
from __future__ import annotations
Seems to fix the "|" issue on Python 3.9.
But another error when installing kawpow
module.
dns@fbsd14:~/Downloads/electrum-ravencoin-1.2.0 % pip-3.9 install kawpow
Defaulting to user installation because normal site-packages is not writeable
Collecting kawpow
Downloading kawpow-0.9.4.4.tar.gz (41 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.2/41.2 kB 6.9 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.9/site-packages (from kawpow) (1.16.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.9/site-packages (from cffi>=1.12->kawpow) (2.21)
Building wheels for collected packages: kawpow
Building wheel for kawpow (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for kawpow (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [61 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.freebsd-14.0-RELEASE-amd64-cpython-39
creating build/lib.freebsd-14.0-RELEASE-amd64-cpython-39/kawpow
copying bindings/python/kawpow/_build.py -> build/lib.freebsd-14.0-RELEASE-amd64-cpython-39/kawpow
copying bindings/python/kawpow/__init__.py -> build/lib.freebsd-14.0-RELEASE-amd64-cpython-39/kawpow
running build_ext
generating cffi module 'build/temp.freebsd-14.0-RELEASE-amd64-cpython-39/_kawpow.c'
creating build/temp.freebsd-14.0-RELEASE-amd64-cpython-39
-- [cable ] Cable 0.4.1 initialized
-- [cable ] Build type: Release
-- The C compiler identification is Clang 16.0.6
-- The CXX compiler identification is Clang 16.0.6
-- 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
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test fstack-protector
-- Performing Test fstack-protector - Success
-- Performing Test Wimplicit-fallthrough
-- Performing Test Wimplicit-fallthrough - Success
-- Performing Test mtune=generic
-- Performing Test mtune=generic - Success
-- Configuring done (0.9s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/pip-install-lbdy60gx/kawpow_a36bbe7684de4bff9d6a4edab5d4335a/build/temp.freebsd-14.0-RELEASE-amd64-cpython-39
[ 11%] Building C object lib/keccak/CMakeFiles/keccak.dir/keccak.c.o
[ 22%] Building C object lib/keccak/CMakeFiles/keccak.dir/keccakf800.c.o
[ 33%] Building C object lib/keccak/CMakeFiles/keccak.dir/keccakf1600.c.o
[ 44%] Linking C static library libkeccak.a
[ 44%] Built target keccak
[ 55%] Building CXX object lib/kawpow/CMakeFiles/kawpow.dir/kawpow.cpp.o
In file included from /tmp/pip-install-lbdy60gx/kawpow_a36bbe7684de4bff9d6a4edab5d4335a/lib/kawpow/kawpow.cpp:5:
In file included from /tmp/pip-install-lbdy60gx/kawpow_a36bbe7684de4bff9d6a4edab5d4335a/lib/kawpow/kawpow-internal.hpp:13:
/tmp/pip-install-lbdy60gx/kawpow_a36bbe7684de4bff9d6a4edab5d4335a/lib/kawpow/endianness.hpp:39:9: error: 'bswap32' macro redefined [-Werror,-Wmacro-redefined]
#define bswap32 __builtin_bswap32
^
/usr/include/sys/endian.h:66:9: note: previous definition is here
#define bswap32(x) __bswap32(x)
^
In file included from /tmp/pip-install-lbdy60gx/kawpow_a36bbe7684de4bff9d6a4edab5d4335a/lib/kawpow/kawpow.cpp:5:
In file included from /tmp/pip-install-lbdy60gx/kawpow_a36bbe7684de4bff9d6a4edab5d4335a/lib/kawpow/kawpow-internal.hpp:13:
/tmp/pip-install-lbdy60gx/kawpow_a36bbe7684de4bff9d6a4edab5d4335a/lib/kawpow/endianness.hpp:40:9: error: 'bswap64' macro redefined [-Werror,-Wmacro-redefined]
#define bswap64 __builtin_bswap64
^
/usr/include/sys/endian.h:67:9: note: previous definition is here
#define bswap64(x) __bswap64(x)
^
2 errors generated.
gmake[2]: *** [lib/kawpow/CMakeFiles/kawpow.dir/build.make:76: lib/kawpow/CMakeFiles/kawpow.dir/kawpow.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:157: lib/kawpow/CMakeFiles/kawpow.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
error: cmake build failed with exit status 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for kawpow
Failed to build kawpow
ERROR: Could not build wheels for kawpow, which is required to install pyproject.toml-based projects
WARNING: There was an error checking the latest version of pip.
dns@fbsd14:~/Downloads/electrum-ravencoin-1.2.0 %
Hmm, I'll need to look into this more. Would the prebuilt app image work on freebsd?
The kawpow compilation error looks like a redefinition of something that is already named in FreeBSD's std lib. I think a fix to that will require tinkering with the kawpow wheel source. Should be as simple as renaming those swap functions or adding a guard and you can then just pip install .
from the repo. The git repo the pypi links to is different from the source, so you'd need to download the raw source from pypi and edit it from there.
Hmm, I'll need to look into this more. Would the prebuilt app image work on freebsd?
I never use AppImage on FreeBSD. I think that's a Linux thing.
#else
#include <endian.h>
//#define bswap32 __builtin_bswap32
//#define bswap64 __builtin_bswap64
#endif
Removing #define on endianness.hpp works to build kawpow. But other error occurred.
dns@fbsd14:~/Downloads/electrum-ravencoin-1.2.0 % ./run_electrum
Traceback (most recent call last):
File "/home/dns/Downloads/electrum-ravencoin-1.2.0/./run_electrum", line 94, in <module>
from electrum.logging import get_logger, configure_logging # import logging submodule first
File "/home/dns/Downloads/electrum-ravencoin-1.2.0/electrum/__init__.py", line 20, in <module>
from .wallet import Wallet
File "/home/dns/Downloads/electrum-ravencoin-1.2.0/electrum/wallet.py", line 76, in <module>
from .ipfs_db import IPFSDB
File "/home/dns/Downloads/electrum-ravencoin-1.2.0/electrum/ipfs_db.py", line 23, in <module>
from .network import Network
File "/home/dns/Downloads/electrum-ravencoin-1.2.0/electrum/network.py", line 55, in <module>
from . import blockchain
File "/home/dns/Downloads/electrum-ravencoin-1.2.0/electrum/blockchain.py", line 38, in <module>
import kawpow
File "/usr/local/lib/python3.9/site-packages/kawpow-0.9.4.4-py3.9-freebsd-14.0-RELEASE-amd64.egg/kawpow/__init__.py", line 5, in <module>
from _kawpow import ffi, lib
ImportError: /usr/local/lib/python3.9/site-packages/kawpow-0.9.4.4-py3.9-freebsd-14.0-RELEASE-amd64.egg/_kawpow.abi3.so: Undefined symbol "__gxx_personality_v0"
dns@fbsd14:~/Downloads/electrum-ravencoin-1.2.0 %
According to https://stackoverflow.com/questions/203548/undefined-symbol-gxx-personality-v0-on-link it's caused by cmake build using Clang C compiler rather than C++ compiler. I'm gonna investigate to this issue next year.
I'm able to build on FreeBSD 14.
It's easier to use GCC rather than Clang, because Clang doesn't define __builtin_bswap*
macro.
Electrum-RVN, and Kawpow source code still need to be modified. Kawpow need to be build manually (pip won't work), caused by _build.py only recognize linux but not other OS.
Electrum-RVN [EDIT] electrum-ravencoin-1.2.0/electrum/verifier.py [EDIT] electrum-ravencoin-1.2.0/electrum/wallet_db.py
from __future__ import annotations
Kawpow [EDIT] kawpow-0.9.4.4/bindings/python/kawpow/_build.py
if sys.platform == 'linux':
stdlib.append('stdc++')
else:
stdlib.append('stdc++')
Build commands (using csh):
setenv CC /usr/local/bin/gcc
setenv CXX /usr/local/bin/g++
setenv AR /usr/local/bin/ar
setenv LD /usr/local/bin/ld
setenv LINKER /usr/local/bin/ld
setenv NM /usr/local/bin/nm
setenv OBJDUMP /usr/local/bin/objdump
setenv RANLIB /usr/local/bin/ranlib
pkg install -y py39-aiohttp-socks py39-aiohttp py39-aiorpcX py39-attrs py39-bitstring py39-certifi py39-dnspython py39-httplib2 py39-jsonrpclib-pelix py39-pbkdf2 py39-protobuf py39-QDarkStyle py39-qrcode py39-requests py39-secp256k1 py39-sqlite3 py39-bitbox02 py39-btchip-python py39-ckcc-protocol py39-hidapi py39-keepkey py39-trezor py39-cryptography py39-setuptools py39-qt5-pyqt py39-sip py39-cython py39-aiofiles
pip-3.9 install -y multiformats aioipfs ipfs-car-decoder kawpow
cd kawpow-0.9.4.4
pip-3.9 uninstall -y kawpow; python3.9 setup.py clean; rm -rf build/*, dist/*; python3.9 setup.py install --verbose
cd ..
cd electrum-ravencoin-1.2.0
./run_electrum
@kralverde Do you know where Kawpow repository?
https://github.com/RavenCommunity/cpp-kawpow/tree/kawpow_full_cache seems doesn't have bindings/python/kawpow/_build.py
The easiest thing to do is probably fork all of these repos and make changes as needed. I will do this for the next update and follow up to make sure everything works for you
can you confirm that the master branch works for you as-is?
kawpow master branch? The kawpow repo is nowhere to be found on github. Only on pypi. I think it's unmaintained.
https://github.com/RavenCommunity/cpp-kawpow/blob/master/bindings/python/ethash/_build.py
There's no /bindings/python/kawpow/_build.py
to be found.
Btw, I've created https://github.com/DNS/kawpow
No, I've made modifications to electrum-ravencoin and it should work for freebsd as-is now
And the repo it is using is https://github.com/kralverde/cpp-kawpow
And the repo it is using is https://github.com/kralverde/cpp-kawpow
https://github.com/kralverde/cpp-kawpow/blob/master/bindings/python/kawpow/_build.py
if sys.platform in ('linux', 'freebsd', 'openbsd'):
stdlib.append('stdc++')
Oh, ok.
But sys.platform
on my freebsd installation contain 'freebsd14'
so it wont match.
dns@fbsd14:~ % python3.9
Python 3.9.18 (main, Nov 30 2023, 01:13:45)
[Clang 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1 on freebsd14
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.platform
'freebsd14'
>>>
Probably better to match the string using regex or fnmatch.
import re, sys
os_match = re.match(r'.*bsd.*', sys.platform, re.IGNORECASE)
if sys.platform == 'linux':
stdlib.append('stdc++')
elif os_match:
stdlib.append('stdc++')
This would match freebsd/openbsd/netbsd followed by their version number.
or unify linux/bsd in regex together:
import re, sys
os_match = re.match(r'linux|.*bsd.*', sys.platform, re.IGNORECASE)
if os_match:
stdlib.append('stdc++')
That sounds good. Want to make a PR and I'll just merge it? I'm out right now.
Pull request https://github.com/kralverde/cpp-kawpow/pull/1
Electrum-Ravencoin Version: 1.2.0 FreeBSD 14.0
Spesmilo Electrum run fine on FreeBSD https://github.com/spesmilo/electrum/archive/refs/tags/4.4.6.tar.gz