dougg3 / obs-ios-camera-source

Use your iPhone camera as a video source in OBS Studio and stream high quality video from your iPhone's camera over USB
https://obs.camera/
GNU General Public License v2.0
49 stars 18 forks source link

Building fails on Arch (maybe in general?) #1

Closed dstapp closed 3 years ago

dstapp commented 3 years ago

Hey, first thank you for all the effort you put in making this work. I'd love to use my iOS device as a OBS video source. However, I'm failing trying to build the library on Arch. All the dependencies are installed and everything worked correct until running make, but then the following happens:

seventeen:build(master) $ make -j$(nproc)    
[ 15%] Built target libcnary
[ 62%] Built target libplist
[ 71%] Built target libusbmuxd
[ 73%] Building CXX object CMakeFiles/portal.dir/deps/portal/src/Channel.cpp.o
In file included from /tmp/obs-ios-camera-source/deps/portal/src/Channel.hpp:22,
                 from /tmp/obs-ios-camera-source/deps/portal/src/Channel.cpp:19:
/tmp/obs-ios-camera-source/deps/portal/src/Channel.cpp: In destructor 'virtual portal::Channel::~Channel()':
/tmp/obs-ios-camera-source/deps/portal/src/logging.h:28:48: error: 'stderr' was not declared in this scope
   28 |     do { if (PORTAL_DEBUG_LOG_ENABLED) fprintf(stderr, "%s:%d:%s(): " format, __FILE__, __LINE__, __func__, ## __VA_ARGS__); } while (0)
      |                                                ^~~~~~
/tmp/obs-ios-camera-source/deps/portal/src/Channel.cpp:38:9: note: in expansion of macro 'portal_log'
   38 |         portal_log("%s: Deallocating\n", __func__);
      |         ^~~~~~~~~~
/tmp/obs-ios-camera-source/deps/portal/src/Channel.cpp:20:1: note: 'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
   19 | #include "Channel.hpp"
  +++ |+#include <cstdio>
   20 | 
In file included from /tmp/obs-ios-camera-source/deps/portal/src/Channel.hpp:22,
                 from /tmp/obs-ios-camera-source/deps/portal/src/Channel.cpp:19:
/tmp/obs-ios-camera-source/deps/portal/src/logging.h:28:40: error: 'fprintf' was not declared in this scope; did you mean 'wprintf'?
   28 |     do { if (PORTAL_DEBUG_LOG_ENABLED) fprintf(stderr, "%s:%d:%s(): " format, __FILE__, __LINE__, __func__, ## __VA_ARGS__); } while (0)
      |                                        ^~~~~~~
/tmp/obs-ios-camera-source/deps/portal/src/Channel.cpp:38:9: note: in expansion of macro 'portal_log'
   38 |         portal_log("%s: Deallocating\n", __func__);
      |         ^~~~~~~~~~
/tmp/obs-ios-camera-source/deps/portal/src/Channel.cpp: In member function 'void portal::Channel::InternalThreadEntry()':
/tmp/obs-ios-camera-source/deps/portal/src/logging.h:28:48: error: 'stderr' was not declared in this scope
   28 |     do { if (PORTAL_DEBUG_LOG_ENABLED) fprintf(stderr, "%s:%d:%s(): " format, __FILE__, __LINE__, __func__, ## __VA_ARGS__); } while (0)
      |                                                ^~~~~~
/tmp/obs-ios-camera-source/deps/portal/src/Channel.cpp:92:17: note: in expansion of macro 'portal_log'
   92 |                 portal_log("There was an error receiving data");
      |                 ^~~~~~~~~~
/tmp/obs-ios-camera-source/deps/portal/src/logging.h:28:48: note: 'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
   28 |     do { if (PORTAL_DEBUG_LOG_ENABLED) fprintf(stderr, "%s:%d:%s(): " format, __FILE__, __LINE__, __func__, ## __VA_ARGS__); } while (0)
      |                                                ^~~~~~
/tmp/obs-ios-camera-source/deps/portal/src/Channel.cpp:92:17: note: in expansion of macro 'portal_log'
   92 |                 portal_log("There was an error receiving data");
      |                 ^~~~~~~~~~
/tmp/obs-ios-camera-source/deps/portal/src/logging.h:28:40: error: 'fprintf' was not declared in this scope; did you mean 'wprintf'?
   28 |     do { if (PORTAL_DEBUG_LOG_ENABLED) fprintf(stderr, "%s:%d:%s(): " format, __FILE__, __LINE__, __func__, ## __VA_ARGS__); } while (0)
      |                                        ^~~~~~~
/tmp/obs-ios-camera-source/deps/portal/src/Channel.cpp:92:17: note: in expansion of macro 'portal_log'
   92 |                 portal_log("There was an error receiving data");
      |                 ^~~~~~~~~~
make[2]: *** [CMakeFiles/portal.dir/build.make:82: CMakeFiles/portal.dir/deps/portal/src/Channel.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:135: CMakeFiles/portal.dir/all] Error 2
make: *** [Makefile:149: all] Error 2

Do you have any insights on that? I found some instructions that suggested to use the linux-support brach, but it seems like it does not exist anymore.

Help would be highly appreciated. Thanks :+1:

dougg3 commented 3 years ago

Hey @dprandzioch,

It looks like the code is having trouble with finding stderr. I’m guessing Arch has a newer libc or libstdc++ or GCC that is more picky. In the file deps/portal/src/logging.h, can you try adding:

#include <cstdio>

Just below the line

#pragma once

? I think that will get you past that error. If it works, we can add this fix to the repository. No worries about the linux support branch, those were outdated instructions.

dstapp commented 3 years ago

Hey, thanks for your quick reply. It works like a charm now :-) I opened PR #2 and I'll try to fix the build instructions in the Arch user repo as well.

Thanks so much again for making this work on Linux, this keeps me from booting my MacBook for video conferences and workshops :)

dougg3 commented 3 years ago

You're welcome! Glad that it worked for you, and thanks for submitting the PR with the fix!