nginx-rtmp-module icon indicating copy to clipboard operation
nginx-rtmp-module copied to clipboard

Fix compilation under Windows/MinGW64

Open HerveAncher opened this issue 4 years ago • 5 comments

Dear @arut,

Please merge this PR to compile properly under Windows / MinGW64 This PR also cover #1340

Regards.

HerveAncher avatar Oct 05 '20 08:10 HerveAncher

Thanks. After hours of stress trying to figure out why it wouldn't build, merging this locally fixed the problem.

elijahr2411 avatar Nov 26 '21 17:11 elijahr2411

hello, i've got issues when compiling w64

objs/lib/nginx-rtmp-module-arut-modded-HerveAncher/ngx_rtmp_flv_module.c(508): error C2220: l'avertissement suivant est traité comme une erreur objs/lib/nginx-rtmp-module-arut-modded-HerveAncher/ngx_rtmp_flv_module.c(508): warning C4334: '<<' : résultat du décalage 32 bits converti implicitement en 64 bits (le décalage 64 bits est-il intentionnel ?) objs/lib/nginx-rtmp-module-arut-modded-HerveAncher/ngx_rtmp_flv_module.c(521): warning C4334: '<<' : résultat du décalage 32 bits converti implicitement en 64 bits (le décalage 64 bits est-il intentionnel ?) NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64\cl.EXE"' : code retour '0x2' Stop.

any advices ?

thanks.

Broukmiken avatar Sep 14 '22 09:09 Broukmiken

Hi, In fact, I never try to compile Nginx with MSVC, I am using MSYS2.

The error MSVC returns telling you that the left shift imply that the temporary created variable potentially become a 64 bits, and to fix that I think you just have to convert:

(1 << h.type)

to: (ngx_uint_t)(1 << h.type)

HerveAncher avatar Sep 14 '22 10:09 HerveAncher

Another option is to tell MSVC to do not treat warning as error by removing the flag /WX in compiler option:

https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2220?view=msvc-170

HerveAncher avatar Sep 14 '22 10:09 HerveAncher

Hi, In fact, I never try to compile Nginx with MSVC, I am using MSYS2.

The error MSVC returns telling you that the left shift imply that the temporary created variable potentially become a 64 bits, and to fix that I think you just have to convert:

(1 << h.type)

to: (ngx_uint_t)(1 << h.type)

hi ! i modified lines 508 and 521 like you said in ngx_rtmp_flv_module.c and it's now working like expected (compiling nginx with your RTMP module in 64 bits with MSVC). Thanks so much

Broukmiken avatar Sep 14 '22 19:09 Broukmiken