CatxFish / motion-effect

obs-studio plugin for source item animation
https://obsproject.com/forum/resources/motion-filter.668/
GNU General Public License v2.0
215 stars 38 forks source link

Building for Mac; Undefined symbols for architecture x86_64 #19

Open jpransxdev opened 5 years ago

jpransxdev commented 5 years ago

I tried to build this for mac this is where I'm stuck. Help? :)

$ make -j4 -- Configuring done -- Generating done -- Build files have been written to: /Users/m3lodq/git/motion-filter/build Scanning dependencies of target motion-filter [ 50%] Built target motion-transition [ 66%] Building C object src/motion-filter/CMakeFiles/motion-filter.dir/__/helper.c.o [ 83%] Building C object src/motion-filter/CMakeFiles/motion-filter.dir/motion-filter.c.o [100%] Linking C shared module libmotion-filter.so Undefined symbols for architecture x86_64: "_obs_frontend_add_event_callback", referenced from: _register_trigger_event in motion-filter.c.o "_obs_frontend_get_current_scene", referenced from: _scene_change in motion-filter.c.o "_obs_frontend_remove_event_callback", referenced from: _unregister_trigger_event in motion-filter.c.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [src/motion-filter/libmotion-filter.so] Error 1 make[1]: [src/motion-filter/CMakeFiles/motion-filter.dir/all] Error 2 make: *** [all] Error 2

Had to edit some include lines in /external/FindLibObs and /src/motion-filter/CMakeLists.txt to get this far. FindLibObs.cmake.txt CMakeCache.txt CMakeLists.txt CMakeOutput.log

CatxFish commented 5 years ago

I am not a mac developer and I don't have mac , theoretically it can run on mac .

But I think I can make some guess. This project needs same libraries (but don't need QT5) as the other popular plugin obs-ndi, so according to the guides of obs-ndi. You need to add some additions to the cmakelist.txt in motion-filter

if(APPLE)
    set_target_properties(motion-filter PROPERTIES PREFIX "")
    target_link_libraries(motion-filter
        "${OBS_FRONTEND_LIB}")
endif()

And use this command to compile

mkdir build && cd build
cmake -DLIBOBS_INCLUDE_DIR=<path to the libobs sub-folder in obs-studio's source code> -DLIBOBS_LIB=<path to libobs.0.dylib> -DOBS_FRONTEND_LIB=<path to libobs-frontend-api.dylib> -
make -j4

Once again, I am not really sure if it's working. If there's anyone can contribute for this mac issue , that will be nice.

jpransxdev commented 5 years ago

Thanks. That did it! :)

added these to cmakelists.txt and then mkdir build && cd build cmake -DLIBOBS_INCLUDE_DIR=/Users/m3lodq/git/obs-studio/build/libobs/ -DLIBOBS_LIB=/Users/m3lodq/git/obs-studio/build/libobs/libobs.0.dylib -DOBS_FRONTEND_LIB=/Users/m3lodq/git/obs-studio/build/UI/obs-frontend-api/libobs-frontend-api.dylib -DCMAKE_INSTALL_PREFIX=/usr .. make -j4

which results in [100%] Built target motion-filter

jpransxdev commented 5 years ago

manually placed files to /Library/Application\ Support/obs-studio/plugins/motion-effect/bin/libmotion-transition.so /Library/Application\ Support/obs-studio/plugins/motion-effect/data/locale/en-US.ini /Library/Application\ Support/obs-studio/plugins/motion-effect/data/locale/zh-TW.ini /Library/Application\ Support/obs-studio/plugins/motion-filter/bin/motion-filter.so /Library/Application\ Support/obs-studio/plugins/motion-filter/data/locale/en-US.ini /Library/Application\ Support/obs-studio/plugins/motion-filter/data/locale/zh-TW.ini and the plugin loads :)

jpransxdev commented 5 years ago

Thanks a lot! :)

nppyro commented 5 years ago

@JHeartyP Can you please share the files?

I'm trying to build them, but not having much luck myself. Not much experience with this.

jpransxdev commented 5 years ago

Hey! Sorry unfortunately my mac died and I don't have the files anymore. :( I can build again after 25th but I suggest you try and compile it yourself. Where do you get stuck?

nppyro commented 5 years ago

Stuck trying to make obs. Assuming I need to do that to have the libobs files to reference as indicated above.

[ 16%] Built target jansson
[ 20%] Building C object libobs/CMakeFiles/libobs.dir/util/profiler.c.o
/Users/nathaniel/obs-studio/libobs/util/profiler.c:1061:2: error: implicit declaration of function 'gzclose_w' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
        gzclose_w(gz);
        ^
/Users/nathaniel/obs-studio/libobs/util/profiler.c:1061:2: note: did you mean 'gzclose'?
/Library/Frameworks/libz.framework/Headers/zlib.h:1229:24: note: 'gzclose' declared here
ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
                       ^
1 error generated.
make[2]: *** [libobs/CMakeFiles/libobs.dir/util/profiler.c.o] Error 1
make[1]: *** [libobs/CMakeFiles/libobs.dir/all] Error 2
make: *** [all] Error 2
borderlander19 commented 5 years ago

