Author

Topic: Trouble Compiling Windows Binaries (Read 309 times)

HCP
legendary
Activity: 2086
Merit: 4361
February 21, 2020, 05:06:27 PM
#17
Thanks.  Could you share the .dll or I guess this is probably not recommended as required trust that it is not malicious?
Of course I can share it... http://www.mediafire.com/file/g51c9e0wt39axt3/libsecp256k1-0.dll/file

But as you rightly point out, it does require that you trust that this file is not malicious. All I did was run the script from the Electrum github, which appears to clone the "secp256k1" git repository from Bitcoin Core and then compile it for your chosen platform.


SCARY WARNING: For the record, I accept no responsibility if you choose to use this file. I have not extensively tested it... USE AT YOUR OWN RISK.
newbie
Activity: 18
Merit: 11
February 21, 2020, 04:48:32 PM
#16
I see you got a response and closed the issue... but I can't see to make it work with the instructions given. I've posted on the github issue, but not sure if "closed" issues get notifications or not:

I added in the .dll as specified and it still doesn't work, so I hacked some debug into the ecc_fast.py file (where it attempts to load the .dll) and I get this:
Quote
E:\electrum-master>C:\Users\HCP\AppData\Local\Programs\Python\Python38\python.exe run_electrum
C:\Users\HCP\AppData\Local\Programs\Python\Python38\lib\site-packages\aiohttp\helpers.py:107: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
  def noop(*args, **kwargs):  # type: ignore
E | ecc_fast | LibPath: E:\electrum-master\electrum\libsecp256k1-0.dll
WARNING: [WinError 193] %1 is not a valid Win32 application
E | ecc_fast | LibPath: libsecp256k1-0.dll
WARNING: [WinError 193] %1 is not a valid Win32 application
E | ecc_fast | libsecp256k1 library failed to load
Error: Failed to load libsecp256k1.

E:\electrum-master>

So, I'm not sure the .dll is being created properly...



EDIT: Turns out I didn't have the correct compiler installed on the Ubuntu VM (that build-wine docker container that you use for generating the Windows installers has a lot of extra stuff I guess!)

Code:
sudo apt-get install gcc-mingw-w64

Is required for the "GNU C compiler for MinGW-w64"... which is what is required to generate the 64bit Windows DLL. Once I had that installed, I used the:
Code:
GCC_TRIPLET_HOST="x86_64-w64-mingw32" ./contrib/make_libsecp256k1.sh
and it generated the correct .dll

I copied that over to the Windows box, putting it in my "inner electrum" directory... and then Electrum starts up from the Python sources just fine!

Thanks.  Could you share the .dll or I guess this is probably not recommended as required trust that it is not malicious?
HCP
legendary
Activity: 2086
Merit: 4361
February 21, 2020, 02:15:39 AM
#15
I see you got a response and closed the issue... but I can't see to make it work with the instructions given. I've posted on the github issue, but not sure if "closed" issues get notifications or not:

I added in the .dll as specified and it still doesn't work, so I hacked some debug into the ecc_fast.py file (where it attempts to load the .dll) and I get this:
Quote
E:\electrum-master>C:\Users\HCP\AppData\Local\Programs\Python\Python38\python.exe run_electrum
C:\Users\HCP\AppData\Local\Programs\Python\Python38\lib\site-packages\aiohttp\helpers.py:107: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
  def noop(*args, **kwargs):  # type: ignore
E | ecc_fast | LibPath: E:\electrum-master\electrum\libsecp256k1-0.dll
WARNING: [WinError 193] %1 is not a valid Win32 application
E | ecc_fast | LibPath: libsecp256k1-0.dll
WARNING: [WinError 193] %1 is not a valid Win32 application
E | ecc_fast | libsecp256k1 library failed to load
Error: Failed to load libsecp256k1.

E:\electrum-master>

So, I'm not sure the .dll is being created properly...



EDIT: Turns out I didn't have the correct compiler installed on the Ubuntu VM (that build-wine docker container that you use for generating the Windows installers has a lot of extra stuff I guess!)

Code:
sudo apt-get install gcc-mingw-w64

