How to make librtmp compile on Mac OS X - macos

I am trying to build rtmpdump and librtmp on mac, however I cannot for the life of me work out why it isn't working. I am using my own built openssl:
$ openssl version
OpenSSL 1.1.0-pre3 (alpha) 15 Feb 2016
I have set the flags correctly (I think), but yet when I try and compile I get this:
$ make INC=-I/usr/local/include
gcc -Wall -I/usr/local/include -DRTMPDUMP_VERSION=\"v2.4\" -DUSE_OPENSSL -O2 -fPIC -c -o rtmp.o rtmp.c
In file included from rtmp.c:152:
./handshake.h:120:12: error: variable has incomplete type 'HMAC_CTX' (aka 'struct hmac_ctx_st')
HMAC_CTX ctx;
^
/usr/local/include/openssl/ossl_typ.h:145:16: note: forward declaration of 'struct hmac_ctx_st'
typedef struct hmac_ctx_st HMAC_CTX;
^
In file included from rtmp.c:152:
./handshake.h:125:3: warning: implicit declaration of function 'HMAC_CTX_init' is invalid in C99 [-Wimplicit-function-declaration]
HMAC_setup(ctx, secretKey, 128);
^
./handshake.h:72:35: note: expanded from macro 'HMAC_setup'
#define HMAC_setup(ctx, key, len) HMAC_CTX_init(&ctx); HMAC_Init_ex(&ctx, key, len, EVP_sha256(), 0)
^
./handshake.h:127:3: warning: implicit declaration of function 'HMAC_CTX_cleanup' is invalid in C99 [-Wimplicit-function-declaration]
HMAC_finish(ctx, digest, digestLen);
^
./handshake.h:74:67: note: expanded from macro 'HMAC_finish'
#define HMAC_finish(ctx, dig, dlen) HMAC_Final(&ctx, dig, &dlen); HMAC_CTX_cleanup(&ctx)
^
./handshake.h:269:12: error: variable has incomplete type 'HMAC_CTX' (aka 'struct hmac_ctx_st')
HMAC_CTX ctx;
^
/usr/local/include/openssl/ossl_typ.h:145:16: note: forward declaration of 'struct hmac_ctx_st'
typedef struct hmac_ctx_st HMAC_CTX;
^
rtmp.c:192:13: warning: comparison of constant 18446744073709551597 with expression of type 'uint32_t' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
if (nSize > SIZE_MAX - RTMP_MAX_HEADER_SIZE)
~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings and 2 errors generated.
make[1]: *** [rtmp.o] Error 1
make: *** [librtmp/librtmp.a] Error 2
It looks like it might be a compatibility issue with the version of OpenSSL I'm using. Does anyone know how to fix this kind of issue, or any changes to OpenSSL that might be responsible?

OpenSSL 1.1.0-pre3 (alpha) 15 Feb 2016...
Does anyone know how to fix this kind of issue, or any changes to OpenSSL that might be responsible?
Broadly speaking, there appears to be two high level changes in OpenSSL 1.1.x that caused most of the problems. First was the changes to the build system. Second was the firmer posture with respect to private APIs. I think you're seeing an artifact of the second, the private APIs.
Generally speaking, 1.1.0-pre3 and 1.1.0-pre4 have a number of problems and mostly can't achieve a successful make test. The issues include configuration and build issues for 32-bit OS X PowerMac, 64-bit OS X PowerMac, 32-bit OS X, 64-bit OS X, 32-bit ARM, 64-bit ARM, OpenBSD 5.7, NetBSD 7.0, Cygwin, CentOS 5, CentOS 7 and i686. So many so that I've filed about 25 bugs in preparation for the upcoming Beta-1 scheduled to arrive Monday, 14 MAR 2016.
You should probably avoid 1.1.0-pre-N at the moment because its so unstable. You should be OK under x86_64 Linux, but anything else is a crap shoot at the moment. You should be able to pick it up again around Beta-2.
You will probably have better luck with the tip of Master after commits from Friday, 11 MAR 2016. That would be roughly commits 0d4d5ab and 4c1cf7e. You can get the latest with:
git clone git://git.openssl.org/openssl.git
Or, use 1.0.2 stable releases.

Related

GCC 9 header errors when installed with homebrew

I've got GCC 9 installed via homebrew on macOS Catalina 10.15.1. I'm setting -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk. When compiling a file that includes stdio.h, I get compile errors:
/usr/local/Cellar/gcc/9.2.0_1/lib/gcc/9/gcc/x86_64-apple-darwin19/9.2.0/include-fixed/stdio.h: In function 'perror':
/usr/local/Cellar/gcc/9.2.0_1/lib/gcc/9/gcc/x86_64-apple-darwin19/9.2.0/include-fixed/stdio.h:183:28: error: expected declaration specifiers before '__cold'
183 | void perror(const char *) __cold;
| ^~~~~~
/usr/local/Cellar/gcc/9.2.0_1/lib/gcc/9/gcc/x86_64-apple-darwin19/9.2.0/include-fixed/stdio.h:200:1: error: expected declaration specifiers before '__attribute__'
200 | __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead.")
| ^~~~~~~~~~~~~~~~
/usr/local/Cellar/gcc/9.2.0_1/lib/gcc/9/gcc/x86_64-apple-darwin19/9.2.0/include-fixed/stdio.h:219:10: fatal error: _ctermid.h: No such file or directory
219 | #include <_ctermid.h>
| ^~~~~~~~~~~~
Is there any solution to this? Is this a GCC bug or homebrew?

