aferrero2707 / PhotoFlow

A fully non-destructive photo retouching program providing a complete layer-based workflow including RAW image development.
http://aferrero2707.github.io/PhotoFlow
GNU General Public License v3.0
309 stars 36 forks source link

OSX Build - Stable Branch GMIC Error #64

Open Partha1b opened 8 years ago

Partha1b commented 8 years ago

I am getting the following error:

clang: warning: -framework CoreServices: 'linker' input unused In file included from /Users/partha/projects/src/gimp/plug-ins/Useful-Plugins/PhotoFlow/src/vips/gmic/vips_gmic.cpp:44: In file included from /Users/partha/projects/src/gimp/plug-ins/Useful-Plugins/PhotoFlow/src/vips/gmic/gmic/src/gmic.h:172: /Users/partha/projects/src/gimp/plug-ins/Useful-Plugins/PhotoFlow/src/vips/gmic/gmic/src/./CImg.h:175:10: fatal error: 'initializer_list' file not found # include "initializer_list" ``` ^ ``` 1 error generated. make[2]: **\* [src/CMakeFiles/pfbase.dir/vips/gmic/vips_gmic.cpp.o] Error 1 make[1]: **\* [src/CMakeFiles/pfbase.dir/all] Error 2 make: **\* [all] Error 2

I had to change the brackets around "initializer_list" since this box eats it.

aferrero2707 commented 8 years ago

Do you mean that changing

#include "initializer_list"

to

#include <initializer_list>

fixes the compilation problem?

Partha1b commented 8 years ago

No, I tried to include in my comment but I could not see it. Seeing that you can, I see I have to escape the brackets. :(

Anyway, I don't understand where that header is coming from. Clang does not find it.

aferrero2707 commented 8 years ago

On my system (OSX 10.10.5):

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/initializer_list

I can compile CImg.h without troubles... which OSX version are you using?

Partha1b commented 8 years ago

Yes, but try including minimum OSX version to target. I use -mmacosx-version-min=10.8. Otherwise people who use older OS will not be able to use my GIMP builds.

On Wed, Jan 6, 2016 at 8:25 AM, aferrero2707 notifications@github.com wrote:

On my system (OSX 10.10.5):

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/initializer_list

— Reply to this email directly or view it on GitHub https://github.com/aferrero2707/PhotoFlow/issues/64#issuecomment-169322150 .

aferrero2707 commented 8 years ago

I see... but then how did you manage to compile the G'MIC package? I'm just bundling the sources as they are...

Maybe the problem comes from the fact that I'm enabling C++11 features in the compiler options, and that is not available for older OSX versions?

I'm not sure I really need the C++11 stuff... could you try removing those two clang options

-std=c++11 -Wno-error=c++11-narrowing 

from the GMIC_FLAGS cmake variable at the top of src/CMakeLists.txt?

Partha1b commented 8 years ago

I have been compiling G'MIC with the same options.

I'll remove the c++11 stuff, but I can tell you that it works when I compile glib etc. and had to move to a minimum OSX version 10.8 to accommodate. Previously I was using a minimum version of 10.6.

On Wed, Jan 6, 2016 at 9:01 AM, aferrero2707 notifications@github.com wrote:

I see... but then how did you manage to compile the G'MIC package? I'm just bundling the sources as they are...

Maybe the problem comes from the fact that I'm enabling C++11 features in the compiler options, and that is not available for older OSX versions?

I'm not sure I really need the C++11 stuff... could you try removing those two clang options

-std=c++11 -Wno-error=c++11-narrowing

from the GMIC_FLAGS cmake variable at the top of src/CMakeLists.txt?

— Reply to this email directly or view it on GitHub https://github.com/aferrero2707/PhotoFlow/issues/64#issuecomment-169330124 .

aferrero2707 commented 8 years ago

Could you send me a full log of the compilation process using

make VERBOSE=1

to see the full compilation flags?

I'm testing the building process on my system with the -mmacosx-version-min=10.8 option, and everything seems to compile just fine... I'm a bit lost.

Partha1b commented 8 years ago

OK. I have included a zip archive of both my modifications to the CMakeCache.txt and the PhotoFlow-build.log.

You can find it here: http://www.partha.com/temp/PhotoFlow-build.zip

Thanks, Partha

On Wed, Jan 6, 2016 at 12:40 PM, aferrero2707 notifications@github.com wrote:

Could you send me a full log of the compilation process using

make VERBOSE=1

to see the full compilation flags?

I'm testing the building process on my system with the -mmacosx-version-min=10.8 option, and everything seems to compile just fine... I'm a bit lost.

— Reply to this email directly or view it on GitHub https://github.com/aferrero2707/PhotoFlow/issues/64#issuecomment-169399960 .

aferrero2707 commented 8 years ago

The build log does not contain the compiler invocation commands. Could you set

CMAKE_VERBOSE_MAKEFILE:BOOL=TRUE

in your CMakeLists.txt file to enable this feature, or add

-DCMAKE_VERBOSE_MAKEFILE=ON

to your cmake invocation?

Thanks!

Partha1b commented 8 years ago

OK, I've done this. You'll find the zipfile in the same location as above.

aferrero2707 commented 8 years ago

Honestly I do not see significant differences, apart from a different compiler executable being used.

Yours: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++

Mine: /Applications/Xcode.app/Contents/Developer/usr/bin/g++

Could you check if this file exists on your system: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/initializer_list

Also, could you check the includes search path of your compiler by adding the “-v” option to the compiler flags? In my case, it includes

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1

and that’s why the “initializer_list” header is correctly found…

Regards, A

Partha1b commented 8 years ago

Here you go: find /Applications/Xcode.app/Contents/ -name initializer_list /Applications/Xcode.app/Contents//Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/initializer_list

g++ -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1 Apple LLVM version 7.0.2 (clang-700.1.81) Target: x86_64-apple-darwin15.2.0 Thread model: posix

aferrero2707 commented 8 years ago

Hi Partha,

I have tried to compile photoflow on my system using

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++

as compiler instead of

/Applications/Xcode.app/Contents/Developer/usr/bin/g++

and I get the same problem as you have with the initialiser_list header…

My conclusion: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ is not the correct compiler to be used, use /Applications/Xcode.app/Contents/Developer/usr/bin/g++ instead.

In my case I am using jhbuild to automate the building process, and the toolchain is set-up automatically. I have used the following command to force the compiler to the same executable as you have:

CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd) -DINSTALL_PREFIX=$(pwd) ..

I hope this can help.

best, Andrea

On 09 Jan 2016, at 20:43, Partha1b notifications@github.com wrote:

Here you go: find /Applications/Xcode.app/Contents/ -name initializer_list /Applications/Xcode.app/Contents//Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/initializer_list

g++ -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1 Apple LLVM version 7.0.2 (clang-700.1.81) Target: x86_64-apple-darwin15.2.0 Thread model: posix

— Reply to this email directly or view it on GitHub https://github.com/aferrero2707/PhotoFlow/issues/64#issuecomment-170274067.

aferrero2707 commented 8 years ago

Did you manage to progress on this issue? Is there anything I can further try or test to help you out?

Thanks! Il 09/gen/2016 21:58, "Carmelo DrRaw" aferrero1975@gmail.com ha scritto:

Hi Partha,

I have tried to compile photoflow on my system using

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++

as compiler instead of

/Applications/Xcode.app/Contents/Developer/usr/bin/g++

and I get the same problem as you have with the initialiser_list header…

My conclusion: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ is not the correct compiler to be used, use /Applications/Xcode.app/Contents/Developer/usr/bin/g++ instead.

In my case I am using jhbuild to automate the building process, and the toolchain is set-up automatically. I have used the following command to force the compiler to the same executable as you have:

CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd) -DINSTALL_PREFIX=$(pwd) ..

I hope this can help.

best, Andrea

On 09 Jan 2016, at 20:43, Partha1b notifications@github.com wrote:

Here you go: find /Applications/Xcode.app/Contents/ -name initializer_list

/Applications/Xcode.app/Contents//Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/initializer_list

g++ -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1 Apple LLVM version 7.0.2 (clang-700.1.81) Target: x86_64-apple-darwin15.2.0 Thread model: posix

— Reply to this email directly or view it on GitHub https://github.com/aferrero2707/PhotoFlow/issues/64#issuecomment-170274067 .

aferrero2707 commented 8 years ago

I have checked once more my build environment, and I found that in my jhbuild set-up I am explicitly defining the C++ compiler like that:

os.environ['CXX'] = '/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -stdlib=libc++ '

By the way, it case it could be useful, my jhbuild environment is also on github:

https://github.com/aferrero2707/pf-build-osx

Hope this can help you.

Partha1b commented 8 years ago

Have you tested your build on a 10.8 system? Will there be a problem with systems earlier than current?

The reason I ask is that I use the minimum OSX version argument in my builds and I never had to define the compiler explicitly as you do.

On Fri, Jan 22, 2016 at 3:31 PM, aferrero2707 notifications@github.com wrote:

I have checked once more my build environment, and I found that in my jhbuild set-up I am explicitly defining the C++ compiler like that:

os.environ['CXX'] = '/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -stdlib=libc++ '

By the way, it case it could be useful, my jhbuild environment is also on github:

https://github.com/aferrero2707/pf-build-osx

Hope this can help you.

— Reply to this email directly or view it on GitHub https://github.com/aferrero2707/PhotoFlow/issues/64#issuecomment-174038139 .

aferrero2707 commented 8 years ago

Yes, I have this in my jhbuild configuration:

setup_sdk(target="10.8", sdk_version="native", architectures=[_default_arch])

which results in the following compiler flags:

-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -mmacosx-version-min=10.8 

I think I've taken the definition of the CXX environment variable from some other project (probably VIPS), but definitely using in my system

 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++

as you do results in the same error as you have...

Partha1b commented 8 years ago

So, I am guessing you haven't tested it on an older OSX machine.

Another question. This only shows up during G'MIC build within PhotoFlow. However, I can build G'MIC just fine with my environment. So, is it possible to use the native G'MIC or modify the version included with PhotoFlow so we don't get this error?

On Fri, Jan 22, 2016 at 4:39 PM, aferrero2707 notifications@github.com wrote:

Yes, I have this in my jhbuild configuration:

setup_sdk(target="10.8", sdk_version="native", architectures=[_default_arch])

which results in the following compiler flags:

-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -mmacosx-version-min=10.8

I think I've taken the definition of the CXX environment variable from some other project (probably VIPS), but definitely using in my system

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++

as you do results in the same error as you have...

— Reply to this email directly or view it on GitHub https://github.com/aferrero2707/PhotoFlow/issues/64#issuecomment-174058685 .

aferrero2707 commented 8 years ago

I might have the possibility to get my hand on a 10.8 machine next week, in which case I'll immediately test my builds and let you know if they work.

As for now, in the stable branch I have explicitly disabled the C++11 features in the CImg.h file shipped with photoflow, which should temporarily solve your compilation issue. You'll need to do a

git pull origin stable

to update your local repository.

However I would like to better understand what is going on... Would it be possible for you to send me a copy of the compilation messages for your G'MIC build? A simple

make >& make_gmic.log

or similar would be ok. Maybe this way I can get an idea of what is really the difference.

Thanks!

Partha1b commented 8 years ago

Hey, that's great!! :)

Yes, I will send you a log of my G'MIC compilation.

On Fri, Jan 22, 2016 at 5:17 PM, aferrero2707 notifications@github.com wrote:

I might have the possibility to get my hand on a 10.8 machine next week, in which case I'll immediately test my builds and let you know if they work.

As for now, in the stable branch I have explicitly disabled the C++11 features in the CImg.h file shipped with photoflow, which should temporarily solve your compilation issue. You'll need to do a

git pull origin stable

to update your local repository.

However I would like to better understand what is going on... Would it be possible for you to send me a copy of the compilation messages for your G'MIC build? A simple

make >& make_gmic.log

or similar would be ok. Maybe this way I can get an idea of what is really the difference.

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/aferrero2707/PhotoFlow/issues/64#issuecomment-174070575 .

aferrero2707 commented 8 years ago

I've checked the G'MIC Makefile, and I see that it defines

CC = g++

at the very beginning. Could it be the reason why the correct compiler gets picked in your case when compiling G'MIC?

In the photoflow case, the compiler (actually the whole toolchain) needs to be defined externally, and in my case this is done automatically by jhbuild.

Partha1b commented 8 years ago

I am unable to provide you the logfile yet since gmic.eu is down.

I have modified the Makefile to fit my environment as follows: $(CC) -o gmic_gimp gmic_gimp.cpp gmic_gimp.o -Dgmic_gimp /tmp/gimp2.9series/McGimp-2.9.app/Contents/Resources/bin/gimptool-2.0 --cflags $(CFLAGS) /tmp/gimp2.9series/McGimp-2.9.app/Contents/Resources/bin/gimptool-2.0 --libs $(LIBS)

STD_GIMP_CFLAGS = -Dcimg_use_rng -Dgmic_build -Dcimg_display=0 -Dcimg_use_zlib -I$(USR)/include $(FFTW_CFLAGS) $(PNG_CFLAGS) $(ZLIB_CFLAGS) ${IS_BETA_CFLAGS} -I/Users/partha/local/include -O3 -ffast-math -ftree-vectorize -mmacosx-version-min=10.8 STD_GIMP_LIBS = $(MANDATORY_LIBS) $(PNG_LIBS) $(CURL_LIBS) $(FFTW_LIBS) -headerpad_max_install_names

I guess you are right about CC = g++ pulling in the correct compiler.

On Sat, Jan 23, 2016 at 9:59 AM, aferrero2707 notifications@github.com wrote:

I've checked the G'MIC Makefile, and I see that it defines

CC = g++

at the very beginning. Could it be the reason why the correct compiler gets picked in your case when compiling G'MIC?

In the photoflow case, the compiler (actually the whole toolchain) needs to be defined externally, and in my case this is done automatically by jhbuild.

— Reply to this email directly or view it on GitHub https://github.com/aferrero2707/PhotoFlow/issues/64#issuecomment-174192128 .

aferrero2707 commented 8 years ago

In my case, the equivalent of the gimptool-2.0 calls is the following line in the CMakeLists.txt file

pkg_check_modules(GIMP gimp-2.0>=2.9.0)

This sets the appropriate C_FLAGS and LIBS flags.

Maybe you could try to add an explicit definition of the CXX variable in the call to cmake while building photoflow:

CXX="g++ -stdlib=libc++ " cmake ...

This should force the use of the g++ compiler.

Partha1b commented 8 years ago

OK, decided to start all over again: My command line:

CXX="g++ -stdlib=libc++ " cmake -DCMAKE_CXX_FLAGS="-O3 -ffast-math -ftree-vectorize -mmacosx-version-min=10.8" -DCMAKE_EXE_LINKER_FLAGS="-headerpad_max_install_names" -DCMAKE_INSTALL_PREFIX=./Release ..

Now it built. :) Time to test it with McGimp.

On Sat, Jan 23, 2016 at 3:08 PM, aferrero2707 notifications@github.com wrote:

In my case, the equivalent of the gimptool-2.0 calls is the following line in the CMakeLists.txt file

pkg_check_modules(GIMP gimp-2.0>=2.9.0)

This sets the appropriate C_FLAGS and LIBS flags.

Maybe you could try to add an explicit definition of the CXX variable in the call to cmake while building photoflow:

CXX="g++ -stdlib=libc++ " cmake ...

This should force the use of the g++ compiler.

— Reply to this email directly or view it on GitHub https://github.com/aferrero2707/PhotoFlow/issues/64#issuecomment-174216729 .

aferrero2707 commented 8 years ago

Sounds great! Looking forward for your feedback...