"DIAL 샘플 빌드하기"의 두 판 사이의 차이

잔글
16번째 줄: 16번째 줄:
main.cpp:287:12: error: ‘sleep’ was not declared in this scope
main.cpp:287:12: error: ‘sleep’ was not declared in this scope
client/main.cpp
client/main.cpp
<source lang="c++" line start="33">
<source lang="cpp" line start="33">
#include <unistd.h>
#include <unistd.h>
</source>
</source>
22번째 줄: 22번째 줄:
DialConformance.cpp:424:33: error: ‘usleep’ was not declared in this scope
DialConformance.cpp:424:33: error: ‘usleep’ was not declared in this scope
client/DialConformance.cpp
client/DialConformance.cpp
<source lang="c++" line start="35">
<source lang="cpp" line start="35">
#include <unistd.h>
#include <unistd.h>
</source>
</source>
34번째 줄: 34번째 줄:
client/makefile
client/makefile
-m32 제거
-m32 제거
<source lang="makefile" line start="11">
<source lang="make" line start="11">
#        $(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 -m32 -o dialclient
             $(CC) -Wall -Werror -g $(OBJS) $(INCLUDES) $(LDFLAGS) -ldl -lpthread -lcurl -lz -lcrypto -lssl -lcares -o dialclient
             $(CC) -Wall -Werror -g $(OBJS) $(INCLUDES) $(LDFLAGS) -ldl -lpthread -lcurl -lz -lcrypto -lssl -lcares -o dialclient
41번째 줄: 41번째 줄:
main.cpp:59:40: error: format ‘%Zu’ expects argument of type ‘size_t’, but argument 2 has type ‘int’ [-Werror=format=]
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) 추가
client/main.cpp (size_t) 추가
<source lang="c++" line start="57">
<source lang="cpp" line start="57">
         printf("%Zu: Server IP[%s] UUID[%s] FriendlyName[%s] \n",
         printf("%Zu: Server IP[%s] UUID[%s] FriendlyName[%s] \n",
             (size_t)i+1, (*it)->getIpAddress().c_str(),
             (size_t)i+1, (*it)->getIpAddress().c_str(),
             uuid.c_str(), name.c_str() );
             uuid.c_str(), name.c_str() );
</source>
</source>
<source lang="c++" line start="185">
<source lang="cpp" line start="185">
                   printf("Server %Zu: %s\n", (size_t)i+1, name.c_str());
                   printf("Server %Zu: %s\n", (size_t)i+1, name.c_str());
</source>
</source>
53번째 줄: 53번째 줄:
client/DialDiscovery.cpp
client/DialDiscovery.cpp
(void)res 추가
(void)res 추가
<source lang="c++" line start="133">
<source lang="cpp" line start="133">
     CURL *curl;
     CURL *curl;
     CURLcode res = CURLE_OK;
     CURLcode res = CURLE_OK;
61번째 줄: 61번째 줄:
DialDiscovery.cpp:257:84: error: too many arguments for format [-Werror=format-extra-args]
DialDiscovery.cpp:257:84: error: too many arguments for format [-Werror=format-extra-args]
client/DialDiscovery.cpp
client/DialDiscovery.cpp
<source lang="c++" line start="257">
<source lang="cpp" line start="257">
     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*/);
</source>
</source>
 
<source lang="cpp" line start="51">
DialDiscovery.cpp:51:13: error: ‘ip_addr’ defined but not used [-Werror=unused-variable]
DialDiscovery.cpp:52:12: error: ‘my_port’ defined but not used [-Werror=unused-variable]
client/DialDiscovery.cpp
<source lang="c++" line start="51">
  51 //static char ip_addr[INET_ADDRSTRLEN] = "127.0.0.1";
  51 //static char ip_addr[INET_ADDRSTRLEN] = "127.0.0.1";
  52 //static int my_port = 0;
  52 //static int my_port = 0;
74번째 줄: 70번째 줄:


/usr/bin/ld: cannot find -lcares
/usr/bin/ld: cannot find -lcares
<source lang="makefile" line start="11">
<source lang="make" line start="11">
#        $(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 -m32 -o dialclient
             $(CC) -Wall -Werror -g $(OBJS) $(INCLUDES) $(LDFLAGS) -ldl -lpthread -lcurl -lz -lcrypto -lssl -o dialclient
             $(CC) -Wall -Werror -g $(OBJS) $(INCLUDES) $(LDFLAGS) -ldl -lpthread -lcurl -lz -lcrypto -lssl -o dialclient
81번째 줄: 77번째 줄:
main.c:319:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
main.c:319:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
server/main.c (long) 추가
server/main.c (long) 추가
<source lang="c++" line start="319">
<source lang="cpp" line start="319">
319    waitpid((pid_t)(long)run_id, NULL, WNOHANG); // reap child
319    waitpid((pid_t)(long)run_id, NULL, WNOHANG); // reap child
</source>
</source>

2013년 12월 30일 (월) 13:19 판


DIAL exmaple code download

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 }}