"'_Nonnull' cannot be applied to non-pointer type" while building FLTK on macOS?

I tried to build FLTK 1.3.4-2 version on my mac. I followed the instruction, and successfully configure it.
But when I install it, it shows:
Compiling Fl_cocoa.mm...
In file included from Fl_cocoa.mm:55:
In file included from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:128:
/System/Library/Frameworks/Foundation.framework/Headers/NSUUID.h:26:49: error: nullability specifier '_Nullable' cannot be applied to
non-pointer type 'uuid_t' (aka 'unsigned char [16]')
- (instancetype)initWithUUIDBytes:(const uuid_t _Nullable)bytes;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSUUID.h:29:30: error: nullability specifier '_Nonnull' cannot be applied to
non-pointer type 'uuid_t' (aka 'unsigned char [16]')
- (void)getUUIDBytes:(uuid_t _Nonnull)uuid;
^
2 errors generated.
make[1]: *** [Fl_cocoa.o] Error 1
make: *** [install] Error 1
Does anyone know how to solve this problem?
It seems you build system is a bit of mix'n'match and through that you have found a compiler bug.
The error message indicates that the compiler is not recognising that an array type (uuid_t) when used as a function/method parameter type becomes a pointer type (as C-style arrays are passed by reference not by value) before it checks the validity of _Nullable/_Nonnull – so it throws the error as _Nullable/_Nonnull are not applicable to array types.
However not only isn't this your code, it is system code which is causing the error, which is surprising. Which is where the mix'n'match comes in...
Prior to the macOS10.13 SDK the two methods causing the error, initWithUUIDBytes: and getUUIDBytes:, were not annotated with nullability attributes. By default Xcode 8.1 uses the macOS10.12 SDK and your code should compile with that arrangement – the included header, NSUUID.h, will not contain the nullability attributes.
If you wrote your own code with array typed parameters and specified nullability then Xcode 8.1's compiler would produce an error – the bug is in (at least) that compiler. But this isn't your code...
Xcode 9.4.1 (lastest 9) by default uses macOS10.13SDK and again your code would compiler – the included header will contain the nullability attributes and Xcode 9.4.1's compiler will not produce an error as the bug has been fixed.
So at best guess either you are using Xcode 8.1 but with the macOS10.13+ SDK intentionally installed, or you've managed to install the macOS10.13+ SDK headers and you are using a version of gcc which has the bug, or you've got multiple versions of Xcode installed and the command line tools are not for Xcode 8.1 (How to switch between multiple Command Line Tools installations in Mac OS X (without installing XCode) may help), or some other scenario where you've got mismatched compilers and installed SDKs – nobody else but you can know what is actually installed on your system; the header file path is a system location so the header causing the issue isn't a copy in the FLTK source folder.
HTH
[BTW your gcc comes from 2007, if you are building with it you should probably update to something newer.]

Vmware 8.0 and ubuntu bionic- gcc not found

I am trying to install vmware 8 on kubuntu bionic with gcc-7.3. The installation process went well until the message "gcc is not found". gcc is there but I guess vmware 8 is too old and does not recognize gcc version 7.3.
I have tried to manually compiled the modules (vmmon and stuff) but an error came out. An example is shown below.
/usr/lib/vmware/modules/source/vmmon-only/linux/driver.c: At top level:
/usr/lib/vmware/modules/source/vmmon-only/linux/driver.c:175:19: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.fault = LinuxDriverFault
^~~~~~~~~~~~~~~~
/usr/lib/vmware/modules/source/vmmon-only/linux/driver.c:175:19: note: (near initialization for ‘vmuser_mops.fault’)
/usr/lib/vmware/modules/source/vmmon-only/linux/driver.c: In function ‘init_module’:
/usr/lib/vmware/modules/source/vmmon-only/linux/driver.c:346:4: error: implicit declaration of function ‘init_timer’; did you mean ‘init_timers’? [-Werror=implicit-function-declaration]
init_timer(&linuxState.pollTimer);
^~~~~~~~~~
init_timers
Is there a workaround?
Many thanks

Compiling Asterisk on Windows

I was trying to compile Asterisk 1.6 on Windows using Cygwin
1- I have installed Cygwin and included (Debug, Devel and Libs )while installing Cygwin.
2- ./Configure passed successfully
3- while running make command I got this
In file included from /home/Administrator/asterisk-1.6.2.24/include/asterisk.h:27:0,
from smsq.c:20:
/home/Administrator/asterisk-1.6.2.24/include/asterisk/compat.h:205:28: error: conflicting types for ‘uint64_t’
typedef unsigned long long uint64_t;
^
In file included from /usr/include/stdint.h:14:0,
from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/stdint.h:9,
from /usr/include/inttypes.h:19,
from /home/Administrator/asterisk-1.6.2.24/include/asterisk/compat.h:29,
from /home/Administrator/asterisk-1.6.2.24/include/asterisk.h:27,
from smsq.c:20:
/usr/include/sys/_stdint.h:60:20: note: previous declaration of ‘uint64_t’ was here
typedef __uint64_t uint64_t ;
^
make[1]: *** [/home/Administrator/asterisk-1.6.2.24/Makefile.rules:91: smsq.o] Error 1
make: *** [Makefile:422: utils] Error 2
I need to know what is the cause and how can I fix this issue?
Thanks in advance
The type named uint64_t is defined in <stdint.h> where it should be, but asterisk is (wrongly, all identifiers ending in _t are reserved names) trying to provide its own definition.
Remove the improper definition in "compat.h".

Some C++11 features missing when using Code Blocks 13.12, MinGW 4.8.1 and SFML 2.1

Turning to Stack Overflow after exhausting all my efforts.
I'm running Code Blocks 13.12 and MinGW 4.8.1 on a Windows 7 OS 64bit system. I spent two days trying to get the compiler to link (statically) to the SFML 2.1 library. I followed both the SFML tutorial and this video tutorial- reinstalling both Code Blocks and MinGW twice before it finally linked.
After that I was relieved that SFML was recognized, but I got 50 errors when I tried to build and run that suggested C++11 features weren't.
Added -std=gnu++11 to compiler options and 13 of those errors went away.
The remaining errors all fall into two categories: mutex is not a member of std and from time t is not a member of chrono::_V2::steady clock. I'm not even sure what _V2 is.
What am I missing?
-------------- Build: Release in PumpTracker2.0 (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -std=gnu++11 -DSFML_STATIC -O2 -std=gnu++11 -IC:\SFML-2.1\include -IC:\SFML-2.1\include -c C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp -o obj\Release\main.o
In file included from C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:25:0:
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\Account.h:37:1: error: 'mutex' in namespace 'std' does not name a type
std::mutex mu;
^
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\Account.h:86:22: error: 'to_time_t' is not a member of 'std::chrono::_V2::steady_clock'
time_t currentTp = std::chrono::steady_clock::to_time_t(newly);
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\Account.h:94:48: error: 'from_time_t' is not a member of 'std::chrono::_V2::steady_clock'
std::chrono::steady_clock::time_point tNew = std::chrono::steady_clock::from_time_t(currentTp);
^
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:51:2: error: 'mutex' is not a member of 'std'
std::mutex mu3;
^
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:51:13: error: expected ';' before 'mu3'
std::mutex mu3;
^
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:52:19: error: 'mutex' was not declared in this scope
std::unique_lock<mutex> locker3(mu3, std::defer_lock);
^
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:52:24: error: template argument 1 is invalid
std::unique_lock<mutex> locker3(mu3, std::defer_lock);
^
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:52:33: error: invalid type in declaration before '(' token
std::unique_lock<mutex> locker3(mu3, std::defer_lock);
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:214:22: error: 'to_time_t' is not a member of 'std::chrono::_V2::steady_clock'
pS->tpNewest = std::chrono::steady_clock::to_time_t(NextPump);
^
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:245:51: error: 'from_time_t' is not a member of 'std::chrono::_V2::steady_clock'
std::chrono::steady_clock::time_point TT2 = std::chrono::steady_clock::from_time_t(pS->tpNewest);
^
Process terminated with status 1 (0 minute(s), 4 second(s))
37 error(s), 47 warning(s) (0 minute(s), 4 second(s))
As already mentioned the original MinGW distribution is not the best one to go with, if you want to go with up-to-date features. Instead there are projects like Nuwen (Stephan T. Lavavej's website) as well as MinGW Builds that provide MinGW-w64 binaries.
The mentioning of SFML is misleading, since the problems have nothing to do with SFML at all. Keep in mind however that you'll have to rebuild SFML if you change the compiler!
As a next step, it would've been important to post a minimal example of the source code that reproduces the errors, because right now, we can only guess what's going wrong, based on the errors.
If you don't use the GNU extensions explicitly, you should use -std=c++11 instead of -std=gnu++11 and if you look at the build command, you'll notice that it's included twice, which is not necessary.
And now to some guessing about the errors:
Account.h - Make sure the <mutex> header is included.
main.cpp - Make sure the <mutex> header is included.
main.cpp - If std::unique_lock<mutex> is from your code, then you need to add std::, i.e. std::unique_lock<std::mutex>.
main.cpp - time_t things seem to be resolved, but make sure anyways to include <chrono> and <ctime> (since time_t is defined in <ctime>).

Resources