LysanderGG / Simple-XMR-Miner

MIT License
13 stars 5 forks source link

OSError: cryptonight_lib/project/Release/cryptonight_lib.dll: cannot open shared object file #3

Closed 0xIslamTaha closed 6 years ago

0xIslamTaha commented 6 years ago
➜  Simple-XMR-Miner git:(master) ✗ python3 ggminer.py -h
Traceback (most recent call last):
  File "ggminer.py", line 7, in <module>
    from Miner import *
  File "/home/islamtaha/PycharmProjects/minerTools/Simple-XMR-Miner/Miner.py", line 3, in <module>
    from Cryptonight import SubscriptionCryptonight
  File "/home/islamtaha/PycharmProjects/minerTools/Simple-XMR-Miner/Cryptonight.py", line 66, in <module>
    lib = ctypes.cdll.LoadLibrary('cryptonight_lib/project/Release/cryptonight_lib.dll')
  File "/usr/lib/python3.5/ctypes/__init__.py", line 425, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib/python3.5/ctypes/__init__.py", line 347, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: cryptonight_lib/project/Release/cryptonight_lib.dll: cannot open shared object file: No such file or directory

I cloned the repo and tried to run it but It threw this error. It would be nice if u can help

OS ubuntu 16.04

aristide1997 commented 6 years ago

I'm having the same problem. The directory that is trying to be accessed doesn't exist (project directory). Also, there is no cryptonight_lib.dll.

LysanderGG commented 6 years ago

You must first build https://github.com/LysanderGG/Simple-XMR-Miner/tree/master/cryptonight_lib There is a CMake file.

If you are on Ubuntu you will probably need to replace the cryptonight_lib.dll by cryptonight_lib.so in the python script.

I will review the build process and document it as it is indeed not documented at all at the moment.

0xIslamTaha commented 6 years ago

@LysanderGG Thanks for fast reply. This is a nice project. Is that possible to make it pure python or to do a static build for this library?

LysanderGG commented 6 years ago

Pure python would be pretty long to implement and pretty slow, the current C library is taken from another project. Static library would be possible with a Python Extension (https://docs.python.org/2/extending/extending.html).

Did you succeed in building the .so?

0xIslamTaha commented 6 years ago

I'm trying to update my cmake right now once I do it, I will update you.

I found an issue in the nightminer script, as it gonna hanging after couple of minutes. Did u face the same issue? and if yes, Did u find a solution to it?

LysanderGG commented 6 years ago

Not after a couple of minutes but I have a deconnection (exception) after few hours or days sometimes. Do you know where it is hanging? Have an exception message?

0xIslamTaha commented 6 years ago

@LysanderGG I didnt get anything, no error nor exceptions Its only stop printing the hash rate messages. btw, I'm using Python 2.7.12

here is the issue: https://github.com/ricmoo/nightminer/issues/8

If u dont mind, do u get a nice hash rate using your tool or using nighminer one? As I got ~2KH using ltc-libraray

LysanderGG commented 6 years ago

Note that my project is written in python 3 as specified in the readme. I haven't encountered the problem you are talking about (on windows).

About the hashrate, ltc is not profitable at all with a cpu or gpu, only ASIC are profitable now. For XMR, I get a relatively correct hashrate as written in the readme but nowhere near the best miners (around 40%).

0xIslamTaha commented 6 years ago

I tried to build it, but it threw this error

➜  cryptonight_lib git:(master) cmake .
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/islamtaha/PycharmProjects/minerTools/Simple-XMR-Miner/cryptonight_lib
➜  cryptonight_lib git:(master) ✗ make 
Scanning dependencies of target cryptonight_lib
[  8%] Building C object CMakeFiles/cryptonight_lib.dir/main.c.o
/home/islamtaha/PycharmProjects/minerTools/Simple-XMR-Miner/cryptonight_lib/main.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 __declspec(dllexport) void foo()
 ^
/home/islamtaha/PycharmProjects/minerTools/Simple-XMR-Miner/cryptonight_lib/main.c: In function ‘__declspec’:
/home/islamtaha/PycharmProjects/minerTools/Simple-XMR-Miner/cryptonight_lib/main.c:4:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
/home/islamtaha/PycharmProjects/minerTools/Simple-XMR-Miner/cryptonight_lib/main.c:3:1: warning: type of ‘dllexport’ defaults to ‘int’ [-Wimplicit-int]
 __declspec(dllexport) void foo()
 ^
/home/islamtaha/PycharmProjects/minerTools/Simple-XMR-Miner/cryptonight_lib/main.c:6:1: error: expected ‘{’ at end of input
 }
 ^
CMakeFiles/cryptonight_lib.dir/build.make:62: recipe for target 'CMakeFiles/cryptonight_lib.dir/main.c.o' failed
make[2]: *** [CMakeFiles/cryptonight_lib.dir/main.c.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/cryptonight_lib.dir/all' failed
make[1]: *** [CMakeFiles/cryptonight_lib.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
➜  cryptonight_lib git:(master) ✗ 
LysanderGG commented 6 years ago

Erf, it is windows dependent code for symbol export. It should compile if you remove __declspec(dllexport), I will add a define to support win/linux. You can also exclude main.c from the compilation as it was added by error.

0xIslamTaha commented 6 years ago

it would be nice if u add a doc for linux users :) I will do what u said and update u

LysanderGG commented 6 years ago

I committed the fixes suggested in https://github.com/LysanderGG/Simple-XMR-Miner/issues/3#issuecomment-359450551

0xIslamTaha commented 6 years ago

I tested it, but its till doesn't work

CMakeFiles/cryptonight_lib.dir/build.make:62: recipe for target 'CMakeFiles/cryptonight_lib.dir/cryptonight.c.o' failed
make[2]: *** [CMakeFiles/cryptonight_lib.dir/cryptonight.c.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/cryptonight_lib.dir/all' failed
make[1]: *** [CMakeFiles/cryptonight_lib.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
LysanderGG commented 6 years ago

Thank you for the return. I will try to compile it on linux when I have time.

0xIslamTaha commented 6 years ago

@LysanderGG That would be nice. Thanks for your effort.

LysanderGG commented 6 years ago

@islamTaha12 I had some time to make the project compile on Linux, you should be able to compile cryptonight_lib and then running the python script should work. Please try and tell me if you had any problem.

miked63017 commented 6 years ago

I can confirm compilation on linux works, also on OSX.

LysanderGG commented 6 years ago

Thank you for the confirmation!

I close the issue.