RedNeath
RedNeath

Reputation: 35

Can't find ELF header

I'm trying to use the zwo asi python bindings library (available here) on a Debian machine.

To do so, I downloaded the SDK from zwo's website (the Mac & Linux version), placed the ASICamera2.h file in the /usr/include and ran the commands written in the README.txt in the lib folder of the archive.
I effectively get the "200" answer when using the command :

cat /sys/module/usbcore/parameters/usbfs_memory_mb

Then I created an environement variable in /etc/profile called ZWO_ASI_LIB which refers to the ASICamera2.h file I talked about earlier.

Here's the code of my python script (it's not the complete code, but the part that causes the problem) :

import os
import sys
import zwoasi

def startCamera():
    env_filename = os.getenv('ZWO_ASI_LIB')

    if env_filename:
        zwoasi.init(env_filename)
    else:
        print("Error : Library not found")
        sys.exit(1)

startCamera()

When I launch it in my terminal via the python3 x.py command, I get this error :

Traceback (most recent call last):
  File "x.py", line 87, in <module>
    startCamera()
  File "x.py", line 21, in startCamera
    zwoasi.init(env_filename)
  File "usr/local/lib/python3.7/dist-packages/zwoasi/__init__.py", line 821, in init
    zwolib = c.cdll.LoadLibrary(library_file)
  File "usr/lib/python3.7/ctypes/__init__.py", line 434, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib/python3.7/ctypes/__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/include/ASICamera2.h: invalid ELF header

I guess I am meant to have an ELF header somewhere (.elf file ?) for the SDK library, but I haven't been able to find it. It could be that I am just not refering to the right file, but according to the documentation given on the zwo's website, the file I put in my environement variable is the header.
Also, I didn't really understand what they meant by "Under Linux the dynamic and static library: ASICamera2.so, ASICamera2.a"

The camera I'm using is the ASI178MC.

Upvotes: 0

Views: 1951

Answers (1)

Employed Russian
Employed Russian

Reputation: 213646

OSError: /usr/include/ASICamera2.h: invalid ELF header

You have told your runtime environment that ASICamera2.h is the name of a shared library it should be loading (using dlopen on).

But ASICamera2.h is C header (text) file defining the API for that library, not the library itself.

Instead you should point Python to a shared library (which is likely also part of the SDK you downloaded). Usually shared libraries end with .so. Documentation you pointed to says that the library is named ASICamera2.so.

Upvotes: 1

Related Questions