-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complie from source using Windows #121
Comments
Hi, Do you need it to be compiled with MSVC or MinGW? Is this important? Download the corresponding version of MSYS2 from here: http://www.msys2.org/ . You need to install a couple of packages using the MSYS2 shell, in order to build libsmu: For 32 bit
For 64 bit
Get libusb hotplug for 32 bit from here: http://swdownloads.analog.com/cse/build/libusb-1.0-hp.7z and extract it into C:\libusb-mingw Compile libusb hotplug for 64 bit:
Build libsmu MinGW 32 bit
Build libsmu MinGW 64 bit
Could you try these and let me know if you encounter any problems? Thank you. -Alexandra |
Thanks, I had already installed mingw64-gcc4.7.1 exe but I think I need to install more along with MSYS2. Doug |
I think I must be missing some steps. Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~ So I must be missing a step somewhere? Thanks Doug |
I've made some small additional progress here. Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 /c/projects/libsmu/mingw-32 It now got past the step to make the project dir but the cmake step failed as you can see. So What do I Do next? Thanks |
Hi, It looks like the build directory contains some cache files ( CMakeCache.txt file and CMakeFiles ) which were generated on an older build using NMake Makefiles. I think you can cd c:\libsmu\mingw-32 and remove everything in this folder, then run cmake. The new cache files will be generated using the correct cmake generator. -Alexandra |
Sorry but still not working. Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 /c/projects/libsmu/mingw-32 Doug@Doug-PC MINGW32 /c/projects/libsmu/mingw-32 Doug@Doug-PC MINGW32 /c/projects/libsmu/mingw-32 Doug@Doug-PC MINGW32 /c/projects/libsmu/mingw-32 Doug@Doug-PC MINGW32 /c/projects/libsmu/mingw-32 I must not be following the right steps here. Please could you list EXACTLY what I need to do from a blank start? Thanks Doug |
Hi, I attached a script to setup and build libsmu. This script will clone the github repo and create the initial build structure for libsmu. You do not need to run this everytime, because it will clean and clone the repo again. Just modify the sources and after building this once, you can just cd < path to the location where you want to keep libsmu >/libsmu/mingw-32 and run cmake --build . --config Release. -Alexandra |
Great, thanks, but I seem to be missing the git command! Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~ How do I add git to MSYS2? Is there anything else you can think of I might be missing? Please try to anticipate everything because of the time difference I only really get to do one experiment per day and this will take forever if I don't have everything in place fro the start. Thanks Again: Doug |
Sorry about this. -Alexandra |
Up-date: Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~ Still no luck getting to a working libsmu. Git made libsmu-master/libsmu and everything seems to be below that dir. Script seems to still have trouble finding what it needs? Doug |
Looking at the dir that it made and where it was looking I tried this: Doug@Doug-PC MINGW32 ~ 'C:/msys64/mingw64/bin/ninja.exe' '--version' failed with: The system cannot find the file specified -- Configuring incomplete, errors occurred! Doug@Doug-PC MINGW32 ~ I seem to be missing another dependency? Doug |
Did it again with: Doug@Doug-PC MINGW32 ~ Packages (2) git-2.20.1-1 mingw-w64-i686-ninja-1.8.2-3 Total Download Size: 0.35 MiB :: Proceed with installation? [Y/n] y Doug@Doug-PC MINGW32 ~ 'C:/msys64/mingw64/bin/ninja.exe' '--version' failed with: The system cannot find the file specified -- Configuring incomplete, errors occurred! Doug@Doug-PC MINGW32 ~ Still not getting to the end? Doug |
It added ninja here: Doug@Doug-PC MINGW32 ~ |
Did you try to remove the "/home/Doug/libsmu" folder before running the script again? It looks like it ran the first time without finding the good ninja and used the cached files the second time you tried to run it ("fatal: destination path '/home/Doug/libsmu' already exists and is not an empty directory."). |
Yes and it gave the same result. |
I found the problem. I am really sorry about this. |
I changed the line using EMACS and tried again ( with libsmu dir deleted before hand) Doug@Doug-PC MINGW32 ~
-- Build files have been written to: C:/msys64/home/Doug/libsmu/mingw-32 Doug@Doug-PC MINGW32 ~ Did a lot more but still did not complete? |
Some of the errors seem to be related to libusb. I have C:\libusb-mingw installed to the computer by the way from here: http://swdownloads.analog.com/cse/build/libusb-1.0-hp.7z . |
Inside C:\libusb-mingw do you have a single folder named libusb-1.0-hp or multiple folders like: include, static, MinGW32 ? If you have a single folder, you need to copy everything inside it below C:\libusb-mingw. In the build script, the explicit path to libusb is given, and it's something like: C:\libusb-mingw\MinGW32\static\libusb-1.0.a . So, if you have a folder libusb-1.0-hp, this path will fail. |
This is what is in C:\libusb-mingw Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 /c/libusb-mingw Doug@Doug-PC MINGW32 /c/libusb-mingw Should I delete something here? Doug |
No. This is the correct structure for the folder. Let me check what other issue we might have because of libusb. |
Inside the mingw-32 build folder, do you have a CMakeCache.txt file and a build.ninja file? Can you archive those and send them here? |
mingw-32.zip |
Thank you. Let me check if there are any wrong dependencies / paths that might break the build. |
Couldn't find any differences between the log files you provided and the ones I have locally. Based on the errors, it looks to me like the libusb.h file inside C:\libusb-mingw\include\libusb-1.0 has some problems or it's not properly included in usb.hpp. I downloaded the libusb archive again, to be 100% sure we both have the same version and it still works for me. Could you also send the C:\libusb-mingw\include\libusb-1.0\libusb.h file, just to take a look if anything doesn't look ok? |
include.zip |
Hi down loaded a new copy of libusb-1.0-hp.7z from here: http://swdownloads.analog.com/cse/build/libusb-1.0-hp.7z . And when I used WinRAR to extract the files I get these messages: ! C:\Users\Doug\Documents\GNU MCU Build\libusb-1.0-hp.7z: Unknown method in include\libusb-1.0\libusb.h Probably the cause of the missing stuff in libusb? Doug |
Hi, The cmake command tries to point libsmu to libusb using the following path for the include files: C:\libusb-mingw\include\libusb-1.0. If the folder does not exist, or does not contain a libusb.h, then libsmu will not find some needed symbols and will fail during build. We extracted the libusb archive using the latest WinRAR and got the following folder structure:
Could you try to extract it using the 7-Zip software? -Alexandra |
I don't think I have the 7-Zip software installed. I'll have to find it on the web somewhere. |
Sure, you should find it here . -Alexandra |
That looks like it must have been the problem. I started again with libsmu folder deleted and it ran to completion with a few warnings that I assume are normal: BTW. You might want to see if a .zip file of the libusb-1.0 can be provide along side that one. Doug@Doug-PC MINGW32 ~
-- Build files have been written to: C:/msys64/home/Doug/libsmu/mingw-32 Doug@Doug-PC MINGW32 ~ I'll proceed from here to install and test the resultant libsmu. I'll keep you informed if there are any problems. Thanks |
I'll put together a guide for Windows builds. Please let us know whether you encounter or not any issues. Thank you. |
I'm sorry but where did it put the results? All I found was a couple of .iss files in libsmu/mingw-32/dist ( besides the test .exe )? I looked inside the libsmu-x86.iss file and what that contained didn't make much sense for what the dir structure on this system is. Doug |
There is a libsmu.dll in the src folder. Much larger than the one in the distribution I presently have installed. Probably due to DeBug stuff? I need new pysmu stuff as well to do my eventual testing? What do I need to put where to make this all work? Thanks Doug |
You can find the libsmu.dll in libsmu/mingw-32/src.
To build it, navigate to C:\msys64\home\Doug\libsmu\bindings\python and run the following commands:
To rebuild after some updates, first you need to run the command: cmake --build . --config Release inside C:\msys64\home\Doug\libsmu\mingw-32 and for the python bindings just rerun the last two commands. Does this provide everything you need? |
We will find out when I give this a try later this afternoon. |
Oops didn't get past first thing on your list: Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~ Also, please be very specific with what I'm supposed to do with libsmu.dll. Do I just overwrite / replace the libsmu.dll in the C:\Program Files (x86)\Analog Devices\libsmu folder? Thanks |
I went a head and ran the rest of the things listed anyway and this is was the result: Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~ Doug@Doug-PC MINGW32 ~/libsmu Doug@Doug-PC MINGW32 ~/libsmu/bindings Doug@Doug-PC MINGW32 ~/libsmu/bindings/python Doug@Doug-PC MINGW32 ~/libsmu/bindings/python Doug@Doug-PC MINGW32 ~/libsmu/bindings/python I looked and C:/msys64/home/Doug/libsmu/include/libsmu/libsmu.hpp indeed exists? Not sure what it was looking for? Thanks Doug |
I attached a couple of scripts. "install-deps-32bit.sh" and "install-py-32bit.sh" will install the dependecies needed to build everything. So, you only need to run libsmu-rebuild-all-32.sh because you already did the setup for all the other things. You can copy cli/smu.exe, libsmu.dll, libsmu.dll.a and libsmu.a from the libsmu/mingw-32/src folder inside the previous installation of libsmu (which should be C:\Program Files x86)\Analog Devices\libsmu). The built Python bindings (libsmu.pyd, pysmu) are located in libsmu/bindings/python/, having the following structure: |
First off tanks for all the effort so far on all this. Doug@Doug-PC MINGW32 ~/libsmu/mingw-32/src/cli I guess I can't run smu.exe from here as a test? I opened a Windows CMD prompt screen and tried smu -s and it worked ( I assume using new version in Analog Devices\libsmu) and then navigated to /libsmu/mingw-32/src/cli a tried smu -s there and it worked I assume it was using the local smu.exe? Typing sum --version will return same version number as the released version so I need to change that in the source code to make sure things have actually changed. Also you seemed to indicated the running libsmu-build.sh also builds the python bindings. But it does not seem to move anything new to Pyhton27/...../site-packages/pysmu? Do I need to move new stuff to Pyhton27/...../site-packages/pysmu manually? Again Thanks |
Also, I just tried to run my Python code (ALICE 1.2) with this new stuff in C:\Program Files(x86)\Analog Devices\libsmu but old stuff in Pyhton27/...../site-packages/pysmu and Python can no longer import pysmu. Doug |
Hi, The libsmu-rebuild-all-32.sh builds the Python stuff locally, so those need to be moved manually to the official Python folder. -Alexandra |
Using Windows Explorer I deleted the contents of site-packages/pysmu and copied over the contents of the new libsmu/bindings/python/pysmu.
Traceback (most recent call last):
Traceback (most recent call last): Still need another file or a link is broken? Doug |
While waiting for a fix to Python, I've done some experiments changing the source code that I can see using the smu cli. I changed the CMakeLists.txt file to change the version number to 1.1.0 rather than 1.0.1 and changed the sample conversion routine in device_m1000.cpp where it converts raw integers to voltage and current floats. I ran ./libsmu-rebuild-all-32.sh and moved the files and whatever. |
Hi, If you modify the CMakeLists.txt, you need to rerun the cmake command, in order to apply those changes. Thank you. |
Is there a option switch to on which makes it stop on the first failing error? I'm not use to c++ syntax yet and likely will often make minor typos. Right now it there is one it goes whizzing by and I won't catch it. I'll have to scroll back through the lines of messages reading each one to see if I made a mistake. ( the cause of the above confusion ). The Python error would indicate that there is something in the libsmu.pyx file that it is not finding because the file is there. Thanks Doug |
Hi, I attached the updated scripts. What I did:
How did I test things:
This way you don't have to copy any .dlls in your initial Python folder or Program Files/libsmu install folder. Those will all be installed in the MSYS2 MinGW32 subsystem and you should be able to use the python provided by it. If changes occur in the library source code, or the CMakeLists.txt, "libsmu-rebuild-all-32.sh" should rebuild all (including the bindings) and install them in the required location. Please let me know how this works for you. I am really sorry again for this inconvenience. -Alexandra |
Thanks , I will give these new scripts a test. Using the version of Python inside /c/msys64/mingw32/bin/ will be OK for a test but I like to use the Python IDLE to run the software as I edit the files so I think that will run the version inside C:\Python27. I minor inconvenience for the moment I can work around. |
Here is another wrinkle. I use numpy and the python in /c/msys64/mingw32/bin/ does not have that installed but the main one in in C:/Python27 does. I tried this: |
Right now I have two versions of Python 2.7.15 the one in the Windows registry with a working numpy and no new pysmu and the one under msys64 with a new pysmu and no numpy. I NEED both in the same version of python, preferably the one in the Windows registry (it has all the extensions I use). Progress is sort of at a stand still until this gets resolved. Thanks |
Hi, You can install numpy under msys64 using the following command: pacman -Sy mingw-w64-i686-python2-numpy In order to put things under C:/Python27, all the libraries and executables should be copied manually. I am investigating this method and I'll come back with some guidelines when it's done. Thank you. -Alexandra |
Hi: Thanks |
Hi: |
Hi, In order to change the version of the pysmu bindings you can modify the libsmu/bindings/python/pysmu/_ _ init.py _ _ file. If you run python setup.py install inside libsmu/bindings/python, are the changes you made applied? -Alexandra |
I changed the line in init.py and the version number changed after I ran setup install as can be seen from what was typed in the terminal screen: $ python2 setup.py install Installed c:/msys64/mingw32/lib/python2.7/site-packages/pysmu-1.0.1-py2.7-mingw.egg I don't think there were any errors but I might be missing something? However, I have also changed the following in libsmu.pyx: def set_led(self, leds):
Which should turn on all three leds. cdef class _DeviceSignal(Signal):
When I go to my python test folder and run the program which does these test lines after setting up the session:
The LEDs turn on one at a time rather than all three at once as they should (with this change self._device.set_led(7) ) and it then fails when it gets to CHA.signal.resolution: Channel A label = Voltage So I think this demonstrates that the altered libsmu.pyx is not being used? Thanks Doug |
How do I (i.e. what do I need to have installed ) compile / build libsmu from source on Windows 7?
Thanks
Doug
The text was updated successfully, but these errors were encountered: