Skip to content
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

Nasty hack to compile on Apple's OSes #8

Closed
roymacdonald opened this issue Apr 14, 2017 · 4 comments
Closed

Nasty hack to compile on Apple's OSes #8

roymacdonald opened this issue Apr 14, 2017 · 4 comments

Comments

@roymacdonald
Copy link
Owner

I came across a really nasty compilation error, for which I couldn't find anything by googling (I didn't try that hard though ;) ).
For some reason that I don't know or understand, there are several objects named nil in dlib's code, like this., which collides with Apple's definition for nil which roughly is #define nil nullptr. So out of all I tried the only fix was to add the following in my addons .h files that were bothering

#if defined(TARGET_OSX) || defined(TARGET_OF_IPHONE) || defined(TARGET_OF_IOS)
#ifdef nil
#undef nil
#endif
#endif

This is clearly not a good idea, which could bring even nastier problems.
Has anyone seen this before? know how to fix/overcome it? @bakercp , @genekogan @HalfdanJ @stephanschulz

On the previous version of this addon, dlibs source files were modified by @stephanschulz, in order to be able to compile. This approach requires patching on every dlib update and will break the apothecary implementation.

I'm not sure if it would be possible to fix this by using sed and some regex in the apothecary script, maybe it works. I'll give it a try but it is not very elegant.

@bakercp
Copy link

bakercp commented Apr 14, 2017

I think this should be fixed upstream ...

@roymacdonald
Copy link
Owner Author

@bakercp I also think so. I already opened an issue and made a PR.. hope it gets merged.

@roymacdonald
Copy link
Owner Author

My PR got merge in dlib. Fixed !

@bakercp
Copy link

bakercp commented Apr 15, 2017

Nice work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants