DIAL 샘플 빌드하기

Ydal (토론 | 기여)님의 2013년 12월 30일 (월) 13:21 판


   Ubuntu 13.10 64 bit
   Firefox 25.0.1 (Mozilla Firefox for Ubuntu canonical - 1.0)
   g++ (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1

curl 7.32.0 (x86_64-pc-linux-gnu) libcurl/7.32.0 OpenSSL/1.0.1e zlib/1.2.8 libidn/1.28 librtmp/2.3


DIAL exmaple code download DIAL-1.0.2-1676049.tar.gz 다운로드

tar zxvf DIAL-1.0.2-1676049.tar.gz 
cd src
make

fatal error: bits/c++config.h: No such file or directory

sudo apt-get install gcc-4.8-multilib g++-4.8-multilib

main.cpp:287:12: error: ‘sleep’ was not declared in this scope client/main.cpp

#include <unistd.h>

DialConformance.cpp:424:33: error: ‘usleep’ was not declared in this scope client/DialConformance.cpp

#include <unistd.h>

DialServer.cpp:27:23: fatal error: curl/curl.h: No such file or directory

sudo apt-get install libcurl4-openssl-dev

/usr/include/curl/curlrules.h:143:41: error: size of array ‘__curl_rule_01__’ is negative client/makefile -m32 제거

#         $(CC) -Wall -Werror -g $(OBJS) $(INCLUDES) $(LDFLAGS) -ldl -lpthread -lcurl -lz -lcrypto -lssl -lcares -m32 -o dialclient
            $(CC) -Wall -Werror -g $(OBJS) $(INCLUDES) $(LDFLAGS) -ldl -lpthread -lcurl -lz -lcrypto -lssl -lcares -o dialclient

main.cpp:59:40: error: format ‘%Zu’ expects argument of type ‘size_t’, but argument 2 has type ‘int’ [-Werror=format=] client/main.cpp (size_t) 추가

        printf("%Zu: Server IP[%s] UUID[%s] FriendlyName[%s] \n",
            (size_t)i+1, (*it)->getIpAddress().c_str(),
            uuid.c_str(), name.c_str() );
                   printf("Server %Zu: %s\n", (size_t)i+1, name.c_str());

DialDiscovery.cpp:134:14: error: variable ‘res’ set but not used [-Werror=unused-but-set-variable] client/DialDiscovery.cpp (void)res 추가

     CURL *curl;
     CURLcode res = CURLE_OK;
     (void)res;

DialDiscovery.cpp:257:84: error: too many arguments for format [-Werror=format-extra-args] client/DialDiscovery.cpp

     send_size = snprintf(send_buf, sizeof(send_buf), ssdp_msearch/*, ip_addr, my_port*/);
 51 //static char ip_addr[INET_ADDRSTRLEN] = "127.0.0.1";
 52 //static int my_port = 0;

/usr/bin/ld: cannot find -lcares

#         $(CC) -Wall -Werror -g $(OBJS) $(INCLUDES) $(LDFLAGS) -ldl -lpthread -lcurl -lz -lcrypto -lssl -lcares -m32 -o dialclient
            $(CC) -Wall -Werror -g $(OBJS) $(INCLUDES) $(LDFLAGS) -ldl -lpthread -lcurl -lz -lcrypto -lssl -o dialclient

main.c:319:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] server/main.c (long) 추가

319     waitpid((pid_t)(long)run_id, NULL, WNOHANG); // reap child
patch -p1 < dial.patch
 
diff -rupN src_org/client/DialConformance.cpp src/client/DialConformance.cpp
--- src_org/client/DialConformance.cpp	2013-12-30 12:51:43.017984698 +0900
+++ src/client/DialConformance.cpp	2013-12-30 12:54:19.853987278 +0900
@@ -32,6 +32,7 @@
 #include <time.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 // Number of milliseconds to sleep between launches when doing a launch=ALL
 #define LAUNCH_SLEEP 6000
diff -rupN src_org/client/DialDiscovery.cpp src/client/DialDiscovery.cpp
--- src_org/client/DialDiscovery.cpp	2013-12-30 12:51:43.009984698 +0900
+++ src/client/DialDiscovery.cpp	2013-12-30 12:54:02.941987000 +0900
@@ -48,8 +48,8 @@ using namespace std;
 
 DialDiscovery *DialDiscovery::sDiscovery = 0;
 
-static char ip_addr[INET_ADDRSTRLEN] = "127.0.0.1";
-static int my_port = 0;
+//static char ip_addr[INET_ADDRSTRLEN] = "127.0.0.1";
+//static int my_port = 0;
 static struct sockaddr_in saddr;
 typedef struct
 {
@@ -132,6 +132,7 @@ static void getServerInfo( const string
 {
     CURL *curl;
     CURLcode res = CURLE_OK;
+    (void)res;
 
     if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
         fprintf(stderr, "curl_global_init() failed\n");
@@ -253,7 +254,7 @@ void * DialDiscovery::send_mcast(void *p
     pthread_attr_t attr;
     search_conn connection;
 
-    send_size = snprintf(send_buf, sizeof(send_buf), ssdp_msearch, ip_addr, my_port);
+    send_size = snprintf(send_buf, sizeof(send_buf), ssdp_msearch/*, ip_addr, my_port*/);
     ATRACE("[%s:%d] %s\n", __FUNCTION__, __LINE__, send_buf);
 
     if (-1 == (my_sock = socket(AF_INET, SOCK_DGRAM, 0))) {
diff -rupN src_org/client/main.cpp src/client/main.cpp
--- src_org/client/main.cpp	2013-12-30 12:51:43.009984698 +0900
+++ src/client/main.cpp	2013-12-30 12:52:37.113985588 +0900
@@ -30,6 +30,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 using namespace std;
 
@@ -54,7 +55,7 @@ static void printServerList( vector<Dial
         (*it)->getFriendlyName( name );
         (*it)->getUuid( uuid );
         printf("%Zu: Server IP[%s] UUID[%s] FriendlyName[%s] \n", 
-            i+1, (*it)->getIpAddress().c_str(),
+            (size_t)i+1, (*it)->getIpAddress().c_str(),
             uuid.c_str(), name.c_str() );
     }
 }
@@ -181,7 +182,7 @@ int handleUser(DialDiscovery *pDial) {
                 {
                     string name;
                     list[i]->getFriendlyName(name);
-                    printf("Server %Zu: %s\n", i+1, name.c_str());
+                    printf("Server %Zu: %s\n", (size_t)i+1, name.c_str());
                 }
                 printf("\n*********************************\n\n");
             }break;
diff -rupN src_org/client/makefile src/client/makefile
--- src_org/client/makefile	2013-12-30 12:51:43.009984698 +0900
+++ src/client/makefile	2013-12-30 12:53:00.333985970 +0900
@@ -8,7 +8,7 @@ OBJS := main.cpp DialServer.cpp DialDisc
 
 # You may not need all these libraries.  This example uses a build of curl that needs crypto, ssl, cares, and zlib
 dialclient: $(OBJS) ${includes}
-	$(CC) -Wall -Werror -g $(OBJS) $(INCLUDES) $(LDFLAGS) -ldl -lpthread -lcurl -lz -lcrypto -lssl -lcares -m32 -o dialclient
+	$(CC) -Wall -Werror -g $(OBJS) $(INCLUDES) $(LDFLAGS) -ldl -lpthread -lcurl -lz -lcrypto -lssl -o dialclient
 
 clean:
 	rm -f *.o dialclient
diff -rupN src_org/server/main.c src/server/main.c
--- src_org/server/main.c	2013-12-30 12:51:43.025984698 +0900
+++ src/server/main.c	2013-12-30 12:54:37.861987574 +0900
@@ -316,7 +316,7 @@ static DIALStatus netflix_status(DIALSer
     // Netflix application can stop
     *pCanStop = 1;
 
-    waitpid((pid_t)run_id, NULL, WNOHANG); // reap child
+    waitpid((pid_t)(long)run_id, NULL, WNOHANG); // reap child
     return isAppRunning( spAppNetflix, NULL ) ? kDIALStatusRunning : kDIALStatusStopped;
 }
$ ./server/dialserver 
Netflix is Not Running
YouTube is Not Running
launcher listening on gDialPort 56789
SSDP listening on 172.30.1.1:56790

Sending SSDP reply to 172.30.1.1:59347
$ ./client/dialclient 
0. List DIAL servers
1. Launch Netflix
2. Kill Netflix
3. Netflix status
4. Launch YouTube
5. Kill YouTube
6. YouTube status
7. Run conformance tests
8. QUIT
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}