Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Can this daemon be compiled with windows #136

Closed
manojchandrabhanu opened this issue Jun 15, 2019 · 30 comments
Closed

Can this daemon be compiled with windows #136

manojchandrabhanu opened this issue Jun 15, 2019 · 30 comments
Assignees

Comments

@manojchandrabhanu
Copy link

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

@ssugiura
Copy link
Collaborator

@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
Copy link
Collaborator

@manojc99 Do you have any updates from your side?

@chenlimingcn
Copy link

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

@manojchandrabhanu
Copy link
Author

manojchandrabhanu commented Sep 25, 2019 via email

@chenlimingcn
Copy link

chenlimingcn commented Sep 25, 2019

git pull to this version eb3dcd2(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 .

@votrungchi
Copy link
Contributor

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

```diff
- removed
+ added
```

@ssugiura
Copy link
Collaborator

@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.

@chenlimingcn
Copy link

@ssugiura have done as above

@manojchandrabhanu
Copy link
Author

Awesome, Will try this and update

@koreyoshi-wang
Copy link

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

@ssugiura
Copy link
Collaborator

@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
Copy link
Collaborator

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

@manojchandrabhanu
Copy link
Author

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

@koreyoshi-wang
Copy link

@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.

@manojchandrabhanu
Copy link
Author

@koreyoshi-wang can you please share the precompiled binaries

@koreyoshi-wang
Copy link

@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.

@senthil4321
Copy link

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

@ssugiura
Copy link
Collaborator

ssugiura commented Jul 6, 2020

@koreyoshi-wang @senthil4321 Any update on this?

@jayy89
Copy link

jayy89 commented Jul 6, 2020

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

@koreyoshi-wang
Copy link

@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
Copy link

@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.

@senthil4321
Copy link

senthil4321 commented Jul 6, 2020

@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.

@cogle
Copy link

cogle commented Dec 18, 2020

@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.

@iipeace
Copy link

iipeace commented Sep 7, 2021

may I get libdlt.dll that exported all symbols?

@cogle
Copy link

cogle commented Sep 7, 2021

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

@koreyoshi-wang
Copy link

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

@minminlittleshrimp
Copy link
Collaborator

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 minminlittleshrimp self-assigned this Aug 13, 2023
@thanhthieuBKDN
Copy link

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?

@minminlittleshrimp
Copy link
Collaborator

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

@humbicho
Copy link

humbicho commented Nov 9, 2023

@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?

@COVESA COVESA locked and limited conversation to collaborators Nov 10, 2023
@minminlittleshrimp minminlittleshrimp converted this issue into discussion #564 Nov 10, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests