justdan96 / tsMuxer

tsMuxer is a transport stream muxer for remuxing/muxing elementary streams, EVO/VOB/MPG, MKV/MKA, MP4/MOV, TS, M2TS to TS to M2TS. Supported video codecs H.264/AVC, H.265/HEVC, VC-1, MPEG2. Supported audio codecs AAC, AC3 / E-AC3(DD+), DTS/ DTS-HD.
Apache License 2.0
863 stars 144 forks source link

Compiling issues for Windows-Build #675

Closed DreckSoft closed 1 year ago

DreckSoft commented 1 year ago

I followed Compiling document and ran into several issues.

  1. tsmuxer.exe fails to compile Ninja (partial) output:

    tsMuxer/tsMuxer/lpcmStreamReader.cpp:12:1: note: 'strlen' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    11 | #include "wave.h"
    +++ |+#include <cstring>
    12 |
  2. If I add #include it compiles but the resulting muxed files lack all subtitles and all description (for example language of the audio track).

The same happens if i use the ./scripts/rebuild_linux.sh instead of msys2 script (still in msys2 of cource)

  1. The resulting compiled files are completely different between the binary release here, the msys2 build and the linux build (in msys). This might not be an issue, however it is strange.
jcdr428 commented 1 year ago

@DreckSoft did you try #include <cstring> ?

DreckSoft commented 1 year ago

Sure, without it won't compile. With the change the mentioned issues appear.

I just changes to original post as < cstring > was not displayed.

But there must be another solution as the I assume the build process works with the files here without modifications.

Strange: It compiles fine without any change on Linux (linux binary, haven't installed mingw yet).

DreckSoft commented 1 year ago

I did now install the mingw tools in linux. For Manjaro a modification to the cmake command is necessary:

x86_64-w64-mingw32-cmake-static -D ZLIB_INCLUDE_DIR=/usr/include/ -D ZLIB_LIBRARY=/usr/lib/libz.so.1.2.11.zlib-ng -D FREETYPE_INCLUDE_DIRS=/usr/include/freetype2 -D FREETYPE_LIBRARY=/usr/lib/libfreetype.so ../

Compiling fails with a different error. This seems to be related to mingw. Maybe the MXE toolchain is different from the regular mingw.

make
[  8%] Built target mediation
[  9%] Building CXX object tsMuxer/CMakeFiles/tsmuxer.dir/aac.cpp.obj
In file included from /usr/x86_64-w64-mingw32/include/crtdefs.h:10,
                 from /usr/x86_64-w64-mingw32/include/stddef.h:7,
                 from /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/include/stddef.h:1,
                 from /usr/include/wchar.h:35,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/cwchar:44,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/bits/postypes.h:40,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/bits/char_traits.h:39,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/string:40,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/bitset:47,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/regex:38,
                 from /home/admin/Development/tsMuxer/tsMuxer/../libmediation/types/types.h:5,
                 from /home/admin/Development/tsMuxer/tsMuxer/aac.h:1,
                 from /home/admin/Development/tsMuxer/tsMuxer/aac.cpp:1:
/usr/x86_64-w64-mingw32/include/corecrt.h:75:44: error: conflicting declaration ‘typedef long long unsigned int uintptr_t’
   75 | __MINGW_EXTENSION typedef unsigned __int64 uintptr_t;
      |                                            ^~~~~~~~~
In file included from /usr/x86_64-w64-mingw32/include/c++/12.2.0/cstdint:41,
                 from /home/admin/Development/tsMuxer/tsMuxer/../libmediation/types/types.h:4:
/usr/include/stdint.h:90:33: note: previous declaration as ‘typedef long unsigned int uintptr_t’
   90 | typedef unsigned long int       uintptr_t;
      |                                 ^~~~~~~~~
/usr/x86_64-w64-mingw32/include/c++/12.2.0/cwchar:148:11: error: ‘fwide’ has not been declared in ‘::’
  148 |   using ::fwide;
      |           ^~~~~
/usr/x86_64-w64-mingw32/include/c++/12.2.0/cwchar:150:11: error: ‘fwscanf’ has not been declared in ‘::’
  150 |   using ::fwscanf;
      |           ^~~~~~~
/usr/x86_64-w64-mingw32/include/c++/12.2.0/cwchar:162:11: error: ‘swscanf’ has not been declared in ‘::’
  162 |   using ::swscanf;
      |           ^~~~~~~
/usr/x86_64-w64-mingw32/include/c++/12.2.0/cwchar:205:11: error: ‘wscanf’ has not been declared in ‘::’
  205 |   using ::wscanf;
      |           ^~~~~~
In file included from /usr/x86_64-w64-mingw32/include/sec_api/stdlib_s.h:9,
                 from /usr/x86_64-w64-mingw32/include/stdlib.h:765,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/cstdlib:75,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/ext/string_conversions.h:41,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/bits/basic_string.h:3960,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/string:53:
/usr/include/stdlib.h:63:5: error: conflicting declaration ‘typedef struct div_t div_t’
   63 |   } div_t;
      |     ^~~~~