Is required for the "GNU C compiler for MinGW-w64"... which is what is required to generate the 64bit Windows DLL. Once I had that installed, I used the:
Code:
GCC_TRIPLET_HOST="x86_64-w64-mingw32" ./contrib/make_libsecp256k1.sh
and it generated the correct .dll

I copied that over to the Windows box, putting it in my "inner electrum" directory... and then Electrum starts up from the Python sources just fine!
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
February 20, 2020, 10:59:00 PM
#14
I suspect that this PR was the cause of the issue: make libsecp256k1 a mandatory dependency #5947
The commits' date and time are just about right.

Python 3.6.1 also didn't worked so it mustn't be the Python version, Electrum can't just load 'libsecp256k1'.

I have created a new issue as you suggested: Latest Electrum 4.0.0a0 build wont launch on Python #5976
newbie
Activity: 18
Merit: 11
February 20, 2020, 10:20:02 PM
#13
I'm currently checking for a few possible solutions before deciding to post it as an issue
like trying it to other python versions, etc. since there're a few major changes in python 3.8.

Also for more initial info.
Ok thanks.  If you could please keep us updated here if/when you find a solution, that'd be greatly appreciated.
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
February 20, 2020, 10:18:03 PM
#12
I'm currently checking for a few possible solutions before deciding to post it as an issue
like trying it to other python versions, etc. since there're a few major changes in python 3.8.

Also for more initial info.
newbie
Activity: 18
Merit: 11
February 20, 2020, 10:12:29 PM
#11
Many thanks for these steps, they are VERY helpful !

I get an error message "Error: Failed to load libsecp256k1" when I "python electrum-master/run_electrum".  I searched for a solution but the ones on GitHub are all Linux specific and I can't find a (reliable) one for Windows.  
Thoughts ?
I also got that from installing the current build, there must be something added to the code that caused that issue.
The last dev version that worked for me was the one I've downloaded last February 10.

The error still persists even after successfully installing libsecp256k1 through:
Code:
python -m pip install libsecp256k1

Should an issue be created on GitHub then ?
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
February 20, 2020, 09:36:00 PM
#10
Many thanks for these steps, they are VERY helpful !

I get an error message "Error: Failed to load libsecp256k1" when I "python electrum-master/run_electrum".  I searched for a solution but the ones on GitHub are all Linux specific and I can't find a (reliable) one for Windows.  
Thoughts ?
I also got that from installing the current build, there must be something added to the code that caused that issue.
The last dev version that worked for me was the one I've downloaded last February 10.

The error still persists even after successfully installing libsecp256k1 through:
Code:
python -m pip install libsecp256k1
newbie
Activity: 18
Merit: 11
February 20, 2020, 08:31:30 PM
#9
Weird It should be work on Windows 10 both HCP and nc50lc also use Windows 10 but they never got this error.
I didn't compiled the binaries, I directly installed and ran "run_electrum" through Python v3.8 with the pre-requisites.

You can follow the guide in Github with some modifications.
1. Download Python 3.8 installer for Windows: https://www.python.org/downloads/release/python-380/.
2. Download Electrum from Github as ZIP, extract it (electrum-master) and paste inside python38 folder (for easy access).
3. Open a command prompt inside python38 folder (where python.exe was installed) using "Shift->Right Click->Open command window here".
4. In the console, enter these (requires internet):
Code:
python -m pip install --upgrade pip
To upgrade pip module to the latest version.
Code:
python -m pip install pyqt5
Code:
python -m pip install setuptools
Probably pre-installed
Code:
python -m pip install electrum-master/
Needs to be the same folder name as your extracted electrum-master.zip and including the slash "/" at the end.

5. To launch electrum, enter:
Code:
python electrum-master/run_electrum
And wait for a few minutes for the first launch, a few seconds if it was launched before.

You can create a .bat file with #5 to easily launch Electrum using double-click.
Create a new text file in python folder, paste the code from step 5, save; then rename the extension ".txt" into ".bat".
Create a shortcut of the bat file and name it "Electrum 4.0.0a0".

Many thanks for these steps, they are VERY helpful !

