Exiv2 / exiv2

Image metadata library and tools
http://www.exiv2.org/
Other
893 stars 279 forks source link

Unable to build with Xcode using CMake #84

Closed clanmills closed 6 years ago

clanmills commented 6 years ago

Work around is to replace xmpsdk/CMakeLists.txt with http://github.com/clanmills/exiv2/xmpsdk/CMakeLists.txt

piponazo commented 6 years ago

@clanmills could you give me some more details about your error with XCode ? I would like to be able to reproduce the problem in my Mac.

Questons?

clanmills commented 6 years ago

I'm currently using Xcode 9.0 and MacOSX 10.12.6. I don't believe the issue is version related.

I can reproduce the with the Xcode IDE and xcodebuild (the command-line version of Xcode).

  645  21:00:11 cd ~/temp
  646  21:00:14 del exiv2
  647  21:00:29 git clone https://github.com/exiv2/exiv2
  648  21:09:05 cd exiv2
  649  21:09:11 mkdir build ; cd build 
  650  21:09:18 cmake .. -G Xcode
  651  21:10:53 xcodebuild -project exiv2.xcodeproj/

The build fails with:

2.26.0.0_dependency_info.dat -o /Users/rmills/temp/exiv2/build/lib/Debug/libexiv2.26.0.0.dylib
clang: error: no such file or directory: '/Users/rmills/temp/exiv2/build/lib/Debug/libxmp.a'

** BUILD FAILED **
$

Using CMake Generator "Unix Makefiles" produces a solid/working version of exiv2 (and sample applications). However it's a lot more (undocumented) work to use Xcode as a debugger on that build.

piponazo commented 6 years ago

I just tried with my Mac and the Xcode and I'm getting errors too, but others:

CompileC build/src/exiv2.build/Debug/exiv2lib.build/Objects-normal/x86_64/version.o src/version.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/pix4d/Luis/exiv2
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch x86_64 -fmessage-length=203 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\"Debug\" -Dexiv2lib_EXPORTS -DEXV_LOCALEDIR=\"share/locale\" -DEXV_BUILDING_LIB -DEXV_HAVE_DLL -DXML_STATIC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -mmacosx-version-min=10.12 -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -I/Users/pix4d/Luis/exiv2/build/lib/Debug/include -I/Users/pix4d/Luis/exiv2/build -I/Users/pix4d/Luis/exiv2/build/src -I/Users/pix4d/Luis/exiv2/xmpsdk/include -I/Users/pix4d/Luis/exiv2/include/exiv2 -I/Users/pix4d/Luis/exiv2/include -I/Users/pix4d/Luis/exiv2/build/src/exiv2.build/Debug/exiv2lib.build/DerivedSources/x86_64 -I/Users/pix4d/Luis/exiv2/build/src/exiv2.build/Debug/exiv2lib.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/pix4d/Luis/exiv2/build/lib/Debug -std=gnu++98 -fPIC -MMD -MT dependencies -MF /Users/pix4d/Luis/exiv2/build/src/exiv2.build/Debug/exiv2lib.build/Objects-normal/x86_64/version.d --serialize-diagnostics /Users/pix4d/Luis/exiv2/build/src/exiv2.build/Debug/exiv2lib.build/Objects-normal/x86_64/version.dia -c /Users/pix4d/Luis/exiv2/src/version.cpp -o /Users/pix4d/Luis/exiv2/build/src/exiv2.build/Debug/exiv2lib.build/Objects-normal/x86_64/version.o
/Users/pix4d/Luis/exiv2/src/version.cpp:149:14: error: no type named 'smatch' in namespace 'std'
        std::smatch m;
        ~~~~~^
/Users/pix4d/Luis/exiv2/src/version.cpp:150:23: error: no member named 'regex_search' in namespace 'std'
        bPrint = std::regex_search(Key,m,*g) || std::regex_search(value,m,*g);
                 ~~~~~^
/Users/pix4d/Luis/exiv2/src/version.cpp:150:54: error: no member named 'regex_search' in namespace 'std'
        bPrint = std::regex_search(Key,m,*g) || std::regex_search(value,m,*g);

I will investigate ;)

piponazo commented 6 years ago

It seems that there is a problem with the CMake OBJECT library concept and the Xcode generator:

https://public.kitware.com/pipermail/cmake/2016-April/063169.html

I will investigate a bit more since I am curious. However, since this OBJECT library approach does not bring much benefits I am happy to revert those changes if I do not find a solution soon.

Kicer86 commented 6 years ago

@piponazo the build errors you have are the result of what I was saying here: #91

piponazo commented 6 years ago

Yes, exactly. I will close this issue since now the code compiles correctly with XCode. The only remaining issue is the problem with the c++11 regex we are using. That will be fixed to ;)