Hi again,

Just tried this out:

I'll try to comment that part `if test -z "$NEED_USB_TRUE"; then :`,
see if stuff compiles with it ...
... and it seems it works. More precisely, this is what I did - first, cloned 
libsigrok locally, so I can comment out that check, and that save that as the 
tip of libsigrok master; I used the C:\src directory for this:

```
$ git clone git://sigrok.org/libsigrok
$ cd libsigrok
$ git config user.name sd
$ git config user.email sd@bbs
$ sed -i -b 's/AM_COND_IF(\[NEED_USB\], \[AS_CASE/#AM_COND_IF([NEED_USB], 
[AS_CASE/' configure.ac
$ sed -i -b 's/\[AC_MSG_ERROR(\[Windows builds/#[AC_MSG_ERROR([Windows builds/' 
configure.ac
$ git add -u
$ git commit -m 'hack for libusb'
[master 4e577354] hack for libusb
 1 file changed, 2 insertions(+), 2 deletions(-)
```

Then, I changed the sigrok-native-msys2 script in sigrok-util like this:

```
$ git diff
diff --git a/cross-compile/msys2/sigrok-native-msys2 
b/cross-compile/msys2/sigrok-native-msys2
index bb692db..4c01c17 100755
--- a/cross-compile/msys2/sigrok-native-msys2
+++ b/cross-compile/msys2/sigrok-native-msys2
@@ -30,13 +30,13 @@ BUILDBASE=./build
 PYBASE=lib/python2.7/site-packages

 # Edit this to control verbose build output.
-# V="V=1 VERBOSE=1"
+V="V=1 VERBOSE=1"

 # Edit this to enable/disable/modify parallel compiles.
 PARALLEL="-j 2"

 # Edit this to enable/disable debug builds.
-DEBUG=0
+DEBUG=1

 # You usually don't need to change anything below this line.

@@ -117,7 +117,7 @@ fi
 # -----------------------------------------------------------------------------

 # libusb
-$GIT_CLONE git://github.com/dickens/libusb -b event-abstraction-v4
+$GIT_CLONE git://github.com/dickens/libusb -b examples # -b 
event-abstraction-v4
 cd libusb
 ./bootstrap.sh
 ./configure $C $L
@@ -137,7 +137,8 @@ make install $V
 cd ../..

 # libsigrok
-$GIT_CLONE $REPO_BASE/libsigrok
+#$GIT_CLONE $REPO_BASE/libsigrok
+$GIT_CLONE /c/src/libsigrok
 cd libsigrok
 ./autogen.sh
 mkdir build
```

