Open AbbottWC opened 10 years ago
You need to add the stuff in the "Building" section to your settings.xml too.
Btw, I've never tried to build this on windows so I have no idea if it'll really work. But it kinda should :)
Thank you very much for your timely response. i will try that and if it works will post promptly.
Where do I find/create the settings.xml file?
I saw that but in what directory inside the project directory do I place the settings.xml file? Sorry, should have been more clear.
Following directions I was able to (finally) compile the LibUSB from git and was able to overcome the preceding error however there is now a new error: Failed to execute goal on project javalibusb1: Could not resolve dependencies for project io.trygvis.usb:javalibusb1:nar:1.0.1-1-SNAPSHOT: Failure to find io.trygvis.usb:libusb:pom:1.0.1-1
Why would this be happening?
Same problem here, OSX mavericks 10.9.4. Downloaded your latest version 6c8531151dee59db222986e19643a574bdc1cefa.
I am following the 'Building' instructions as on https://github.com/trygvis/javax-usb-libusb1
To build the main software a mvn install will be sufficient.
so I run 'mvn install' in top level of the package. Gives BUILD FAILURE. I only see this warning and the message
[WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireProperty failed with message: Property "libusb.home" is required for this build.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.0:enforce (enforce-maven) on project javax-usb-libusb1: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
Then I read on
If you want to make life easy for you, you want build and use the libusb referenced from as a git module too. To do that simply run (cd libusb; mvn install). Like with the javalibusb1 library, the build is set to build 64-bit versions if the JVM is running in 64-bit mode.
Bit puzzling. Of course I want it easy as a starter. So do I need to do this? I already did install on top level?
Anyway, just to see what happens, I execute cd libusb; mvn install
Gives me EXACTLY the above warning and error.
Check, yes I have 64 bit java and I want 64 bit which is the default anyway.
java -version java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
Reading on...
If you do not use the referenced libusb module, you have to build it manually and point libusb.home to it.
But I DO want to use the referenced libusb module. So I think I should skip this section.
Tried some more. My guess is that the C code has to be built first.
building the c/ directory 'make all' jus tgives me errors
make all
Makefile:1: ../javalibusb1/Makefile.local.Darwin: No such file or directory
Makefile:2: ../javalibusb1/Makefile.Darwin: No such file or directory
make: *\ No rule to make target `../javalibusb1/Makefile.Darwin'. Stop.
Then trying the other C code, in javalibusb1/ subdirectory
mvn package there gives
[WARNING] The POM for io.trygvis.usb:libusb:pom:1.0.1-1-SNAPSHOT is missing, no dependency information available Downloading: https://oss.sonatype.org/content/repositories/snapshots/io/trygvis/usb/javax.usb/1.0.1-1-SNAPSHOT/javax.usb-1.0.1-1-SNAPSHOT.jar
It seems something is missing on the sonartype repository.
Check https://oss.sonatype.org/content/repositories/snapshots/io/trygvis/
You can see that there is no USB directory there.
I also tried to compile libusb myself. But it seems broken, it does not even build. I filed a bug report there.
After a full day of messing with libusb and javax-usb-libusb1 I finally got it all compiling and running. I will report all the fixes that I did, I suppose these can be fixed here
I'm running on the latest libusb . I finally got it compiled...
Then, you need to put this settings file in $HOME/.m2
<settings>
<profiles>
<profile>
<id>libusb-32</id>
<activation>
<os>
<arch>i386</arch>
</os>
</activation>
<properties>
<libusb.home>/usr/local</libusb.home>
<libusb.cflags>-m32</libusb.cflags>
</properties>
</profile>
<profile>
<id>libusb-64</id>
<activation>
<os>
<arch>x86_64</arch>
</os>
</activation>
<properties>
<libusb.home>/usr/local</libusb.home>
<libusb.cflags>-m64</libusb.cflags>
</properties>
</profile>
</profiles>
</settings>
Then, the pom files need to be fixed, to use the official nar-maven-plugin The pom also needs to get a -c option for the c compiler, otherwise (at least on OSX) it fails because it can not resolve all symbols. You need the -c option to postpone the linking to the linker... I'm not sure how compatible the '-c' is, I was expecting some other option for the plugin but could not find it. The linkCPP=false only prevents linking against c++ libraries, and that is not enough.
Then, the actual library name as it is now is "libusb.h", so you need to add #include "libusb.h" in both javalibusb.c and usbw.c.
A number of places in javalibusb do not initialize variables, causing errors and warnings. I set err=0 and transferred=0 initially. Seems to work. No idea if that is what is intended. But at least it compiles.
In usbw.c, the function libusb_get_speed has been renamed to libusb_get_device_speed.
I noticed that the original script also loads some poms in my .m2 directory without loading the associated jars. That caused some more erorrs , some compiler tried to open the expected jar which wasn't there and then you got a confusing "failed to open zip file" or something...
My pom now looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.trygvis.usb</groupId>
<artifactId>javax-usb-libusb1</artifactId>
<version>1.0.1-1-SNAPSHOT</version>
</parent>
<artifactId>javalibusb1</artifactId>
<name>Javalibusb1 :: Implementation and JNI Wrapper</name>
<packaging>nar</packaging>
<dependencies>
<dependency>
<groupId>io.trygvis.usb</groupId>
<artifactId>javax.usb</artifactId>
<version>${project.version}</version>
</dependency>
<!-- <dependency>
<groupId>io.trygvis.usb</groupId>
<artifactId>libusb</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency> -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<version>3.1.0</version>
<extensions>true</extensions>
<configuration>
<libraries>
<library>
<type>jni</type>
<linkCPP>false</linkCPP>
<narSystemPackage>javalibusb1</narSystemPackage>
</library>
</libraries>
<c>
<optionSet>${nar.optionSet.c} -c</optionSet>
<clearDefaultOptions>true</clearDefaultOptions>
<includePaths>
<includePath>${libusb.home}/include/libusb-1.0</includePath>
<includePath>${basedir}/src/main/include</includePath>
</includePaths>
</c>
<linker>
<optionSet>${nar.optionSet.linker}</optionSet>
<clearDefaultOptions>true</clearDefaultOptions>
<libs>
<lib>
<name>usb-1.0</name>
<type>static</type>
<directory>${libusb.home}/lib</directory>
</lib>
</libs>
</linker>
</configuration>
</plugin>
</plugins>
</build>
</project>
I didn't put the modified c files here, too much text and only a few small changes.
Hope tht this all helps!
Running WINDOWS 7 but ran into same problem on Ubuntu 14.0.4
Very possible given my limited experience with these sorts of things that I am doing something very wrong.
I was trying to build the LibUSB directory using the suggestion you gave but it didn't work. I downloaded the LibUSB latest GIT from https://github.com/libusb/libusb and placed it in the javax-usb-libusb1-master/libusb-git folder, and then changed over to the javax-usb-libusb1-master/libusb directory and ran mvn install.
Before when I tried this I received a great deal of information about things being downloaded and ultimately ended up in failure.
This time when I tried it after having GITten the latest LibUSB build and placed it into the libusb-git directory, there was less information, but it still ended with the same error:
Y:\Development Tools\Java\javax-usb-libusb1-master\libusb>mvn install [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethrea ded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Javalibusb1 :: libusb 1.0.1-1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ libusb --- [WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireProperty failed with message: Property "libusb.home" is required for this build. [WARNING] Rule 2: org.apache.maven.plugins.enforcer.RequireProperty failed with message: Property "libusb.cflags" is required for this build. [WARNING] Rule 3: org.apache.maven.plugins.enforcer.RequireProperty failed with message: Property "libusb.configure.args" is required for this build. [WARNING] Rule 4: org.apache.maven.plugins.enforcer.RequireProperty failed with message: Property "nar.optionSet.c" is required for this build. [WARNING] Rule 5: org.apache.maven.plugins.enforcer.RequireProperty failed with message: Property "nar.optionSet.linker" is required for this build. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.302 s [INFO] Finished at: 2014-06-06T10:51:48-06:00 [INFO] Final Memory: 7M/112M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1. 0:enforce (enforce-maven) on project libusb: Some Enforcer rules have failed. Lo ok above for specific messages explaining why the rule failed. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit ch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please rea d the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE xception
Nothing I searched for could bring me an answer to this problem, and I don't really think it is an issue, but I was hoping to get some answers, and maybe it is an issue, I don't know, and if it's not, sorry for wasting your time.