Compiling Clones for Fun and Profit

Hello, uh, Juliaistas? Juliaverse?

As part of my Julia journey, I have decided to work on a TCX parser (specifically this parser xue35/TCX.jl that would be useful for getting to my fitness data. While I have managed to figure out how to make the changes necessary to improve the library, I have been struggling to figure out how to properly test and update the project. I’ve tried looking up more information on packages and projects for whatever reason I’m finding it super confusing.

So some background on what I have done, it’s a little tricky since I’ve tried out a bunch of stuff, and at one point I did manage to get the tests working. Somewhere along the way, I messed up and something seems to be wrong, I’ll try to explain as best I can and answer any follow up questions. I cloned the repo to brotherjack/TCX.jl. In Julia I used the Pkg.develop() function to create a directory in my local julia dir, made changes there and managed to get the tests to pass.

Now since then, I have made more changes and when I activate the environment and try to run tests I get errors like:

WARNING: --output requested, but no modules defined during run
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for TCX [3b8c1752-506b-11e9-3f9b-8db86abc7c68]
│ exception = ArgumentError: Invalid header in cache file ~/.julia/compiled/v1.4/TCX/nbO7O_0StLh.ji.
└ @ Base loading.jl:1041
ERROR: LoadError: KeyError: key TCX [3b8c1752-506b-11e9-3f9b-8db86abc7c68] not found

I’m at a loss at where to go from here. If anyone can provide assistance, it would be greatly appreciated.

Julians :smile:

Which changes exactly? Can you explain it further?

4 Likes

Unfortunately, “exactly” no, but I can do “further”. It’s mostly a blur of adding and removing packages, activating this and then activating that, and I definitely deleted and re-forked the github repo at least twice. During all this, I’m pretty sure I did not alter Project.toml or Manifest.toml, but it’s quite possible that I did. If this sounds like a bumbling series of barely thought through actions, it’s because it is that and I am communicating effectively.

So rather than try and parse through that, it might be easier to try and state what I think the right way of doing this is, and then you can tell me what I’m doing wrong? Basically, here is the run down of how I think you are supposed to contribute to a project.

  1. Fork the repository using git
  2. Clone the forked repo to your machine
  3. Open a Julia REPL, go into package mode and run develop <path-to-project>
  4. cd to project in your local Julia directory
  5. Run activate . in package mode
  6. Open an editor / make changes / save
  7. Run test in package mode (this is where things blow up)

From what I can tell, by looking into the error, it looks like there is a problem with the using TCX statement on the first line of test/runtests.jl. Sorry forgot to include the stack trace in the first post, but here it is:

Stacktrace:
 [1] getindex at ./dict.jl:477 [inlined]
 [2] root_module at ./loading.jl:967 [inlined]
 [3] require(::Base.PkgId) at ./loading.jl:933
 [4] require(::Module, ::Symbol) at ./loading.jl:922
 [5] include(::String) at ./client.jl:439
 [6] top-level scope at none:6
in expression starting at /home/user/.julia/dev/TCX/test/runtests.jl:1
ERROR: Package TCX errored during testing

I’ve tried deleting the contents of /home/user/.julia/compiled/v1.4/TCX, but that doesn’t seem to do anything. I have the feeling it has something to do with that UUID. That it needs to be registered somewhere or updated or something. Does any of this help?

1 Like

You can skip those two steps. Instead, you can:

  • Clone the forked repo to your machine
  • cd into the folder you just cloned
  • activate ., make changes, run tests (as you described above)

As a test, what happens if you:

  • Rename ~/.julia to ~/.julia.backup
  • cd into the fork you just cloned (somewhere not in .julia)
  • activate . and test

?

You can put everything back to normal afterwards by deleting the ~/.julia that was just created and moving ~/.julia.backup back to ~/.julia.

3 Likes

Well, @rdeits, that’s an (interesting?) story. So I did that, and nothing changed, so I was about to report that, but then I realized I did not quite exactly follow your instructions. I left out clone the forked repo to your machine. So I did this, however unlike the last time, I did not clone into another directory (essentially it clones into ./TCX.jl by default). For whatever reason, probably the one you guessed, it worked!

I’m still a little confused as to why it is this way. One of the reasons I believe I was working on the .julia/dev path is because I was running into problems there. My best guess is that I messed something up in the environment file maybe? In any case, thanks for your assistance,

AH @rdeits, interesting wrinkle, that might shine light on what went wrong. So after posting that I checked out the development branch of my repo. Now the error is back. I think this is the crux of my problem. Does test only work on the main branch, or is there something I am doing/not doing?

I am almost sure that ] test does not look at the name of the selected branch to make decisions. However, the code of the package/repository is probably different between the branches and the one in the development branch may have errors that does not exist in the main branch. Did you try git diff main-branch-name development-branch-name to see the differences?

2 Likes

No, test should work on any branch equally well. I agree with @Henrique_Becker that this indicates something actually wrong with the code specifically on your branch.

3 Likes

@Henrique_Becker oh yes the code is definitely different, however the tests won’t load and instead I get this error: ERROR: LoadError: KeyError: key TCX [3b8c1752-506b-11e9-3f9b-8db86abc7c68] not found. Now that UUID is the one that is for the original TCX library I cloned. I did not change the Project.toml file and it contains that UUID, might the fact that I have the same Project file be a problem?

Did you remove the module header of the library?

I … am not sure what you intended, but I am almost sure this is the origin of the error. Can you try to explain to me why you did this? I am really curious.

1 Like

@Henrique_Becker and @anon37204545 Oh boy, I just looked at the TCX.jl file, and wow yeah that’s very wrong. It seems in all the chaos I managed to accidentally delete much of the code. I’m going to fix that up, and then go to my room and think about what I did :joy: :grimacing:

2 Likes

Deleting your code is the first step in reaching “the best way to write secure and reliable applications”, as noted in

So in essence, you did nothing wrong… :smile:

1 Like

I wish this could be a solution too. This person is a genius. We should stop all of this, programming has reached it’s dialectic endpoint. Why are we still doing this? Fetch the manager, tell him to SHUT THIS FORUM DOWN FORTHWITH!

2 Likes