I get an error message "Error: Failed to load libsecp256k1" when I "python electrum-master/run_electrum".  I searched for a solution but the ones on GitHub are all Linux specific and I can't find a (reliable) one for Windows. 
Thoughts ?
copper member
Activity: 2338
Merit: 4543
Join the world-leading crypto sportsbook NOW!
February 10, 2020, 10:48:10 PM
#8
For what it's worth... I suspect that this is the issue:
[image]

 Shocked There goes my opsec!  Roll Eyes

If onedrive had anything to do with it, it's not an issue now.  I'm able to run the binaries from the same directory.  Something I did in Ubuntu seemed to make the difference, but I can't point to a specific thing.  I suppose I could try to duplicate the issue, but now that I have the software working I lack the motivation.

Ubuntu and I have a love-hate relationship.  I like tinkering with the OS, but when I actually want it to serve a purpose it can be a real bitch.  And just to be clear, I'm not ruling out operator error.
HCP
legendary
Activity: 2086
Merit: 4361
February 10, 2020, 03:47:14 PM
#7
I've tried it twice, the second time making sure to install all the required tools before running the commands to compile the binaries.  I can run Electrum in the Ubuntu environment, but the Windows binaries give me the following errors.  I'm mostly interested in the portable version, but all three binary files result with the same errors:
For what it's worth... I suspect that this is the issue:


I've had a lot of issues with other apps when attempting to run/use files directly from a "OneDrive" folder... Roll Eyes


Currently, I am using a VM shared folder... and set that up in my "home" directory within the Ubuntu VM. I manually copy the .exe's from the /dist directory after they are compiled to this shared folder and then run them in the Windows host from that folder.
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
February 09, 2020, 10:55:29 PM
#6
Weird It should be work on Windows 10 both HCP and nc50lc also use Windows 10 but they never got this error.
I didn't compiled the binaries, I directly installed and ran "run_electrum" through Python v3.8 with the pre-requisites.

You can follow the guide in Github with some modifications.
1. Download Python 3.8 installer for Windows: https://www.python.org/downloads/release/python-380/.
2. Download Electrum from Github as ZIP, extract it (electrum-master) and paste inside python38 folder (for easy access).
3. Open a command prompt inside python38 folder (where python.exe was installed) using "Shift->Right Click->Open command window here".
4. In the console, enter these (requires internet):
Code:
python -m pip install --upgrade pip
To upgrade pip module to the latest version.
Code:
python -m pip install pyqt5
Code:
python -m pip install setuptools
Probably pre-installed
Code:
python -m pip install electrum-master/
Needs to be the same folder name as your extracted electrum-master.zip and including the slash "/" at the end.

5. To launch electrum, enter:
Code:
python electrum-master/run_electrum
And wait for a few minutes for the first launch, a few seconds if it was launched before.

You can create a .bat file with #5 to easily launch Electrum using double-click.
Create a new text file in python folder, paste the code from step 5, save; then rename the extension ".txt" into ".bat".
Create a shortcut of the bat file and name it "Electrum 4.0.0a0".
copper member
Activity: 2338
Merit: 4543
Join the world-leading crypto sportsbook NOW!
February 09, 2020, 02:45:21 PM
#5
I wish I knew exactly how, but I got it to work.   Huh

On the VM I deleted the electrum directory, and compiled the code again.  I had restarted the Virtual Box, maybe that has something to do with it.  I also used sudo commands in the Terminal to copy the dist directory to the USB drive, instead of what I had done previously; use Nautilus in default mode.

Anyway, now I'm in business.

legendary
Activity: 3374
Merit: 3095
Playbet.io - Crypto Casino and Sportsbook
February 09, 2020, 02:31:44 PM
#4
Weird It should be work on Windows 10 both HCP and nc50lc also use Windows 10 but they never got this error.

What version of Windows 10 you currently using? You might need to update it to the latest version.

How about try to rename it then cut and paste it to another folder or desktop then try again?
Or try to change the compatibility to Windows 7 or 8 just test it and lets if it will work.


