Modification for compiling under clang(OS X)

Issue #7 resolved
Former user created an issue

There are a lot of troubles to resolve on OS X... First, it seems qmake does not look for headers and libs of vapoursynth. However, simply evaluating $(pkg-config --cflags vapoursynth) (and of course --libs) will give a include path where vapoursynth.h is already there, and the source includes <vapoursynth/VapourSynth.h>... Second, should specify -stdlib=libc++ after -std=c++11 (otherwise Qt headers will fail to build. It seems that by default clang uses a very outdated version of libstdc++ that even doesn't support u16string by default?) Next, in src/image/../common/aligned_vector.h, <malloc.h> is included. Maybe should use <cstdlib>?(It seems that <cstdlib> is the standard) Moreover, src/preview/timelineslider.cpp uses std::abs(int), which is defined in <cstdlib> instead of <cmath>. <cmath> only defines std::abs for float.. After all that long trip, regretably zimg does not compile. Because that's an upstream problem, I've already opened another issue in zimg repo...

Comments (5)

  1. Aleksey Lyashin repo owner

    No offense, but I'm not lifting a finger to support Apple products. If you know a solution - please make the needed modifications to the project, then make sure it still works as intended in Windows and Linux by using clean virtual machines and then submit patches.

  2. Invisible Arts

    Most of the issues here seem can be resolved. <vapoursynth/VapourSynth.h>, however, should be replaced with <VapourSynth.h> as is suggested by the official .pc file, and on linux pkg-config is additionally required(previously I can't see anything dealing with header files in non-standard directories?). Hope that would be acceptable.

    EDIT: It is a problem of vapoursynth itself - .pc file is inconsistent with its supposed behavior.

    UPDATE: dubhater states that plugins should always include <VapourSynth.h> and it's the configure script's duty to care about the path to header files.

    UPDATE: It seems that using clang to compile on Mac is impossible because zimg uses thread_local, which is explicitly forbidden by Apple. :( However with the current pull request at least it should build with clang on Linux. On Mac the only way is to use gcc, or use a self-compiled version of clang(which is really much slower than gcc) and then everything works fine, after manually adding /path/to/vapoursynth/include/ to INCPATH in the makefile generated by qmake(personally I have no idea of how to configure that in pro file). Maybe that can be added to documentation as guide for OS X users.

  3. l33tmeatwad

    Adding macx:LIBS += -L/usr/local/lib -lvapoursynth-script along with adding something like macx { INCLUDEPATH += /usr/local/include } to the pro.pro should do the trick with the pull request with fixes for clang. I haven't done extensive testing, but swapping out THREAD_LOCAL for __thread seems to do the trick for allowing it to compile and run on OSX.

  4. Log in to comment