licel / jcardsim

https://jcardsim.org
223 stars 123 forks source link

macOS build issues #145

Closed Grivus closed 4 years ago

Grivus commented 5 years ago

Hi! I've a problem building the jcardsim on macOS.

I'm following such instructions: https://github.com/OpenSC/OpenSC/wiki/Smart-Card-Simulation (section Compile jCardSim with support for vpcd)

when I run the mvn initialize it prints several warnings at start, but exits ok:

[WARNING] Some problems were encountered while building the effective model for com.licel:jcardsim:jar:3.0.5-SNAPSHOT [WARNING] 'build.plugins.plugin[org.apache.maven.plugins:maven-antrun-plugin].dependencies.dependency.systemPath' for com.sun:tools:jar refers to a non-existing file /Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/../lib/tools.jar. Please verify that you run Maven using a JDK and not just a JRE. @ line 347, column 37 [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

The mvn does not like the settings:

[ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] error: Source option 5 is no longer supported. Use 7 or later. [ERROR] error: Target option 5 is no longer supported. Use 7 or later.

Any guesses what I'm doing wrong?

martinpaljak commented 5 years ago

Use JDK8

Grivus commented 5 years ago

@martinpaljak I've removed the jdk 12 and installed jdk 8 as you suggested.

Now the mvn initialize finishes OK without any warnings, but the mvn clean install shows me a lot of compilation errors:

[ERROR] /Users/developer/Documents/smc/jcardsim/src/main/java/com/licel/jcardsim/crypto/DHKeyImpl.java:[21,24] error: cannot find symbol [ERROR] package javacard.security /Users/developer/Documents/smc/jcardsim/src/main/java/com/licel/jcardsim/crypto/DHKeyImpl.java:[30,59] error: cannot find symbol [ERROR] class DHKey

and for other classes.

I've found, that it could be some JavaCard SDK problem, but I can't tell what is it exeactly.

export shows the

JC_CLASSIC_HOME="/Users/developer/Documents/smc/oracle_javacard_sdks/jc304_kit"

which is the correct path. Do I need to somehow register this sdk?

Grivus commented 5 years ago

Ok, it seems I finally got it built.

The jc version this project uses is 305 and there is no simple way to use 304, like it is described in https://github.com/OpenSC/OpenSC/wiki/Smart-Card-Simulation (I've tried to state 304 version in the pom.xml, in export path and in the ~/.m2/settings )

so instead of using export JC_CLASSIC_HOME=$PWD/oracle_javacard_sdks/jc304_kit the one needs to use export JC_CLASSIC_HOME=$PWD/oracle_javacard_sdks/jc305u3_kit

ph4r05 commented 4 years ago

You may try to use #149 which adds support for building with higher java versions