I'm also trying to compile this plugin on Mac. I've got OBS built successfully, and I get as far as:

-- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find Libobs (missing: LIBOBS_LIB) CMake Error at external/FindLibObs.cmake:106 (message): Could not find the libobs library Call Stack (most recent call first): src/motion-filter/CMakeLists.txt:4 (include)

I've tried adding

if(APPLE) set_target_properties(motion-filter PROPERTIES PREFIX "") target_link_libraries(motion-filter "${OBS_FRONTEND_LIB}") endif()

to /motion-filter/CMakeLists.txt and using @JHeartyP 's cmake commands with my file paths.

However I get the following error:

CMake Error at CMakeLists.txt:10 (target_link_libraries): Attempt to add link library "/Users/user/Desktop/OBSDev/obs-studio/build/UI/obs-frontend-api/libobs-frontend-api.dylib" to target "motion-filter" which is not built in this directory.

This is allowed only when policy CMP0079 is set to NEW.

-- Configuring incomplete, errors occurred!

borderlander19 commented 5 years ago

Resolved.

in /motion-filter/CMakeLists.txt the code needs to be:

if(APPLE) cmake_policy(SET CMP0079 NEW) set_target_properties(motion-filter PROPERTIES PREFIX "") target_link_libraries(motion-filter "${OBS_FRONTEND_LIB}") endif()

borderlander19 commented 5 years ago

It turns out, while it appeared to build successfully, and the motion-filter element works as expected, the transition element doesn't appear in the list of available transitions.

@JHeartyP, can you confirm that the motion transitions work for you? after placing files as follows:

/Library/Application\ Support/obs-studio/plugins/motion-effect/bin/libmotion-transition.so /Library/Application\ Support/obs-studio/plugins/motion-effect/data/locale/en-US.ini /Library/Application\ Support/obs-studio/plugins/motion-effect/data/locale/zh-TW.ini

thanks!

Any thoughts as to why the filter would work but not the transition?

wackazong commented 5 years ago

Ok, I got it built and then I renamed libmotion-transition.so to motion-effect.so and it loaded in OBS. Therefore it now fully compiles and loads on Mac.

petaire92 commented 4 years ago

Anyone can share those files maybe ?

aristides commented 3 years ago

@wackazong could you please share your .so files? I tried to build myself but I coudn't.

aristides commented 3 years ago

I was able to run the cmake aristides$ cmake -DLIBOBS_INCLUDE_DIR=/Users/aristides/dev/motion-plugin/obs-studio/libobs -DLIBOBS_LIB=/Users/aristides/dev/motion-plugin/obs-studio/build/libobs/libobs.0.dylib -DOBS_FRONTEND_LIB=/Users/aristides/dev/motion-plugin/obs-studio/build/UI/obs-frontend-api/libobs-frontend-api.dylib -DCMAKE_INSTALL_PREFIX=/usr .. -- The C compiler identification is AppleClang 12.0.0.12000032 -- The CXX compiler identification is AppleClang 12.0.0.12000032 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Libobs: /Users/aristides/dev/motion-plugin/obs-studio/build/libobs/libobs.0.dylib -- Configuring done -- Generating done -- Build files have been written to: /Users/aristides/dev/motion-plugin/motion-filter/build

But the make -j4 is giving error aristides$ make -j4 [ 16%] Building C object src/motion-filter/CMakeFiles/motion-filter.dir/motion-filter.c.o [ 33%] Building C object src/motion-filter/CMakeFiles/motion-filter.dir//helper.c.o [ 50%] Building C object src/motion-transition/CMakeFiles/motion-transition.dir/motion-transition.c.o [ 66%] Building C object src/motion-transition/CMakeFiles/motion-transition.dir//helper.c.o /Users/aristides/dev/motion-plugin/motion-filter/src/helper.c:103:12: error: incomplete definition of type 'struct obs_source' if (!scene->context.private)


/Users/aristides/dev/motion-plugin/obs-studio/libobs/obs.h:44:8: note: forward declaration of 'struct obs_source'
struct obs_source;
       ^
1 error generated.
make[2]: *** [src/motion-transition/CMakeFiles/motion-transition.dir/__/helper.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/Users/aristides/dev/motion-plugin/motion-filter/src/helper.c:103:12: error: incomplete definition of type 'struct obs_source'
        if (!scene->context.private)
             ~~~~~^
/Users/aristides/dev/motion-plugin/obs-studio/libobs/obs.h:44:8: note: forward declaration of 'struct obs_source'
struct obs_source;
       ^
1 error generated.
make[2]: *** [src/motion-filter/CMakeFiles/motion-filter.dir/__/helper.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [src/motion-transition/CMakeFiles/motion-transition.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [src/motion-filter/CMakeFiles/motion-filter.dir/all] Error 2
make: *** [all] Error 2

Could this be a problem with OBS Version, I was able to download it from GIT and build IT.
aristides commented 3 years ago

I was able to achieve this effect using this plugin instead, works out of the box