And with this, everything builds (although there is a linking failure at end:

```
[100%] Linking CXX executable pulseview.exe
C:/msys64/mingw64/bin/cmake.exe -E rm -f CMakeFiles/pulseview.dir/objects.a
C:/msys64/mingw64/bin/ar.exe cr CMakeFiles/pulseview.dir/objects.a 
@CMakeFiles/pulseview.dir/objects1.rsp
C:/msys64/mingw64/bin/c++.exe -g -Wl,--whole-archive 
CMakeFiles/pulseview.dir/objects.a -Wl,--no-whole-archive -o pulseview.exe 
-Wl,--major-image-version,0,--minor-image-version,0 
@CMakeFiles/pulseview.dir/linklibs.rsp
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
 CMakeFiles/pulseview.dir/objects.a(main.cpp.obj): in function 
`StaticQWindowsIntegrationPluginPluginInstance::StaticQWindowsIntegrationPluginPluginInstance()':
C:/src/sigrok-util/build_debug_64/pulseview/main.cpp:73: undefined reference to 
`qt_static_plugin_QWindowsIntegrationPlugin()'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
 CMakeFiles/pulseview.dir/objects.a(main.cpp.obj): in function 
`StaticQSvgPluginPluginInstance::StaticQSvgPluginPluginInstance()':
C:/src/sigrok-util/build_debug_64/pulseview/main.cpp:74: undefined reference to 
`qt_static_plugin_QSvgPlugin()'
```

... but that is a question for another thread.

Anyways - great to see this working,
Best regards!






On 2020-10-28 1:22 PM, sdbbs wrote:
Many thanks for the response, Soeren!


That branch has been merged to libusb mainline in the meanwhile, see

https://github.com/libusb/libusb/issues/252

and

https://github.com/libusb/libusb/commit/d67eb5beaa44c17c09f089a522ff483f4978a978

Hence, using a libusb checkout of this commit or later should work.


Thanks for that - great to know!

I should have mentioned, that since the `$GIT_CLONE 
git://github.com/dickens/libusb -b event-abstraction-v4` will fail immediately, 
I did try to first use the libusb master branch - however, that one is 6 years 
old. Then, after realizing the `examples` branch of libusb is newer, instead I 
used this in the cross-compile/msys2/sigrok-native-msys2:

```
$ git diff
diff --git a/cross-compile/msys2/sigrok-native-msys2 
b/cross-compile/msys2/sigrok-native-msys2
index bb692db..1d25c57 100755
--- a/cross-compile/msys2/sigrok-native-msys2
+++ b/cross-compile/msys2/sigrok-native-msys2
@@ -117,7 +117,7 @@ fi
  # 
-----------------------------------------------------------------------------

  # libusb
-$GIT_CLONE git://github.com/dickens/libusb -b event-abstraction-v4
+$GIT_CLONE git://github.com/dickens/libusb -b examples # -b 
event-abstraction-v4
  cd libusb
  ./bootstrap.sh
  ./configure $C $L

```

And now I looked at the libusb history, and both the `examples` and `WIP` 
branches contain commit d67eb5bea. So, `examples` should be OK - but the above 
error, I get during a build of libsigrok with the `examples` branch of libusb!?

I've found that this is the part that causes the error, in (for my build) a 
file called build_debug_64/libsigrok/configure :

```
if test -z "$NEED_USB_TRUE"; then :
   case $sr_have_libusb_os_handle:$host_os in #(
   no:mingw*) :
     as_fn_error $? "Windows builds require the event-abstraction branch of libusb" 
"$LINENO" 5 ;; #(
   *) :
      ;;
esac
fi
```

Unfortunately, I'm really bad at reading/understanding configure scripts; but I 
guess $sr_have_libusb_os_handle is what triggers the condition, and that is 
derived a bit earlier:

```
ac_fn_c_check_type "$LINENO" "libusb_os_handle" "ac_cv_type_libusb_os_handle" 
"#include <libusb.h>
"
if test "x$ac_cv_type_libusb_os_handle" = xyes; then :

cat >>confdefs.h <<_ACEOF
#define HAVE_LIBUSB_OS_HANDLE 1
_ACEOF

sr_have_libusb_os_handle=yes
else
   sr_have_libusb_os_handle=no
fi
```

I have a really hard parsing what is happening here; but I guess, this somehow sets 
sr_have_libusb_os_handle to "no" even with the libusb `examples` branch build.

So, if there are some more suggestions, I'd love to hear them - in the meantime, I'll try 
to comment that part `if test -z "$NEED_USB_TRUE"; then :`, see if stuff 
compiles with it ...

Cheers!




Regards,
  -Soeren


On Wed, 2020-10-28 at 12:35 +0100, sdbbs wrote:
Hi all,

I was trying to build sigrok/PulseView on MINGW64 on Windows 10, via

    
https://sigrok.org/gitweb/?p=sigrok-util.git;a=blob;f=cross-compile/msys2/sigrok-native-msys2

... - and I got stuck at this part:

...
checking for libusb_os_handle... no
checking for zip_discard... yes
configure: error: Windows builds require the event-abstraction branch of libusb

... which is all great - except, there is no event-abstraction branch in 
https://github.com/dickens/libusb/branches/all

Any suggestions on how to get over this?

Thanks in advance!


_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel



_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to