Ticket #13336 (closed defect: fixed)
farey_symbol.pyx fails to build on Cygwin
| Reported by: | jpflori | Owned by: | tbd |
|---|---|---|---|
| Priority: | major | Milestone: | sage-5.3 |
| Component: | porting: Cygwin | Keywords: | cygwin linking |
| Cc: | Work issues: | ||
| Report Upstream: | N/A | Reviewers: | Dmitrii Pasechnik |
| Authors: | Jean-Pierre Flori | Merged in: | sage-5.3.beta1 |
| Dependencies: | Stopgaps: |
Description (last modified by jpflori) (diff)
Because of DL_IMPORT stuff in headers generated by Cython and corresponding _ _ imp _ _ prefixes added in object files, farey.o cannot be linked to farey_symbol.o (it could with farey_symbol.dll if we generated it...).
The patch here does not include farey_symbol.h but directly declare the prototype of the needed functions in farey.cpp, with the extern "C" stuff but without the dllspec(import) stuff.
Attachments
Change History
comment:2 follow-up: ↓ 4 Changed 11 months ago by jpflori
Yes... In fact we'll get the same problem later with the wrapper_* things in ext/interpreter.
What's strange is that I don't remember getting it here the last time. But I kind of so much tweaked the files back then that it must have been that as well.
I think the problem is as follows: As convert_* are declared extern in farey_symbol.h (from the public modifier in farey_symbol.pyx) g++ adds _ _ imp _ _ prefixes in farey.o. Then if you actually build a dll of farey_symbol.cpp alone and link a dll of farey.o alone to it ld is fine. But when you want to directly link farey_symbol.o and farey.o together, ld whines...
comment:3 Changed 11 months ago by jpflori
And obviously I've deleted my 5.1.rc1 install so I have to figure out what let the files compile the last time :)
comment:4 in reply to: ↑ 2 Changed 11 months ago by jpflori
Replying to jpflori:
I think the problem is as follows: As convert_* are declared extern in farey_symbol.h (from the public modifier in farey_symbol.pyx) g++ adds _ _ imp _ _ prefixes in farey.o. Then if you actually build a dll of farey_symbol.cpp alone and link a dll of farey.o alone to it ld is fine. But when you want to directly link farey_symbol.o and farey.o together, ld whines...
This seems to be the problem. If you remove the DL_IMPORT lines in farey_symbol.h (generated by Cython), you'll link correctly.
I've got some ideas from here: http://stackoverflow.com/questions/3704374/linking-error-lnk2019-in-msvc-unresolved-symbols-with-imp-prefix-but-shoul
comment:6 Changed 11 months ago by jpflori
- Keywords cygwin linking added
- Status changed from new to needs_review
- Description modified (diff)
- Authors set to Jean-Pierre Flori
comment:7 Changed 11 months ago by dimpase
OK, this does the trick here. I'll give it a positive review as soon as the patchbot gives OK. The next stop looks like a ginac-related problem at #13337
comment:8 Changed 11 months ago by dimpase
- Status changed from needs_review to positive_review
Looks good.
comment:10 Changed 10 months ago by jdemeyer
- Status changed from positive_review to closed
- Resolution set to fixed
- Merged in set to sage-5.3.beta1


with these flags on, I still get
So it looks like that the linker cannot find objects which are part of the Farey module (i.e. from sl2z.o, etc)?!
Looks like some g++/dll linking weirdness to me.