Skip to contentSkip to conversation

Change in openvpn[master]: CMakeLists.txt: Don't fail on missing compile_commands.json

Openvpn-devel stipa (Code Review) 1 participant 7 messages Jan 11, 2024 – Jan 17, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1704979923000.Ic19f859c3aca8b30aa51b12dcb906a6e7e735019@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/495?usp=email

to review the following change.

Change subject: CMakeLists.txt: Don't fail on missing compile_commands.json
......................................................................

CMakeLists.txt: Don't fail on missing compile_commands.json

CMAKE_EXPORT_COMPILE_COMMANDS works only on Ninja and Makefile generators and doesn't produce anything on MSVC.

Due to that, creating symlink for it fails for me.

Fix by make symlink creation non-fatal by providing variable to store result.

Change-Id Ic19f859c3aca8b30aa51b12dcb906a6e7e735019

---
M CMakeLists.txt

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/95/495/1

CMakeLists.txt +1 -1
index bc46c27..5c6fff0 100644
@@ -45,7 +45,7 @@
 # Create machine readable compile commands
 set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
 file(CREATE_LINK ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json
-                 ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json SYMBOLIC)
+                 ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json RESULT COMPILE_COMMANDS_CREATED SYMBOLIC)
 
 # AddressSanitize - use CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYPE=asan to build with ASAN
 set(CMAKE_C_FLAGS_ASAN

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/495?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic19f859c3aca8b30aa51b12dcb906a6e7e735019
Gerrit-Change-Number: 495
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos, stipa.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/495?usp=email )

Change subject: CMakeLists.txt: Don't fail on missing compile_commands.json
......................................................................

Patch Set 1: Code-Review-1

(1 comment)

Patchset:

PS1:
As discussed on IRC: I really would like to understand and document WHY this patch is needed. When calling CMake directly (e.g. in GHA), the broken symlink is created without complaint.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/495?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic19f859c3aca8b30aa51b12dcb906a6e7e735019
Gerrit-Change-Number: 495
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Fri, 12 Jan 2024 10:28:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/495?usp=email )

Change subject: CMakeLists.txt: Don't fail on missing compile_commands.json
......................................................................

Patch Set 1:

(1 comment)

Patchset:

PS1:

Quoted 1 line

As discussed on IRC: I really would like to understand and document WHY this patch is needed. […]

I got the same error when running CMake from CMD:

https://gist.githubusercontent.com/lstipakov/3c87a0d4c5eeb0ce7c91645171814221/raw/e25fe78607eeb6e0fda4225271e7c248f51e6e81/gistfile1.txt

(the error messages translates to "user doesn't have required permissions")

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/495?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic19f859c3aca8b30aa51b12dcb906a6e7e735019
Gerrit-Change-Number: 495
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Fri, 12 Jan 2024 11:04:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/495?usp=email

to look at the new patch set (#2).

The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld

Change subject: CMakeLists.txt: Don't fail on missing compile_commands.json
......................................................................

CMakeLists.txt: Don't fail on missing compile_commands.json

Commit

855030f3 ("cmake: create and link compile_commands.json file")

added creation of compile commands file and a symbolic link to it.

There a two issues:

- CMAKE_EXPORT_COMPILE_COMMANDS works only on Ninja and Makefile
generators and doesn't produce anything on MSVC.

- creating symlink on Windows by default requires an elevated prompt,
which is not normally the case (but it turned out is the case for GHA). Without elevated prompt this fails the build.

Fix by make symlink creation non-fatal by providing variable to store result.

Change-Id Ic19f859c3aca8b30aa51b12dcb906a6e7e735019

---
M CMakeLists.txt

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/95/495/2

CMakeLists.txt +1 -1
index bc46c27..5c6fff0 100644
@@ -45,7 +45,7 @@
 # Create machine readable compile commands
 set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
 file(CREATE_LINK ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json
-                 ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json SYMBOLIC)
+                 ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json RESULT COMPILE_COMMANDS_CREATED SYMBOLIC)
 
 # AddressSanitize - use CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYPE=asan to build with ASAN
 set(CMAKE_C_FLAGS_ASAN

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/495?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic19f859c3aca8b30aa51b12dcb906a6e7e735019
Gerrit-Change-Number: 495
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos, stipa.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/495?usp=email )

Change subject: CMakeLists.txt: Don't fail on missing compile_commands.json
......................................................................

Patch Set 2: Code-Review-1

(2 comments)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/495/comment/ff72c046_d852df10 :
PS2, Line 7: CMakeLists.txt: Don't fail on missing compile_commands.json Change to CMake: Don't fail if compile_commands.json symlink can't be created.

http://gerrit.openvpn.net/c/openvpn/+/495/comment/78f9bf15_9a748563 :
PS2, Line 15: There a two issues:
I would suggest replacing this whole section with:

<--->
Creating symlinks on Windows by default requires an elevated prompt, which is not normally the case (but it turned out is the case for GHA). Without elevated prompt this fails the build.
Fix by make symlink creation non-fatal by providing variable to store result.

Since CMAKE_EXPORT_COMPILE_COMMANDS works only on Ninja and Makefile generators and doesn't produce anything on MSVC, the symlink is useless in this case anyway.
<---->

This makes it clearer what the actual issue is, but mentions the other issue as justification.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/495?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic19f859c3aca8b30aa51b12dcb906a6e7e735019
Gerrit-Change-Number: 495
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Fri, 12 Jan 2024 14:13:10 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#6 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/495?usp=email

to look at the new patch set (#3).

The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld

Change subject: CMakeLists.txt: Don't fail on missing compile_commands.json
......................................................................

CMakeLists.txt: Don't fail on missing compile_commands.json

Creating symlinks on Windows by default requires an elevated prompt, which is not normally the case (but it turned out is the case for GHA). Without elevated prompt this fails the build. Fix by make symlink creation non-fatal by providing variable to store result.

Since CMAKE_EXPORT_COMPILE_COMMANDS works only on Ninja and Makefile generators and doesn't produce anything on MSVC, the symlink is useless in this case anyway.

Change-Id Ic19f859c3aca8b30aa51b12dcb906a6e7e735019

---
M CMakeLists.txt

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/95/495/3

CMakeLists.txt +1 -1
index bc46c27..5c6fff0 100644
@@ -45,7 +45,7 @@
 # Create machine readable compile commands
 set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
 file(CREATE_LINK ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json
-                 ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json SYMBOLIC)
+                 ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json RESULT COMPILE_COMMANDS_CREATED SYMBOLIC)
 
 # AddressSanitize - use CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYPE=asan to build with ASAN
 set(CMAKE_C_FLAGS_ASAN

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/495?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic19f859c3aca8b30aa51b12dcb906a6e7e735019
Gerrit-Change-Number: 495
Gerrit-PatchSet: 3
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset

#7 lore raw
In reply to a message not in the archive

stipa has abandoned this change. ( http://gerrit.openvpn.net/c/openvpn/+/495?usp=email )

Change subject: CMakeLists.txt: Don't fail on missing compile_commands.json
......................................................................

Abandoned

Original patch has been reworked and this workaround is not needed.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/495?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic19f859c3aca8b30aa51b12dcb906a6e7e735019
Gerrit-Change-Number: 495
Gerrit-PatchSet: 3
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: abandon