-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patch for cross-compiling #1
Conversation
thank you for this patch, I have committed half the patch (Makefile). I am not sure if $(LIBS) is needed in linking of all modules. The idea is that |
No, no, the problem is that system libraries for modules (avcodec, speex, cairo and other) is in ./some/filesystem/usr/lib directory, and this directory doesn't take place nowhere... So, I have to specify -L(SYSROOT)/lib for each module, or in common script for all modules. What way is better? |
we have two make variables that can be used: ideally the idea was that LFLAGS contains all linker flags, and LIBS contain so it might be better to use LFLAGS for the extra -L$(SYSROOT)/lib info? mk/mod.mk already contains $(LFLAGS) on the linker stage, so I think all we have (note: the makefile buildsystem is not perfect and might need some cleanup or |
"Not perfect" build system is diabolic autoconf and etc, and your system is pretty much better :D But never mind... I'll try LFLAGS and tell you about results. |
Now we know thaer half of the patch was due garbage on Alex's system, so we can definitely close this one. |
found with Coverity Scan: if (!player->thr.run) { 345 int err; 346 347 player->thr.run = true; 348 err = pthread_create(&player->thr.tid, NULL, 349 rx_thread, player); 4. Condition err, taking true branch. 350 if (err) { 351 player->thr.run = false; CID 331124 (#1 of 1): Missing unlock (LOCK) 5. missing_unlock: Returning without unlocking player->thr.mutex. 352 return; 353 } 354 } 355 356 pthread_cond_signal(&player->thr.cond); 357 pthread_mutex_unlock(&player->thr.mutex);
* multicast: fix missing unlock found with Coverity Scan: if (!player->thr.run) { 345 int err; 346 347 player->thr.run = true; 348 err = pthread_create(&player->thr.tid, NULL, 349 rx_thread, player); 4. Condition err, taking true branch. 350 if (err) { 351 player->thr.run = false; CID 331124 (#1 of 1): Missing unlock (LOCK) 5. missing_unlock: Returning without unlocking player->thr.mutex. 352 return; 353 } 354 } 355 356 pthread_cond_signal(&player->thr.cond); 357 pthread_mutex_unlock(&player->thr.mutex); * fix formatting
CID 333030 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW) 2. fixed_size_dest: You might overrun the 9-character fixed-size string buf by copying the return value of sip_transp_name without checking the length.
Fixes: WARNING: ThreadSanitizer: data race (pid=298819) Write of size 1 at 0x7b68000013c8 by main thread (mutexes: write M1592): #0 aurx_stream_decode /baresip/src/audio.c:1089:20 (baresip+0x1263e5) #1 stream_recv_handler /baresip/src/audio.c:1195:8 (baresip+0x11ef36) Previous read of size 1 at 0x7b68000013c8 by thread T1 (mutexes: write M1569): #0 auplay_write_handler /baresip/src/audio.c:703:10 (baresip+0x125236) Location is heap block of size 1504 at 0x7b6800001200 allocated by main thread: #1 mem_alloc /re/src/mem/mem.c:141:6 (baresip+0x29b9df) #2 mem_zalloc /re/src/mem/mem.c:174:6 (baresip+0x29be85) #3 audio_alloc /baresip/src/audio.c:1270:6 (baresip+0x11d1f7)
Fixes: WARNING: ThreadSanitizer: data race (pid=298819) Write of size 1 at 0x7b68000013c8 by main thread (mutexes: write M1592): #0 aurx_stream_decode /baresip/src/audio.c:1089:20 (baresip+0x1263e5) #1 stream_recv_handler /baresip/src/audio.c:1195:8 (baresip+0x11ef36) Previous read of size 1 at 0x7b68000013c8 by thread T1 (mutexes: write M1569): #0 auplay_write_handler /baresip/src/audio.c:703:10 (baresip+0x125236) Location is heap block of size 1504 at 0x7b6800001200 allocated by main thread: #1 mem_alloc /re/src/mem/mem.c:141:6 (baresip+0x29b9df) #2 mem_zalloc /re/src/mem/mem.c:174:6 (baresip+0x29be85) #3 audio_alloc /baresip/src/audio.c:1270:6 (baresip+0x11d1f7)
WARNING: ThreadSanitizer: data race (pid=18337) Write of size 1 at 0x7b6800001368 by main thread (mutexes: write M1592, write M1580): #0 stop_tx /baresip/src/audio.c:285:16 (baresip+0x1206a0) #1 audio_stop /baresip/src/audio.c:1888:2 (baresip+0x1205ad) Previous read of size 1 at 0x7b6800001368 by thread T2: #0 tx_thread /baresip/src/audio.c:1445:16 (baresip+0x125a97) Location is heap block of size 1512 at 0x7b6800001200 allocated by main thread: #0 malloc <null> (baresip+0x8e19e) #1 mem_alloc /re/src/mem/mem.c:141:6 (baresip+0x29a86f) #2 mem_zalloc /re/src/mem/mem.c:174:6 (baresip+0x29ad15) #3 audio_alloc /baresip/src/audio.c:1276:6 (baresip+0x11c1e7)
WARNING: ThreadSanitizer: data race (pid=18337) Write of size 1 at 0x7b6800001368 by main thread (mutexes: write M1592, write M1580): #0 stop_tx /baresip/src/audio.c:285:16 (baresip+0x1206a0) #1 audio_stop /baresip/src/audio.c:1888:2 (baresip+0x1205ad) Previous read of size 1 at 0x7b6800001368 by thread T2: #0 tx_thread /baresip/src/audio.c:1445:16 (baresip+0x125a97) Location is heap block of size 1512 at 0x7b6800001200 allocated by main thread: #0 malloc <null> (baresip+0x8e19e) #1 mem_alloc /re/src/mem/mem.c:141:6 (baresip+0x29a86f) #2 mem_zalloc /re/src/mem/mem.c:174:6 (baresip+0x29ad15) #3 audio_alloc /baresip/src/audio.c:1276:6 (baresip+0x11c1e7)
WARNING: ThreadSanitizer: data race (pid=18337) Write of size 1 at 0x7b6800001368 by main thread (mutexes: write M1592, write M1580): #0 stop_tx /baresip/src/audio.c:285:16 (baresip+0x1206a0) #1 audio_stop /baresip/src/audio.c:1888:2 (baresip+0x1205ad) Previous read of size 1 at 0x7b6800001368 by thread T2: #0 tx_thread /baresip/src/audio.c:1445:16 (baresip+0x125a97) Location is heap block of size 1512 at 0x7b6800001200 allocated by main thread: #0 malloc <null> (baresip+0x8e19e) #1 mem_alloc /re/src/mem/mem.c:141:6 (baresip+0x29a86f) #2 mem_zalloc /re/src/mem/mem.c:174:6 (baresip+0x29ad15) #3 audio_alloc /baresip/src/audio.c:1276:6 (baresip+0x11c1e7)
Fixes: WARNING: ThreadSanitizer: data race (pid=298819) Write of size 1 at 0x7b68000013c8 by main thread (mutexes: write M1592): #0 aurx_stream_decode /baresip/src/audio.c:1089:20 (baresip+0x1263e5) #1 stream_recv_handler /baresip/src/audio.c:1195:8 (baresip+0x11ef36) Previous read of size 1 at 0x7b68000013c8 by thread T1 (mutexes: write M1569): #0 auplay_write_handler /baresip/src/audio.c:703:10 (baresip+0x125236) Location is heap block of size 1504 at 0x7b6800001200 allocated by main thread: #1 mem_alloc /re/src/mem/mem.c:141:6 (baresip+0x29b9df) #2 mem_zalloc /re/src/mem/mem.c:174:6 (baresip+0x29be85) #3 audio_alloc /baresip/src/audio.c:1270:6 (baresip+0x11d1f7)
WARNING: ThreadSanitizer: data race (pid=18337) Write of size 1 at 0x7b6800001368 by main thread (mutexes: write M1592, write M1580): #0 stop_tx /baresip/src/audio.c:285:16 (baresip+0x1206a0) #1 audio_stop /baresip/src/audio.c:1888:2 (baresip+0x1205ad) Previous read of size 1 at 0x7b6800001368 by thread T2: #0 tx_thread /baresip/src/audio.c:1445:16 (baresip+0x125a97) Location is heap block of size 1512 at 0x7b6800001200 allocated by main thread: #0 malloc <null> (baresip+0x8e19e) #1 mem_alloc /re/src/mem/mem.c:141:6 (baresip+0x29a86f) #2 mem_zalloc /re/src/mem/mem.c:174:6 (baresip+0x29ad15) #3 audio_alloc /baresip/src/audio.c:1276:6 (baresip+0x11c1e7)
Fixes: WARNING: ThreadSanitizer: data race (pid=298819) Write of size 1 at 0x7b68000013c8 by main thread (mutexes: write M1592): #0 aurx_stream_decode /baresip/src/audio.c:1089:20 (baresip+0x1263e5) #1 stream_recv_handler /baresip/src/audio.c:1195:8 (baresip+0x11ef36) Previous read of size 1 at 0x7b68000013c8 by thread T1 (mutexes: write M1569): #0 auplay_write_handler /baresip/src/audio.c:703:10 (baresip+0x125236) Location is heap block of size 1504 at 0x7b6800001200 allocated by main thread: #1 mem_alloc /re/src/mem/mem.c:141:6 (baresip+0x29b9df) #2 mem_zalloc /re/src/mem/mem.c:174:6 (baresip+0x29be85) #3 audio_alloc /baresip/src/audio.c:1270:6 (baresip+0x11d1f7)
WARNING: ThreadSanitizer: data race (pid=18337) Write of size 1 at 0x7b6800001368 by main thread (mutexes: write M1592, write M1580): #0 stop_tx /baresip/src/audio.c:285:16 (baresip+0x1206a0) #1 audio_stop /baresip/src/audio.c:1888:2 (baresip+0x1205ad) Previous read of size 1 at 0x7b6800001368 by thread T2: #0 tx_thread /baresip/src/audio.c:1445:16 (baresip+0x125a97) Location is heap block of size 1512 at 0x7b6800001200 allocated by main thread: #0 malloc <null> (baresip+0x8e19e) #1 mem_alloc /re/src/mem/mem.c:141:6 (baresip+0x29a86f) #2 mem_zalloc /re/src/mem/mem.c:174:6 (baresip+0x29ad15) #3 audio_alloc /baresip/src/audio.c:1276:6 (baresip+0x11c1e7)
Fixes: WARNING: ThreadSanitizer: data race (pid=298819) Write of size 1 at 0x7b68000013c8 by main thread (mutexes: write M1592): #0 aurx_stream_decode /baresip/src/audio.c:1089:20 (baresip+0x1263e5) #1 stream_recv_handler /baresip/src/audio.c:1195:8 (baresip+0x11ef36) Previous read of size 1 at 0x7b68000013c8 by thread T1 (mutexes: write M1569): #0 auplay_write_handler /baresip/src/audio.c:703:10 (baresip+0x125236) Location is heap block of size 1504 at 0x7b6800001200 allocated by main thread: #1 mem_alloc /re/src/mem/mem.c:141:6 (baresip+0x29b9df) #2 mem_zalloc /re/src/mem/mem.c:174:6 (baresip+0x29be85) #3 audio_alloc /baresip/src/audio.c:1270:6 (baresip+0x11d1f7)
WARNING: ThreadSanitizer: data race (pid=18337) Write of size 1 at 0x7b6800001368 by main thread (mutexes: write M1592, write M1580): #0 stop_tx /baresip/src/audio.c:285:16 (baresip+0x1206a0) #1 audio_stop /baresip/src/audio.c:1888:2 (baresip+0x1205ad) Previous read of size 1 at 0x7b6800001368 by thread T2: #0 tx_thread /baresip/src/audio.c:1445:16 (baresip+0x125a97) Location is heap block of size 1512 at 0x7b6800001200 allocated by main thread: #0 malloc <null> (baresip+0x8e19e) #1 mem_alloc /re/src/mem/mem.c:141:6 (baresip+0x29a86f) #2 mem_zalloc /re/src/mem/mem.c:174:6 (baresip+0x29ad15) #3 audio_alloc /baresip/src/audio.c:1276:6 (baresip+0x11c1e7)
WARNING: ThreadSanitizer: data race (pid=59549) Read of size 8 at 0x7b3800003ed8 by thread T2 (mutexes: read M1643): #0 aubuf_cur_size /rem/src/aubuf/aubuf.c:392:11 (baresip+0x205044) #1 ausrc_read_handler /baresip/src/audio.c:886:6 (baresip+0x11d6ac) #2 read_thread /baresip/modules/alsa/alsa_src.c:88:3 (baresip+0x16a193) Previous write of size 8 at 0x7b3800003ed8 by main thread (mutexes: write M1554): #0 memset <null> (baresip+0xcc85d) #1 mem_zalloc /re/src/mem/mem.c:178:2 (baresip+0x1f4273) #2 aubuf_alloc /rem/src/aubuf/aubuf.c:78:7 (baresip+0x20453a) #3 start_source /baresip/src/audio.c:1756:10 (baresip+0x11bb77) #4 audio_start /baresip/src/audio.c:1823:9 (baresip+0x11b148) #5 audio_encoder_set /baresip/src/audio.c:1982:10 (baresip+0x11c44b) #6 start_audio /baresip/src/call.c:146:10 (baresip+0x126b01) #7 menc_event_handler /baresip/src/call.c:488:10 (baresip+0x121f10) #8 dtls_estab_handler /baresip/modules/dtls_srtp/dtls_srtp.c:269:4 (baresip+0x17545a) #9 conn_recv /re/src/tls/openssl/tls_udp.c:402:4 (baresip+0x1e819d) #10 recv_handler /re/src/tls/openssl/tls_udp.c:772:3 (baresip+0x1e819d) #11 udp_read /re/src/udp/udp.c:237:10 (baresip+0x1debc5) #12 udp_read_handler /re/src/udp/udp.c:255:2 (baresip+0x1de541) #13 fd_poll /re/src/main/main.c:885:4 (baresip+0x1f2fe6) #14 re_main /re/src/main/main.c:1023:9 (baresip+0x1f2fe6) #15 main /baresip/src/main.c:299:8 (baresip+0x145524) Location is heap block of size 216 at 0x7b3800003e20 allocated by main thread: #0 malloc <null> (baresip+0x8f12e) #1 mem_alloc /re/src/mem/mem.c:141:6 (baresip+0x1f409d) #2 mem_zalloc /re/src/mem/mem.c:174:6 (baresip+0x1f425e) #3 aubuf_alloc /rem/src/aubuf/aubuf.c:78:7 (baresip+0x20453a) #4 start_source /baresip/src/audio.c:1756:10 (baresip+0x11bb77) #5 audio_start /baresip/src/audio.c:1823:9 (baresip+0x11b148) #6 audio_encoder_set /baresip/src/audio.c:1982:10 (baresip+0x11c44b) #7 start_audio /baresip/src/call.c:146:10 (baresip+0x126b01) #8 menc_event_handler /baresip/src/call.c:488:10 (baresip+0x121f10)
* audio: allocate aubuf before ausrc_alloc (fixes data race) WARNING: ThreadSanitizer: data race (pid=59549) Read of size 8 at 0x7b3800003ed8 by thread T2 (mutexes: read M1643): #0 aubuf_cur_size /rem/src/aubuf/aubuf.c:392:11 (baresip+0x205044) #1 ausrc_read_handler /baresip/src/audio.c:886:6 (baresip+0x11d6ac) #2 read_thread /baresip/modules/alsa/alsa_src.c:88:3 (baresip+0x16a193) Previous write of size 8 at 0x7b3800003ed8 by main thread (mutexes: write M1554): #0 memset <null> (baresip+0xcc85d) #1 mem_zalloc /re/src/mem/mem.c:178:2 (baresip+0x1f4273) #2 aubuf_alloc /rem/src/aubuf/aubuf.c:78:7 (baresip+0x20453a) #3 start_source /baresip/src/audio.c:1756:10 (baresip+0x11bb77) #4 audio_start /baresip/src/audio.c:1823:9 (baresip+0x11b148) #5 audio_encoder_set /baresip/src/audio.c:1982:10 (baresip+0x11c44b) #6 start_audio /baresip/src/call.c:146:10 (baresip+0x126b01) #7 menc_event_handler /baresip/src/call.c:488:10 (baresip+0x121f10) #8 dtls_estab_handler /baresip/modules/dtls_srtp/dtls_srtp.c:269:4 (baresip+0x17545a) #9 conn_recv /re/src/tls/openssl/tls_udp.c:402:4 (baresip+0x1e819d) #10 recv_handler /re/src/tls/openssl/tls_udp.c:772:3 (baresip+0x1e819d) #11 udp_read /re/src/udp/udp.c:237:10 (baresip+0x1debc5) #12 udp_read_handler /re/src/udp/udp.c:255:2 (baresip+0x1de541) #13 fd_poll /re/src/main/main.c:885:4 (baresip+0x1f2fe6) #14 re_main /re/src/main/main.c:1023:9 (baresip+0x1f2fe6) #15 main /baresip/src/main.c:299:8 (baresip+0x145524) Location is heap block of size 216 at 0x7b3800003e20 allocated by main thread: #0 malloc <null> (baresip+0x8f12e) #1 mem_alloc /re/src/mem/mem.c:141:6 (baresip+0x1f409d) #2 mem_zalloc /re/src/mem/mem.c:174:6 (baresip+0x1f425e) #3 aubuf_alloc /rem/src/aubuf/aubuf.c:78:7 (baresip+0x20453a) #4 start_source /baresip/src/audio.c:1756:10 (baresip+0x11bb77) #5 audio_start /baresip/src/audio.c:1823:9 (baresip+0x11b148) #6 audio_encoder_set /baresip/src/audio.c:1982:10 (baresip+0x11c44b) #7 start_audio /baresip/src/call.c:146:10 (baresip+0x126b01) #8 menc_event_handler /baresip/src/call.c:488:10 (baresip+0x121f10) * audio: recalculate and resize aubuf if necessary * fix ausrc_prm setting * ausrc_prm needs to be set before ausrc_alloc too * fix newline * audio/start_source: allow prm format changes
For cross-compiling of baresip I used the next directory structure:
./re
./rem
./baresip
So, I cross-compiled with next commands in my custom Makefile:
Cross-compile "re"
. some-arm-env-setup; cd re; make SYSROOT=$(TARGET_FSROOT)/usr PREFIX=$(TARGET_FSROOT)/usr/local
Cross-compile "rem"
. some-arm-env-setup; cd rem; make SYSROOT=$(TARGET_FSROOT)/usr PREFIX=$(TARGET_FSROOT)/usr/local LIBRE_INC=../re/include
Cross-compile "baresip"
. some-arm-env-setup; cd baresip; make SYSROOT=$(TARGET_FSROOT)/usr DESTDIR=$(TARGET_FSROOT) PREFIX=/usr/local LIBRE_INC=../re/include
In short, I used SYSROOT, PREFIX, DESTDIR and LIBRE_INC... And this patch fixes using of SYSROOT for baresip.