/usr/x86_64-w64-mingw32/include/stdlib.h:63:5: note: previous declaration as ‘typedef struct _div_t div_t’
   63 |   } div_t;
      |     ^~~~~
/usr/include/stdlib.h:71:5: error: conflicting declaration ‘typedef struct ldiv_t ldiv_t’
   71 |   } ldiv_t;
      |     ^~~~~~
/usr/x86_64-w64-mingw32/include/stdlib.h:68:5: note: previous declaration as ‘typedef struct _ldiv_t ldiv_t’
   68 |   } ldiv_t;
      |     ^~~~~~
/usr/include/stdlib.h:81:5: error: conflicting declaration ‘typedef struct lldiv_t lldiv_t’
   81 |   } lldiv_t;
      |     ^~~~~~~
/usr/x86_64-w64-mingw32/include/stdlib.h:724:61: note: previous declaration as ‘typedef struct lldiv_t lldiv_t’
  724 |   typedef struct { __MINGW_EXTENSION long long quot, rem; } lldiv_t;
      |                                                             ^~~~~~~
In file included from /usr/include/sched.h:31,
                 from /usr/include/pthread.h:22,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/x86_64-w64-mingw32/bits/gthr-default.h:35,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/x86_64-w64-mingw32/bits/gthr.h:148,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/ext/atomicity.h:35,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/bits/locale_classes.h:41,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/locale:39,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/regex:39:
/usr/include/bits/types/time_t.h:10:18: error: conflicting declaration ‘typedef __time_t time_t’
   10 | typedef __time_t time_t;
      |                  ^~~~~~
/usr/x86_64-w64-mingw32/include/corecrt.h:138:20: note: previous declaration as ‘typedef __time64_t time_t’
  138 | typedef __time64_t time_t;
      |                    ^~~~~~
/usr/x86_64-w64-mingw32/include/c++/12.2.0/x86_64-w64-mingw32/bits/gthr-default.h: In function ‘int __gthread_mutex_timedlock(__gthread_mutex_t*, const __gthread_time_t*)’:
/usr/x86_64-w64-mingw32/include/c++/12.2.0/x86_64-w64-mingw32/bits/gthr-default.h:769:12: error: ‘pthread_mutex_timedlock’ was not declared in this scope; did you mean ‘pthread_mutex_trylock’?
  769 |     return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
      |            ^~~~~~~~
/usr/x86_64-w64-mingw32/include/c++/12.2.0/x86_64-w64-mingw32/bits/gthr-default.h: In function ‘int __gthread_recursive_mutex_init_function(__gthread_recursive_mutex_t*)’:
/usr/x86_64-w64-mingw32/include/c++/12.2.0/x86_64-w64-mingw32/bits/gthr-default.h:797:52: error: ‘PTHREAD_MUTEX_RECURSIVE’ was not declared in this scope; did you mean ‘PTHREAD_MUTEX_RECURSIVE_NP’?
  797 |                                                    PTHREAD_MUTEX_RECURSIVE);
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~~
      |                                                    PTHREAD_MUTEX_RECURSIVE_NP
