-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install and test embedding examples #8757
Comments
Ok seems like I'm the guy to do this, as I'm likely the one that would benefit most from it. Is there any sort of introductory information, etc? |
Our current I've seen this done really well in a few autotools projects, but I think for this isolated case we can do something simpler without needing to redo the rest of the build system. If you happen to have done |
The critical question on OS/X and Linux is where are the header files (for -I) and where is libjulia.so (for -L and -rpath). Is that all occurring assuming it's been deployed (like in /usr/local?), or is the directory known? On Windows, I don't know. Is this something that will be part of Travis and how does it get invoked? It would be pretty easy to pull together an autotools config that will look for Julia in a bunch of standard places, but problem with autotools is on Windows, doesn't that imply cygwin? |
So, the top-level makefile that does |
If autotools, there there would eventually be some variable INSTALLDIR which could be overridden on the command line to point to the exact path during compilation, otherwise it searches, autotools style. For reference, here's an approach to do that definitely not autotools style, but gives an idea about where to look. Maybe some simplified version of this in a bash-autotools way? |
We have a bunch of pseudo-autotools-ish variables like that in our makefiles already. For install-time logic it probably makes sense to do the file modifications as part of the install target in the top-level Julia makefile. Instead of doing any searching through system paths, I think we can set a default (relative?) path based on the normal layout of an install. Ideally set up in such a way that if distributions customize the installation layout, that would get reflected in the default path we put in the embedding makefile. |
I think there are at least a couple distros like that. pg_config and pythonX.Y-config come to mind. How about in addition to the julia executable there's a program called julia-config? There are a few holes, though, what if Julia is installed multiple times in different locations (simultaneously 0.3 and 0.4) then what? Actually, looks like the python-guys thought of that. How to find julia-config? Maybe assume the user will install in such a way so that the Julia he wants to use will have the corresponding julia-config first in PATH. |
That might not be a bad idea, llvm and pcre have the same sort of thing. There's also the classic, but marginally difficult-to-use-on-Windows, option of shipping a |
I'm wondering out loud here if, aside from any modifications to the embedding example, the more complicated aspects of this can be done out in a central package, |
Yea right now we're all a bunch of kangaroo's jumping around. We'd all jump to a common thing if it fit our needs. I'm wary of something like EmbeddingConfig/PkgConfig.jl unless it was guaranteed part of base or Pkg.update() is not required as It needs to respond quickly and never fail. Putting stuff in a Pkg allows for the flexibility of the meta information contained by the package to change when the Julia install does not change. Would that be useful? |
I guess the argument elsewhere was "if it needs to be kept up-to-date with changes to base, it should be in base" but I'm also not sure how often these things will change. The slowness of |
Should we target this for 0.3.4, or is it too close and go for 0.3.5? |
I think this is an 0.4 target, not an 0.3.x one. It can probably be backported when it's ready, but there isn't even a PR for it yet and 0.3.4 is scheduled for a few days from now... |
I'll try something and we can at least talk about something concrete, but yea, I don't see it happening in a few days. |
Can you point me to a list of the pseudo helper tools so I can kind of get jump started? I'm going to start with the approach of having an auxillary program called julia-config like above, and it would be good if it were written in Julia if possible. Would such a thing be fast enough? |
You're going to be looking at |
What do you mean by "pseudo helper tools"? As with the |
You'll also likely want to look at the already-autogenerated file Though I think all of those end up going into |
Whoops, I meant the "pseudo-autotools-ish variables" you mentioned above. |
okay, yeah, see the lines @staticfloat linked to ( Lines 93 to 104 in 3109867
|
Darn, forgot to canonicalize! Tony catches so many of my mistakes, it's rather embarrassing. :P |
Linus' law. Our eyeballs just happen to be frequently pointing at the same bits of code. |
+1 installing the embedding example. But for Travis testing wouldn't it suffice to build and execute the example in a source build? This would have to be invoked by the regular unit test framework. |
Sorry, I haven't really followed this conversation, but my 2c is that I'd prefer tests to be only in |
Partially, not completely. Testing the embedding example in a source build only makes sure we don't break it in a source build. Testing it from the installed copy makes sure it works in an install, which would be more valuable. |
Is #9438 useful here as a means of creating a julia-config? |
Don't think so. That approach is temporary anyway. If you are operating under the assumption that Julia has to be installed in order to build an application that embeds it, then you don't need to go to any lengths to make a julia-config script usable in a standalone way. Just install it to |
I copied the embedding.c file from examples into a test directory and modified embedding.c and Makefile to follow the pattern in #10069: One change to embedding.c:
changed to
and then the makefile changed to
followed by make, then running it....
|
cool, that's the expected output, right? |
Ya, pretty sure. I can check it. But, is there a thing that does it automatically? How much do I need to modify, and how much to add? Is there a thing that installs Julia in test yet for instance? |
We install julia on Travis. That code is getting a bit messy but we can fiddle with it. It would be ideal to make Also the path to the |
I didn't look ultra deeply, but it appeared that all Makefile does is build embedding, if so then modifying like above should do it, so long as Julia is in PATH, everything else is automatic. Is the examples directory installed somewhere? Does make test do this? |
Or the location is easy to specify by overriding a
I believe
There is a |
Ok I know now this must be completed. There is no check for changes that break embeddings, and it happens a lot. To fix this, I need some help in understanding how the current test suite functions and how a new embed test would need to work (HELP). As I said (months ago, heh) this should be pretty easy, but currently I am not familiar at all with this test, what occurs, how it runs. A good start would be can someone tell me what to run the test locally? Like "make test" or something? |
Yeah, start with |
This would be different. This would need to make and run an external test separated from all of that seems like. Maybe what could be done is in embedding.jl there could be some invocation of external commands: make embed1,embed2, etc. It would also need to occur against an "installed" version of julia as opposed to within the source tree if it's going to be accurate. I'm not sure that the current test framework imagines that something like that could happen. |
Maybe not. Travis at least does do Maybe another option would be to use the framework of a Julia package to set up this testing? With PackageEvaluator and Travis at least it will run pretty regularly and in a mostly-automated way. Could have an EmbeddingExamples.jl package with code snippets, build scripts, etc? Not sure if that's better or worse than having things live in the base repository but not tested very often. |
@twadleigh sounds like you're about to do at least the test part of this? xref #11419 and #18265 |
Mostly fixed by #21299, subject to some rpath caveats. We're not putting the built embedding executable in binaries just yet, but the rest of this is done now. |
I'm starting to think we should install
examples/embedding.c
andexamples/Makefile
along withexamples/*.jl
and test on Travis that it keeps working in an installed version of Julia. For this to make sense, the makefile would need to be modified quite a bit (or a new one autogenerated?) to be standalone.Related to #8428, cc @nalimilan
The text was updated successfully, but these errors were encountered: