mark-watson / swift-coreml-wisconsin_data_create_model

Apache License 2.0
0 stars 0 forks source link

Can’t build this package on x86_64 arch #1

Open wmorgue opened 2 years ago

wmorgue commented 2 years ago

Hello Mark.

On page 29 of your book I could not build the Package of the current repository.

  1. There is error at this line. Did you mean: "wisconsin.mlmodel"?
  2. I can't build the library after launching swift build:

Building for debugging...
Undefined symbols for architecture x86_64:
  "_$s8CreateML11MLDataTableV10contentsOf7optionsAC10Foundation3URLV_AC14ParsingOptionsVtKcfC", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
  "_$s8CreateML11MLDataTableV11randomSplit2by4seedAC_ACtSd_SitF", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
  "_$s8CreateML11MLDataTableV14ParsingOptionsV14containsHeader9delimiter7comment6escape11doubleQuote5quote17skipInitialSpaces13missingValues14lineTerminator13selectColumns7maxRows0oY0AESb_S3SSbSSSbSaySSGSSARSgSiSgSitcfC", referenced from:
      _$s8CreateML11MLDataTableV10contentsOf7optionsAC10Foundation3URLV_AC14ParsingOptionsVtKcfcfA0_ in main.swift.o
  "_$s8CreateML11MLDataTableV14ParsingOptionsVMa", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
  "_$s8CreateML11MLDataTableVMa", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
      _$s8CreateML11MLDataTableVSgWOh in main.swift.o
  "_$s8CreateML11MLDataTableVMn", referenced from:
      _symbolic _____Sg 8CreateML11MLDataTableV in main.swift.o
  "_$s8CreateML11MLDataTableVyACxcSTRzSS7ElementRtzluig", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
  "_$s8CreateML12MLClassifierO10evaluation2onAA0C7MetricsVAA11MLDataTableV_tF", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
  "_$s8CreateML12MLClassifierO12trainingData12targetColumn14featureColumnsAcA11MLDataTableV_SSSaySSGSgtKcfC", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
  "_$s8CreateML12MLClassifierO15trainingMetricsAA0cE0Vvg", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
  "_$s8CreateML12MLClassifierO17validationMetricsAA0cE0Vvg", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
  "_$s8CreateML12MLClassifierO5write2to8metadatay10Foundation3URLV_AA15MLModelMetadataVSgtKF", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
  "_$s8CreateML12MLClassifierOMa", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
  "_$s8CreateML15MLModelMetadataV6author16shortDescription7license7version10additionalACSS_S2SSgSSSDyS2SGSgtcfC", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
  "_$s8CreateML15MLModelMetadataVMa", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
      _$s8CreateML15MLModelMetadataVSgWOh in main.swift.o
  "_$s8CreateML15MLModelMetadataVMn", referenced from:
      _symbolic _____Sg 8CreateML15MLModelMetadataV in main.swift.o
  "_$s8CreateML19MLClassifierMetricsV19classificationErrorSdvg", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
  "_$s8CreateML19MLClassifierMetricsVMa", referenced from:
      _$s14wisconsin_data12create_modelyyF in main.swift.o
ld: symbol(s) not found for architecture x86_64
[4/5] Linking wisconsin_data

This one: ld: symbol(s) not found for architecture x86_64.

I assume that the problem in building the package is in the architecture of the package itself. Did you build this package on a machine with an M1 CPU? I assume the package is built for your current architecture. My macbook is running on an old Intel CPU. I tried to pass the swift build --arch x86_64 flag to the compiler, but it didn't work. No idea yet how to build the package and continue reading the book.

mark-watson commented 2 years ago

I used an M1 MacBook to write these examples. I will get access to an Intel MacBook and reproduce this problem. Thanks for reporting it.

UPDATE: with updates to CoreML and CreateML, I can no longer use the Apple provided Struct MLDataTable, even adding the new argument for parsing options: https://developer.apple.com/documentation/createml/mldatatable

Apple's new example for training tabular data is a link to an Xcode PlayGround project that does not have any source files in it.

If I can't get this example working with the current Xcode and CoreML libraries, then I will remove this chapter from the book.

mark-watson commented 2 years ago

I added a warning to the Book that temporarily this example does not work. I hope that the next CreateML library update fixes this. I found some else mentioning this problem also.