/usr/x86_64-w64-mingw32/include/c++/12.2.0/x86_64-w64-mingw32/bits/gthr-default.h:796:15: error: ‘pthread_mutexattr_settype’ was not declared in this scope; did you mean ‘pthread_mutexattr_destroy’?
  796 |         __r = __gthrw_(pthread_mutexattr_settype) (&__attr,
      |               ^~~~~~~~
In file included from /usr/include/wctype.h:38,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/cwctype:50,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/bits/locale_facets.h:39,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/locale:40:
/usr/include/bits/wctype-wchar.h: At global scope:
/usr/include/bits/wctype-wchar.h:38:27: error: conflicting declaration ‘typedef long unsigned int wctype_t’
   38 | typedef unsigned long int wctype_t;
      |                           ^~~~~~~~
/usr/x86_64-w64-mingw32/include/corecrt.h:107:24: note: previous declaration as ‘typedef short unsigned int wctype_t’
  107 | typedef unsigned short wctype_t;
      |                        ^~~~~~~~
In file included from /usr/x86_64-w64-mingw32/include/c++/12.2.0/bits/chrono.h:37,
                 from /usr/x86_64-w64-mingw32/include/c++/12.2.0/chrono:39,
                 from /home/admin/Development/tsMuxer/tsMuxer/vod_common.h:6,
                 from /home/admin/Development/tsMuxer/tsMuxer/aac.cpp:4:
/usr/x86_64-w64-mingw32/include/c++/12.2.0/ratio:215:40: error: static assertion failed: This library calls __builtin_clzll on uintmax_t, which is unsafe on your platform. Please complain to http://gcc.gnu.org/bugzilla/
  215 |       static_assert(sizeof (uintmax_t) == sizeof (unsigned long long),
      |                     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/x86_64-w64-mingw32/include/c++/12.2.0/ratio:215:40: note: the comparison reduces to ‘(4 == 8)’
/usr/x86_64-w64-mingw32/include/c++/12.2.0/ratio:563:45: error: narrowing conversion of ‘1000000000000000000’ from ‘long long int’ to ‘long int’ [-Wnarrowing]
  563 |   typedef ratio<1,       1000000000000000000> atto;
      |                                             ^
/usr/x86_64-w64-mingw32/include/c++/12.2.0/ratio:564:45: error: narrowing conversion of ‘1000000000000000’ from ‘long long int’ to ‘long int’ [-Wnarrowing]
  564 |   typedef ratio<1,          1000000000000000> femto;
      |                                             ^
/usr/x86_64-w64-mingw32/include/c++/12.2.0/ratio:565:45: error: narrowing conversion of ‘1000000000000’ from ‘long long int’ to ‘long int’ [-Wnarrowing]
  565 |   typedef ratio<1,             1000000000000> pico;
      |                                             ^
/usr/x86_64-w64-mingw32/include/c++/12.2.0/ratio:576:45: error: narrowing conversion of ‘1000000000000’ from ‘long long int’ to ‘long int’ [-Wnarrowing]
  576 |   typedef ratio<            1000000000000, 1> tera;
      |                                             ^
/usr/x86_64-w64-mingw32/include/c++/12.2.0/ratio:577:45: error: narrowing conversion of ‘1000000000000000’ from ‘long long int’ to ‘long int’ [-Wnarrowing]
  577 |   typedef ratio<         1000000000000000, 1> peta;
      |                                             ^
/usr/x86_64-w64-mingw32/include/c++/12.2.0/ratio:578:45: error: narrowing conversion of ‘1000000000000000000’ from ‘long long int’ to ‘long int’ [-Wnarrowing]
  578 |   typedef ratio<      1000000000000000000, 1> exa;
      |                                             ^
make[2]: *** [tsMuxer/CMakeFiles/tsmuxer.dir/build.make:77: tsMuxer/CMakeFiles/tsmuxer.dir/aac.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:142: tsMuxer/CMakeFiles/tsmuxer.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
DreckSoft commented 1 year ago

Adding the missing header will not (really) help as the resulting build is not working properly.

DreckSoft commented 1 year ago

The compiling issue in Linux is cause I referenced the Linux files instead of the mingw. So I need to install zlib and freetype for mingw.

DreckSoft commented 1 year ago

Now I get the same error as in Windows.

DreckSoft commented 1 year ago

Any more ideas? The windows version should compile without any changes. Maybe some wrong (newer) library versions included in MinGW?

DreckSoft commented 1 year ago

Closing that one for now. I'm not sure any longer if this is an issue with tsmuxer or with the rest of the toolchain.

DreckSoft commented 1 year ago

I'm reopening this as there are still issues.

I need to add #include <cstring> to lpcmStreamReader.cpp but that seems to lead to some strange issue that some descriptors are not set correctly.

I've attached two MediaInfo files. One muxed with the latest nightly and one muxed with my version. Besides the include I did change the format_identifier for EAC3 to AC-3 to test something for this issue: https://github.com/justdan96/tsMuxer/issues/682

Besides that, the results should be identical but with my compile several descriptors are missing.

Nighty.txt Patch.txt

DreckSoft commented 1 year ago

Closing this for now as I included some wrong / misleading information at the beginning. The only descriptor thats missing is the Inform part. Still strange that it's missing but likely not "game changing". I might open a new issue with a better description once the more important parts about EAC3 and backward compatibility are sorted out.