Fork me on GitHub
#depstar
<
2020-11-24
>
mynomoto19:11:16

I already use depstar to generate an uberjar for an application. I would like to aot the uberjar and added the :aot true and :main-class project.core but got an error:

mynomoto19:11:19

Syntax error macroexpanding at (type.cljc:1:1).
Caused by: Can't embed object in code, maybe print-dup not defined: [email protected]

mynomoto19:11:23

Any pointer about what should I look for to fix this?

seancorfield20:11:05

@mynomoto That sounds like a syntax error in your code.

seancorfield20:11:22

What is that type.cljc file?

mynomoto20:11:37

Lots of plumatic schema definitions, that depends on several other namespaces.

mynomoto20:11:41

The only other noticeable thing is that we add some cheshire encoders for some classes on this namespace.

mynomoto20:11:59

I will try to comment those

mynomoto20:11:22

Comment the encoders makes no difference. Loading the file over a repl causes no errors.

ghadi20:11:25

you should try to compile your application with (compile 'your-main-namespace)

ghadi20:11:11

while ensuring that *compile-path* exists and is on your classpath

seancorfield20:11:25

i.e., manually make an empty classes folder in your project, and then in a REPL run (compile 'project.core)

mynomoto20:11:57

Ok, trying that. Thanks!

mynomoto20:11:36

user=> (compile 'project-x.core)
  Execution error at project-core.schema.type/loading (type.cljc:1).
  Can't embed object in code, maybe print-dup not defined: [email protected]
  

mynomoto20:11:23

Looks almost the same, but maybe someone will understand something that I don't.

seancorfield21:11:01

That means the problem is in your code, most likely some sort of syntax error (and nothing to do with depstar). So you'll have to start commenting out parts of that file to figure out where the error is.

seancorfield21:11:22

If it's up on GitHub where we can take a look at it, we'll probably be able to pinpoint the problem faster.

mynomoto21:11:25

It's a big private repository. I will follow your recommendation of commenting code until narrowing it, thanks. I suspected that it was not related to depstar but there is #aot 😉 Thanks!

seancorfield21:11:44

Compiling each namespace is a good way to check for syntax errors if your editor isn't running a linter 🙂

mynomoto21:11:01

After 2 namespaces of indirection and one rabbit hole I found the problem on one of our macros that is a def that keeps the metadata of the original var. Compiling each suspect namespace helped a lot. The jar is not working but this is another problem. Thanks!

1
seancorfield22:11:09

Thanks for reporting back @mynomoto!