dlt-daemon icon indicating copy to clipboard operation
dlt-daemon copied to clipboard

Can this daemon be compiled with windows

Open manojchandrabhanu opened this issue 5 years ago • 26 comments

Is it possible to compile this with windows and create a dll instead of so file.

manojchandrabhanu avatar Jun 15 '19 15:06 manojchandrabhanu

@manojc99 I'm afraid that current DLT cannot be compiled on Windows. It seems initial version of dlt-daemon supported Windows, but after that it was considered for Linux usage only, so some headers, which are not available on Windows, are not excluded for Windows.

ssugiura avatar Jun 17 '19 02:06 ssugiura

@manojc99 Do you have any updates from your side?

ssugiura avatar Jul 25 '19 23:07 ssugiura

you can comile by using cygwin on windows, I have done

chenlimingcn avatar Sep 25 '19 09:09 chenlimingcn

Thanks for the reply Rimon. Any instructions that you can share please

On Wed, 25 Sep 2019, 3:28 pm Rimon Chen, [email protected] wrote:

you can comile by using cygwin on windows, I have done

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GENIVI/dlt-daemon/issues/136?email_source=notifications&email_token=AHT32ULS6KNEXOSTHBZC27TQLMY5JA5CNFSM4HYPGSZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7RKSEA#issuecomment-534948112, or mute the thread https://github.com/notifications/unsubscribe-auth/AHT32UP6GOFE63AWBQ2T2F3QLMY5JANCNFSM4HYPGSZQ .

manojchandrabhanu avatar Sep 25 '19 10:09 manojchandrabhanu

git pull to this version eb3dcd26c80c4ac6e431b09b50b0861b9753ceea(master) and then modified as follow diff output

diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c index b7766f0..ed548f0 100644

 static int dlt_daemon_init_fifo(DltDaemonLocal *daemon_local)
 
     if (daemon_local->daemonFifoSize != 0) {
         /* Set Daemon FIFO size */
-    if (fcntl(fd, F_SETPIPE_SZ, daemon_local->daemonFifoSize) == -1) {
+    if (fcntl(fd, FD_SETSIZE, daemon_local->daemonFifoSize) == -1) {
             snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "set FIFO size error: %s\n", strerror(errno));
             dlt_log(LOG_ERR, str);
         }
     }
 
     /* Get Daemon FIFO size */
-    if ((fifo_size = fcntl(fd, F_GETPIPE_SZ, 0)) == -1) {
+    if ((fifo_size = fcntl(fd, FD_GETSIZE, 0)) == -1) {
         snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "get FIFO size error: %s\n", strerror(errno));
         dlt_log(LOG_ERR, str);
     }

diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c

  * \file dlt_user.c
  */
 
+ #define PTHREAD_MUTEX_ROBUST  PTHREAD_MUTEX_DEFAULT 
+ #define pthread_mutex_consistent pthread_mutex_lock
+ 
 #include <stdlib.h> /* for getenv(), free(), atexit() */
 #include <string.h> /* for strcmp(), strncmp(), strlen(), memset(), memcpy() */
 #include <signal.h> /* for signal(), SIGPIPE, SIG_IGN */
@@ -413,10 +416,10 @@ DltReturnValue dlt_init(void)
     }
 
     /* make mutex robust to prevent from deadlock when the segmented thread was cancelled, but held the mutex */
-    if (pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST) != 0) {
-        dlt_user_initialised = false;
-        return DLT_RETURN_ERROR;
-    }
+    //if (pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST) != 0) {
+    //    dlt_user_initialised = false;
+    //    return DLT_RETURN_ERROR;
+    //}
 
     pthread_mutex_init(&mq_mutex, &attr);
     pthread_mutexattr_destroy(&attr);

Thanks for the reply Rimon. Any instructions that you can share please On Wed, 25 Sep 2019, 3:28 pm Rimon Chen, @.***> wrote: you can comile by using cygwin on windows, I have done — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#136?email_source=notifications&email_token=AHT32ULS6KNEXOSTHBZC27TQLMY5JA5CNFSM4HYPGSZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7RKSEA#issuecomment-534948112>, or mute the thread https://github.com/notifications/unsubscribe-auth/AHT32UP6GOFE63AWBQ2T2F3QLMY5JANCNFSM4HYPGSZQ .

chenlimingcn avatar Sep 25 '19 10:09 chenlimingcn

@chenlimingcn You can edit your comment above to put the diff in the diff code block. Example:

```diff
- removed
+ added
```

votrungchi avatar Sep 25 '19 11:09 votrungchi

@chenlimingcn Thanks, great to know that you could compile successfully for Windows too. As suggested from @votrungchi , please modify your comment to show the code diff properly. It's even worth to write it down somewhere in the doc.

ssugiura avatar Sep 25 '19 23:09 ssugiura

@ssugiura have done as above

chenlimingcn avatar Sep 26 '19 01:09 chenlimingcn

Awesome, Will try this and update

manojchandrabhanu avatar Oct 02 '19 06:10 manojchandrabhanu

I have compiled it with cygwin before and it works, if you need I can share the compiled file to you.

