-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
not getting PIC for shared library #613
Comments
I notice this has been reported and fixed once before. Is it in the test suite? |
tested with dub 0.9.23 and git HEAD |
Hitting this too. |
Okay, sneaked the fix in before release ;) Would be good if someone could test if this also fixes more complex scenarios, I just tested building a |
I think this isn't fixed indeed. I have a non-trivial scenario here: https://github.com/p0nce/dplug/blob/master/examples/distort/dub.json In non-combined here is the System: DUB master, DMD 2.067.1, Ubuntu My understanding is that |
Ah, right, didn't think of that. This will require some deeper changes, because the static library files will have to get a different hash value in the build cache folder. It will probably also mean that if the same static library is used for both, a dynamic library and an executable, the PIC version will also be used for the executable, even if that isn't ideal. I don't think it will be possible to map that to other build systems otherwise. |
Unfortunately because of DMD codegen bugs, I tend to rely on sub-packages with {optimization | inlining} disabled so
Sorry I don't understand this sentence, does this happen even if such builds get different hash values? . |
The problem is that each package corresponds (at most) to a single binary target during a single build. Think of a VisualStudio solution where you'd just be able to insert each project once and would have to decide for each if it should be built with or without -fPIC. So if the same static library package is referenced both by a dynamic library and an executable within the same dependency graph, it will be necessary to generally enable -fPIC for it. Now it would be possible to work around that, especially within DUB's own builder, but I'm not sure how good that idea would generally be. |
OK I see. I found it strange because in my DUB use cases only the top-level project is possibly an executable or a shared library, everything else is a source library. |
-fPIC has been DMD's default since 2.072 for 64-bit builds. |
I'm pretty sure the bug this was re-opened for was resolved here |
Cool. Closing then. @p0nce feel free to reopen if this is incorrect |
@wilzbach , definately no problem here :) |
on ubuntu 15.04 x86_64
A simple 1-file project with
"targetType": "dynamicLibrary"
doesn't get compiled with -fPICThe compile step, as reported by
dub -v build
isdmd -c -of.dub/build/library-debug-linux.posix-x86_64-dmd_2067-FA32B08D9C0006B2A066E7CC872D6501/ppyd.o -debug -g -w -version=Have_ppyd ppyd.d
The text was updated successfully, but these errors were encountered: