GithubHelp home page GithubHelp logo

Comments (16)

aerialist avatar aerialist commented on August 20, 2024

Mmm... I just learnt that .pyd is only for WIndows.

Then why libm2k.py cannot find _libm2k module even though _libm2k.so is in the egg??

from libm2k.

AlexandraTrifan avatar AlexandraTrifan commented on August 20, 2024

Hi,

I need to setup a machine to test your steps. Could you tell me if you have any other Python version installed on your machine?
Can you check that you have the base library installed somewhere visible from your PATH? (you should have a libm2k.dylib which is the base C++ library). The libm2k.py and _libm2k.so are only additions for the Python bindings.

I will run some tests and get back to you.

Thank you,
-Alexandra

from libm2k.

aerialist avatar aerialist commented on August 20, 2024

Thank you for your support, Alexandra!

Actually I cannot find libm2k.dylib anywhere.
There is no mention of it in the build log, neither.
I can see libm2k-sharp-cxx-wrap.dylib created in the build directory.
It's for c sharp binding? Is there special switch needed to create libm2k.dylib?

On my Mac, I basically use Anaconda's Python with its environment management.
For this experiment, I have created a new conda environment called 'iio'

conda create -n iio python=3.6
source activate iio
pip install numpy,

Then installed libiio by installer package for Mac from
https://github.com/analogdevicesinc/libiio
I had to also download tar ball to install python binding.

from libm2k.

AlexandraTrifan avatar AlexandraTrifan commented on August 20, 2024

Hi,

Did you run "sudo make install"?
The "make" command builds the library, but "make install" installs the library in your system.
That should install libm2k.dylib in a location visible from your PATH.

-Alexandra

from libm2k.

aerialist avatar aerialist commented on August 20, 2024

Yes, I did run "sudo make install".

I run again and added to log:
build_log.txt
(L.760 and onward)

Again, the only *.dylib file appear is libm2k-sharp-cxx-wrap.dylib ...

from libm2k.

AlexandraTrifan avatar AlexandraTrifan commented on August 20, 2024

Hi,

The libm2k-sharp-cxx-wrap is related to the C# bindings, so it's not what we are looking for.

I made some changes on a development branch. Could you try those?
The branch is : https://github.com/analogdevicesinc/libm2k/tree/packaging .
The master version, the one that you were using, was building an OSX framework, libm2k.framework. From what I tested there was something wrong with the linking path.
In this updated version (branch packaging), the library is built as libm2k.dylib by default, not libm2k.framework.

Please remove everything in your build folder before building the new version.
Also, please remove this folder manually: /Library/Frameworks/libm2k.framework .(you should not need it anymore)

Thank you,
-Alexandra

from libm2k.

aerialist avatar aerialist commented on August 20, 2024

Thank you for your effort, Alexandra!

I tried the packaging branch and libm2k.dylib seem to be created! But still import libm2k results in "No module named '_libm2k'"...

Here is the log
libm2k_packaging_build_fail.log

L2: made sure /Library/Frameworks/libm2k.framework is deleted
L4: activate iio environment where libiio and its Python binding is working
L6: git clone libm2k
L15: switch to the packaging branch
L20: cmake
L56: make
L947: sudo make install
L1034: sudo python setup.py install
L1070: /usr/local/lib/libm2k.dylib exist!
L1075: running python in the 'build' folder and import libm2k gets "Segmentation fault: 11"
L1082: running python in other directory and import libm2k gets "No module named '_libm2k'"

from libm2k.

rgetz avatar rgetz commented on August 20, 2024

@tfcollins any thoughts - there was a lot of rpath manipulation we did for some of the Mac frameworks?

from libm2k.

AlexandraTrifan avatar AlexandraTrifan commented on August 20, 2024

Hi,

I investigated further and may have come with a fix for this.
You can test it from this branch: https://github.com/analogdevicesinc/libm2k/tree/fix-rpath

I managed to test it in the system (with Python.framework or python from /usr/local/bin), but also in the Anaconda env (as you described it).
We will use -DENABLE_CSHARP=OFF (if you don't need CSharp bindings, this will skip them and make the build a little faster).

  • Cleanup the build folder.
cmake -DENABLE_CSHARP=OFF ..
make && sudo make install
  • This will install everything in the system (/usr/local/lib/libm2k.dylib, /usr/local/include/all the include files).
  • Next we need to install the python bindings in the Anaconda env.
    sudo python setup.py install will not install everything you need.
  • On my test machine (and on yours as well, from what I have seen in the log, this will only copy the .egg in the python folder ("Copying libm2k-0.1.0-py3.6.egg to /Users/ssato/anaconda3/envs/iio/lib/python3.6/site-packages") . We also need _libm2k.so and libm2k.py. So we can run : sudo python setup.py install_lib instead of sudo python setup.py install.
    Not sure why this happens on Mac OSX. The behaviour is different on Linux for the same command.
    -After this, you should be able to run python and import libm2k.

Please let us know if this worked for you.
I will investigate further why "install_lib" is needed on Mac OSX and will update the documentation once you can confirm it works.

Thank you,
-Alexandra

from libm2k.

aerialist avatar aerialist commented on August 20, 2024

Thanks again, Alexandra.

fix-rpath modifications resolved ModuleNotFoundError !
But then I'm greeted with Segmentation fault: 11 ...

Running code inside libm2k.py manually line by line, it seems the segmentation fault is raised in "import _libm2k"

libm2k_fix-rpath_build.log

L2: activate iio environment where libiio and its Python binding is working
L4: git clone libm2k
L13: switch to the fix-rpath branch
L18: cmake -DENABLE_CSHARP=OFF ..
L65: make
L952: sudo make install
L1037: sudo python setup.py install_lib
L1045: sudo python setup.py install
L1083: running python in the 'build' folder and import libm2k gets "Segmentation fault: 11" <-- this is same behavior as before
L1090: running python in other directory and import libm2k gets "Segmentation fault: 11" <-- this is improvement. It was "No module named '_libm2k'" before
L1099: tried "python -v -m libm2k"
L1274: importing _libm2k raises "Segmentation fault: 11"

from libm2k.

AlexandraTrifan avatar AlexandraTrifan commented on August 20, 2024

Hi,

Sorry for the delay. It took a bit of searching but I hope this fixes the issue.
I didn't run into the "Segmentation fault 11" issue until I updated the conda env (which also updated the python version).

I added another commit on the fix-rpath branch which should handle the issue. Can you try again and let us know the outcome?

Thanks,
-Alexandra

from libm2k.

aerialist avatar aerialist commented on August 20, 2024

Thank you very much for your continuous efforts, Alexandra!

Well, fix-rpath branch is missing in origin now... could you push it?

(iio) ShunyanoMacBook-puro-1424:libm2k ssato$ git checkout fix-rpath
error: pathspec 'fix-rpath' did not match any file(s) known to git.

from libm2k.

AlexandraTrifan avatar AlexandraTrifan commented on August 20, 2024

Hi,

It was merged to master and removed.
All those changes should be on master now. Running git pull on the master branch should fetch the updates.

-Alexandra

from libm2k.

aerialist avatar aerialist commented on August 20, 2024

Excellent!
Compilation and installation succeeded. Now "import libm2k" seem to work alright.

I will get Pluto hardware back from my friend next week and start testing!

from libm2k.

AlexandraTrifan avatar AlexandraTrifan commented on August 20, 2024

Hi,

Happy to know it works fine.

Please be advised that libm2k is mainly for interfacing with ADALM2000 devices. ADALM-Pluto (which is an SDR) can also be controlled using this library, but it provides limited functionality (such as configuring sample rates / enabling devices / simple data capture etc.).

If you are looking for an easy way to configure Pluto in Python, you can look into the pyadi-iio Pluto example ( https://github.com/analogdevicesinc/pyadi-iio/blob/master/examples/pluto.py ) .
If you are looking for a C library, libiio is the way to go. ( https://github.com/analogdevicesinc/libiio )

Thank you,
-Alexandra

from libm2k.

aerialist avatar aerialist commented on August 20, 2024

I meant ADALM2000 actually.

And now I tested and confirmed that libm2k python examples work alright with ADALM2000 on my Mac. Thank you very much!

from libm2k.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.