koreyoshi-wang avatar Oct 17 '19 08:10 koreyoshi-wang

@koreyoshi-wang , Have you done with cygwin without the change proposed by @chenlimingcn , or any other steps required? Now I know that there are couple of use cases where users want to use DLT on Windows, so I would like to collect all of suggestions and take them into account.

ssugiura avatar Oct 28 '19 00:10 ssugiura

@koreyoshi-wang This is a friendly reminder. Please let us know how you compiled for Windows.

ssugiura avatar Nov 14 '19 04:11 ssugiura

Hi @chenlimingcn , I got the below error while doing make install on cygwin.

$ make install [ 1%] Linking C shared library cygdlt-2.dll /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lsocket collect2: error: ld returned 1 exit status make[2]: *** [src/lib/CMakeFiles/dlt.dir/build.make:174: src/lib/cygdlt-2.dll] Error 1 make[1]: *** [CMakeFiles/Makefile2:160: src/lib/CMakeFiles/dlt.dir/all] Error 2 make: *** [Makefile:130: all] Error 2

manojchandrabhanu avatar Nov 20 '19 15:11 manojchandrabhanu

@koreyoshi-wang This is a friendly reminder. Please let us know how you compiled for Windows.

Hi ssugiura, I have replaced a dependence (pthreads pthreads-w32-2-9-1-release.zip for cygwin, and no change proposed by @chenlimingcn.

koreyoshi-wang avatar Nov 22 '19 10:11 koreyoshi-wang

@koreyoshi-wang can you please share the precompiled binaries

manojchandrabhanu avatar Nov 22 '19 16:11 manojchandrabhanu

@koreyoshi-wang can you please share the precompiled binaries

dlt.zip It's compiled with 64-bit system, and tested on windows 10. Filter didn't work, and I have tried with Linux it didn't work too, so I don't know why.

koreyoshi-wang avatar Nov 25 '19 10:11 koreyoshi-wang

@koreyoshi-wang Thank you for sharing the binary. Could you able to fix filter issue? Can you please share build instructions for windows?

senthil4321 avatar Jun 16 '20 07:06 senthil4321

@koreyoshi-wang @senthil4321 Any update on this?

ssugiura avatar Jul 06 '20 01:07 ssugiura

@koreyoshi-wang Could you please let me know a way to replace pthreads dependency for cygwin?

jayy89 avatar Jul 06 '20 08:07 jayy89

@koreyoshi-wang @senthil4321 Any update on this?

No, I just compiled once, and filter didn't work, but I tested Linux Version the same problem, I don not know the recent status.

koreyoshi-wang avatar Jul 06 '20 09:07 koreyoshi-wang

@koreyoshi-wang Could you please let me know a way to replace pthreads dependency for cygwin?

Sorry, I have uninstalled my cygwin, you just need to search pthreads in your cygwin library and replace ti.

koreyoshi-wang avatar Jul 06 '20 09:07 koreyoshi-wang

@ssugiura @koreyoshi-wang, managed to make the filter work with the windows binary provided. Some points to note. 1. Filter should be in xml format.(Used dlt viewer gui application to create filter) 2. Both Appication ID and Context ID needs to be enabled in the filter. Hope this helps.

senthil4321 avatar Jul 06 '20 13:07 senthil4321

@manojc99 To avoid the socket error comment out all instances of:

    #set(RT_LIBRARY "")
    #set(SOCKET_LIBRARY socket)

and change to(Note these can be copied directly from the if statement above.)

    set(RT_LIBRARY rt)
    set(SOCKET_LIBRARY "")

The cygwin environment does not have libsocket, but should have librt

Edit: This compiles the code, but I have not tested functionality.

cogle avatar Dec 18 '20 03:12 cogle

may I get libdlt.dll that exported all symbols?

iipeace avatar Sep 07 '21 15:09 iipeace

If you are asking me; I no longer have access to the build.

cogle avatar Sep 07 '21 18:09 cogle

Found this repository which has pre-compile file https://github.com/mbehr1/adlt

koreyoshi-wang avatar Aug 03 '22 10:08 koreyoshi-wang

Hello @michael-methner I find this topic DLT on Window very interesting. Should we have an official doc for this topic? If it is OK, I will collect and summarize all users' idea or methods and prepare for a PR. Regards

minminlittleshrimp avatar Aug 13 '23 05:08 minminlittleshrimp

I'm building a C++ app on Window by Visual Studio. I also finish installing DLT daemon by Cygwin on window. How can we send a log message from C++ app to DLT daemon by using DLT library? Is it possible on Window?

thanhthieuBKDN avatar Oct 20 '23 04:10 thanhthieuBKDN

Hello @thanhthieuBKDN Not sure about dlt on Window since I have not tried yet. For dlt usage you can refer to this doc: https://github.com/COVESA/dlt-daemon/blob/master/doc/dlt_for_developers.md Regards

minminlittleshrimp avatar Nov 02 '23 12:11 minminlittleshrimp

@koreyoshi-wang hi, is there any way to set the value of the port in dlt-receive.exe? or is there any other way to do it?

humbicho avatar Nov 09 '23 21:11 humbicho