If not share the compiled version to me through PM in RAR file I can test it on VirtualBox.
copper member
Activity: 2338
Merit: 4543
Join the world-leading crypto sportsbook NOW!
February 09, 2020, 01:02:36 PM
#3
@BitMaxz, thanks for the response.  I had already tried scanning the executable, but Windows Defender didn't find any threats.  I added the executable to the exceptions anyway, but the issue persists.

I tried to start the program using powershell, hoping to get more information, and I got this error:

Code:
Program 'electrum-3.3.8-1481-g7bd29ed8f-portable.exe' failed to run: The specified executable is not a valid
application for this OS platform.At line:1 char:1
+ C:\Users\DireWolfM14\Desktop\dist\electrum-3.3.8-1481-g7bd29ed8f-p ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
At line:1 char:1
+ C:\Users\DireWolfM14\Desktop\dist\electrum-3.3.8-1481-g7bd29ed8f-p ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed


Trying with admin privileges:

Code:
.\C:\Users\DireWolfM14\Desktop\dist\electrum-3.3.8-1481-g7bd29ed8f-portable.exe : The term
'.\C:\Users\DireWolfM14\Desktop\dist\electrum-3.3.8-1481-g7bd29ed8f-portable.exe' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that
the path is correct and try again.
At line:1 char:1
+ .\C:\Users\DireWolfM14\Desktop\dist\electrum-3.3.8-1481-g7bd29ed8f ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (.\C:\Users\Dire...8f-portable.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I didn't mess with the signatures after compiling the binaries, so the check sums are certain to be unverifiable.  Would that prevent the program from starting?
legendary
Activity: 3374
Merit: 3095
Playbet.io - Crypto Casino and Sportsbook
February 08, 2020, 05:45:09 PM
#2
Try to whitelist it on Windows Defender and let see if it will work.
Windows defender might be detected as malware so whitelisting it might help.

This one same issue as yours when trying to open Electrum "Windows cannot find: error while opening Electrum"

You can try to follow the solution under that link.

I have a copy of the alpha version of Electrum compiled by HCP a few days ago and it's working fine if you want I can share it with you through pm(To test if your compiled Electrum is broken while building.)
copper member
Activity: 2338
Merit: 4543
Join the world-leading crypto sportsbook NOW!
February 08, 2020, 02:41:15 PM
#1
Hello all,
I want to play with Electrum 4.0.0a0, the alpha version of their new wallet with lightning capabilities.  So, I've been trying to compile the windows binary files using a VirtualBox running Ubuntu 18.04.3.  I installed the minimal OS version on a 32GB hard drive, gave it 2 cores and 4GB of ram.

To compile the binaries I pretty much copied and pasted the terminal commands from here, and here.

I've tried it twice, the second time making sure to install all the required tools before running the commands to compile the binaries.  I can run Electrum in the Ubuntu environment, but the Windows binaries give me the following errors.  I'm mostly interested in the portable version, but all three binary files result with the same errors:

Double click the binary:


Try to run it as administrator:


The file properties seem normal:


All the comands I used to install the required tools:
Code:
sudo apt update
sudo apt-get update
sudo apt install git
sudo apt-get install python3
sudo apt-get install python3-pyqt5
sudo apt-get install python3-setuptools
sudo apt-get install python3-pip
sudo apt-get install curl
sudo apt-get install protobuf-compiler
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce

The commands I used to compile the binaries:
Code:
git clone git://github.com/spesmilo/electrum.git
cd electrum
git submodule update --init
python3 -m pip install .[fast]
protoc --proto_path=electrum --python_out=electrum electrum/paymentrequest.proto
sudo docker build -t electrum-wine-builder-img contrib/build-wine
FRESH_CLONE=contrib/build-wine/fresh_clone && \
    sudo rm -rf $FRESH_CLONE && \
    mkdir -p $FRESH_CLONE && \
    cd $FRESH_CLONE  && \
    git clone https://github.com/spesmilo/electrum.git && \
    cd electrum
git checkout $REV
sudo docker run -it \
    --name electrum-wine-builder-cont \
    -v $PWD:/opt/wine64/drive_c/electrum \
    --rm \
    --workdir /opt/wine64/drive_c/electrum/contrib/build-wine \
    electrum-wine-builder-img \
    ./build.sh

Any help would be much appreciated.
Jump to: