-
Notifications
You must be signed in to change notification settings - Fork 23
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
build - compiling C files targeting static libraries. #175
Comments
Thanks for the bug report! Let me fix this immediately. |
Give |
Here is the code that I'm trying to build: I downloaded the latest release from the website and tried to build:
Files are still in the same order. I will also note that now when I run the build a second time (after this fails to build like this) I get:
Which I think is a bug. The build fails and there is no |
Pulling your repo now. |
Hi Carl, Okay, I've reproduced the issue, and based upon the shortcomings you exposed, I will change the heuristic that I use to de-duplicate the compiler flags. But even though the new heuristic is better, in the end, I realize now that it is impossible to solve this problem in its full generality. Here is a description of what was causing the error before. Your program in the end depends upon these two Stanza packages (among others): And they are declared to have these dependencies:
Based upon that, the system starts collecting a flat list of all the compiler files that are needed:
The system then de-duplicates these files by keeping only the first appearance of a file. So the de-duplicated set of files are now:
which results in the incorrect ordering that you were seeing. This heuristic can be improved for many common cases by changing the de-duplication algorithm. Instead of keeping the first appearance of a file, we can keep the last appearance of a file. This will result in:
which will work. So I'm going to push a new version of Stanza Now, here's the counter-example that shows there may still exist cases where this heuristic fails. Suppose you declared a third dependency like this:
Now the complete list of non-deduped files look like this:
And if we apply the keep-last-appearance heuristic to this list, we will get the following:
And we'll be back to our initial incorrect ordering again. Thank you for taking the time. |
So I think I understand now the heuristic you are using now - thanks for the detailed response. You might consider using the This would alleviate the problem and allow you to keep your existing heuristic. |
Oh that's a great tip. Let me look into this. Thanks! |
Stanza Thanks for the tip about |
Confirmed - I believe that is fixed in 0.17.40. Thank you! |
In an attempted work around of #174 - I tried to build a C wrapper that addresses
gsl_complex
by pointers instead of passing by value. Here I ran into another problem but with the build. I've setup my build like this:Here is the C file:
Here is my stanza file:
When I compile this - I get:
Note that it is only the functions in the static library that are failing. The
GSL_SET_COMPLEX
macro doesn't complain.Notice that the
cc
compiler arguments show the following:I'm pretty sure this is what is breaking the build. The compiler (gcc) will throw away any symbols in the static library
libgsl.a
that haven't been used in previous files. I've checked withnm
and the symbols forgsl_complex_*
are definitely there.Is there a reason why the files under the
ccfiles
directive are re-ordered with the*.c
files at the end ?The text was updated successfully, but these errors were encountered: