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

Apothecary: FreeImage 3.16.0 #3143

Closed
wants to merge 24 commits into from

Conversation

bakercp
Copy link
Member

@bakercp bakercp commented Aug 11, 2014

Update apothecary build scripts and header / static libs for FreeImage 3.16 (the latest tagged version).

Static libs for architectures included:

  • OSX FAT (32 bit w/ libstdc++ and 64 bit w/ libc++)
  • iOS FAT (armv7, armv7s, arm64, i386 and x86_64 w/ libc++)
  • Android - armeabi (@arturoc ?)
  • Android - armeabi-v7a (@arturoc ?)
  • Android - x86 (@arturoc ?)
  • VS
  • win_cb

The following platforms use pkg-config system libs

  • Linux (32 bit)
  • Linux (64 bit)
  • Linux Armv6l
  • Linux Armv7l

Notes:

  • Before committing the FreeImage.h I had to convert the line endings to LF. Apparently it is shipped with CRLF.
  • Most linux distros seem to currently ship with v 3.15.* Theoretically this shouldn't be a problem, as linux uses pkg-config headers.
  • On win_cb / vs, we simply download extract and copy the precompiled libs. The same .lib and .dll work on both win_cb and vs, resulting in duplicated files. Using precompiled libs is much simpler than compiling manually w/ mingw, as their toolchain setup is very specific.

@bakercp bakercp added this to the 0.9.0 milestone Aug 11, 2014
@bakercp bakercp changed the title Apothecary: FreeImage 3.16.0 Apothecary: FreeImage 3.16.0 (In Progress) Aug 11, 2014
@bakercp bakercp changed the title Apothecary: FreeImage 3.16.0 (In Progress) Apothecary: FreeImage 3.16.0 Aug 11, 2014
@bakercp bakercp mentioned this pull request Aug 11, 2014
11 tasks
typedef uint32_t DWORD;
typedef int32_t LONG;
typedef int64_t INT64;
typedef uint64_t UINT64;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bakercp - we did this #define approach ( combined with #undefine at the end of the file ) for a while now because MS complains about types being defined already. Its always been a bit of a dirty hack, but it was the only way to get it to compile without errors. did you have a fix for this issue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied it directly from their source folder -- I didn't realize it was an oF mod. I'm compiling it on win right now (as I type this), so I'll test it and update if the errors come up.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested on both vs2012 and win_cb with the attached static libs / dylibs and updated 3.16.0 header and both linked and compiled fine without any header mods -- so, for the moment, I think I'll leave it as is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to leave it as-is if it works - patched library files will be a pain to keep up-to-date (as this example shows). If we have to patch them, we should do it in apothecary so at least we can keep track of the changes automatically, and preserve patches across lib updates.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed - hopefully it doesn't crop up!
just wanted to make a note of it as it was a common part of the process of updating free image.
we could definitely add it as a patch step to apothecary if needed.

@bakercp
Copy link
Member Author

bakercp commented Aug 11, 2014

@ofTheo @arturoc Can either of you explain why there are static FreeImage libs in the $OF_ROOT/libs/Freeimage/vs|win_cb dirs and also FreeImage.dll dynamic libs in the export folder? The programs won't run without the dlls, but I'm just wondering why we have both ... I'm quite inexperienced on the windows side (but learning quickly :))

@arturoc
Copy link
Member

arturoc commented Aug 12, 2014

some libraries just do that, if you compile it and don't get a dll then it's fine to remove it from export. there must be a way to avoid it but last time i compiled it i couldn't find it

@ofTheo
Copy link
Member

ofTheo commented Aug 12, 2014

@bakercp if FreeImage is build dynamically it needs a stub lib and a dll. the stub lib is a super light lib which tells the compiler to search for those methods on runtime.

I don't know why we have FreeImage as dynamic on windows, it would be great if we could build it statically!

@bakercp
Copy link
Member Author

bakercp commented Aug 12, 2014

@ofTheo -- ok that makes sense. I'm fairly confident the current FreeImage.lib in this PR is a full static lib (which means we could drop the dll from exports) -- but I'll do a bit more research.

@danoli3
Copy link
Member

danoli3 commented Aug 25, 2014

@bakercp want me to have a look at compiling the iOS FreeImage?

@bakercp
Copy link
Member Author

bakercp commented Aug 25, 2014

For sure :)

@danoli3
Copy link
Member

danoli3 commented Aug 27, 2014

Just noticed we should be running strip -x $lib.a on the libs.
For example: FreeImage for iOS got up to 130mb fat lib, even with -02 (too big for git)
After running strip on it, it's down to 29mb

Current oF libs up there < 0.8+ have already been stripped of these symbols.

danoli3 and others added 3 commits August 27, 2014 12:21
…6, x86_64)

- Custom makefile for iOS created to put power of target arch into the
Apothecary script and bypass errors
- In line hot fixes for arm64 for some of the sub-libraries of
FreeImage.
Apothecary: FreeImage iOS Formula + libs
@danoli3
Copy link
Member

danoli3 commented Sep 4, 2014

Okay I found some major issues with LibJXR for OSX / iOS.
May be that symbolic linking errors you were having @bakercp. I've been able to fix it, but with quite extensive patching of LibJXR. I'll work out how to make a patch for it and submit it with an updated script.

Basically without modification the C source files link and predeclare functions that are not within the bounds of the object that is compiled, so predeclaring example_function in abc.c however it is implemented in another c file called abcdef.c. So when it comes to linking the symbols together it can't find that implementation = symbolic issue.

FreeImage should not have included this new lib without testing it! Bad #freeimage ;D

@bakercp
Copy link
Member Author

bakercp commented Sep 4, 2014

Interesting thanks for sticking with it ...

@danoli3
Copy link
Member

danoli3 commented Sep 4, 2014

It all became apparent when compiling all the libs together.. I think we are still missing the formula for glu as well. Any idea how we compiled this one before?

@tgfrerer
Copy link
Member

tgfrerer commented Sep 4, 2014

Are you sure are we still using glu? I believe the last hold-out was in texture mipmaps, and that's been taken care of in #3146.

@danoli3
Copy link
Member

danoli3 commented Sep 4, 2014

Ah yes! Awesome, better if it is removed :) I'll try that out.

On 4 September 2014 18:21, Tim Gfrerer notifications@github.com wrote:

Are you sure are we still using glu? I believe the last hold-out was in
texture mipmaps, and that's been taken care of in #3146
#3146.


Reply to this email directly or view it on GitHub
#3143 (comment)
.

@pizthewiz
Copy link
Member

From #2542, @julapy mentioned that PIE needs to be enabled for the iOS formula.

@ofTheo
Copy link
Member

ofTheo commented Sep 15, 2014

is it okay to update the list with iOS as done?

@danoli3
Copy link
Member

danoli3 commented Sep 15, 2014

Not finished yet, 90% there. Still have some symbol link errors when
binding, mainly due to some broken third party Microsoft code that
FreeImage added in. Almost fixed all of them.

On 15 September 2014 23:54, Theodore Watson notifications@github.com
wrote:

is it okay to update the list with iOS as done?


Reply to this email directly or view it on GitHub
#3143 (comment)
.

@danoli3
Copy link
Member

danoli3 commented Oct 7, 2014

For OSX + Poco Issues. I just noticed __ANSI__ in the build script.

IE:

The name -ansi is, strictly speaking, incorrect; it refers to the 1989 ANSI C standard, but ANSI itself considers that standard to be obsolete; it was replaced by the 1999 ISO C standard (which ANSI officially adopted shortly after it was released) which itself either has been, or soon will be, replaced by the new 2011 ISO C standard. But changing the meaning of the -ansi option would break too many Makefiles and build scripts."

http://stackoverflow.com/questions/10300114/should-i-use-ansi-or-explicit-std-as-compiler-flags

@bakercp
Copy link
Member Author

bakercp commented Oct 7, 2014

@danoli3 Yeah, that was required (at least at the time) to get it to compile. More here:

http://sourceforge.net/p/freeimage/discussion/36111/thread/a9cc87b6/

And other places as well ..

@danoli3
Copy link
Member

danoli3 commented Oct 7, 2014

I wonder if -D__ANSI__ is the same as -ansi
As the -ansi option is equivalent to -std=c90 and could be causing those ABI/API libc++/libstd++ issues when linked against say Poco, which is definitely libc++.

So if FreeImage was calling say the libpng code from Poco's code, and the FreeImage code was libstd++ and the Poco code calling it was libc++, would definitely explain the error.

Good reference for this issue:
http://stackoverflow.com/questions/17450130/what-is-a-good-way-of-handling-abi-differences-between-libc-and-the-older-libs

- Fixes symbolic linking issues by patching FreeImage (patch sent to
FreeImage repo as well).  https://github.com/danoli3/FreeImage
- Patch
danoli3/FreeImage@f069aaefc6724fa9c8065a47000b
31212024e9d6.patch
- Fixes broken make file from FreeImage 3.16.0
- Fixes broken clean script from FreeImage 3.16.0
- Architectures arm64, armv7, armv7s, i386, x86_64
@danoli3
Copy link
Member

danoli3 commented Oct 14, 2014

Okay finally fixed FreeImage for iOS!! Added Pull to @bakercp fork bakercp#15

I've already tested all the libs together now and it's working :D!!
https://github.com/danoli3/openFrameworks/tree/0.9.0-All

@bakercp
Copy link
Member Author

bakercp commented Nov 24, 2014

@danoli3 -- can we merge this? It's looking OK from here.

@danoli3
Copy link
Member

danoli3 commented Nov 24, 2014

Yeah this was working great last I tested.
Should we cherry pick out the libraries first?

Still have to remove iOS armv7s from script and rebuild

On Tuesday, November 25, 2014, Christopher Baker notifications@github.com
wrote:

@danoli3 https://github.com/danoli3 -- can we merge this? It's looking
OK from here.


Reply to this email directly or view it on GitHub
#3143 (comment)
.

@bakercp
Copy link
Member Author

bakercp commented Nov 25, 2014

Yeah, if you want to cherry-pick and fix the script for armv7s, that then we can make a clean build like openssl and poco and hopefully get this all merged in the next day or two ...

@ofTheo
Copy link
Member

ofTheo commented Feb 8, 2015

I think we can close this now right? now that #3446 has been merged?

@admsyn
Copy link
Member

admsyn commented Mar 8, 2015

Going to close this, as it looks like #3446 has covered it

@admsyn admsyn closed this Mar 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants