Mavsdk: Error building mavsdk_server (LNK1149)

Created on 24 Jul 2019  路  7Comments  路  Source: mavlink/MAVSDK

Got problem trying to compile mavsdk with BUILD_BACKEND = ON option. I am using VS 2017 Build Tools on Windows 10 Enterprise. I am getting the error below. Any help would be appriciated.

[build] "D:\Work\MAVSDK\build\ALL_BUILD.vcxproj" (default target) (1) ->
[build] "D:\Work\MAVSDK\build\src\backend\src\mavsdk_server_bin.vcxproj" (default target) (32) ->
[build] (Link target) ->
[build] LINK : fatal error LNK1149: output filename matches input filename 'D:\Work\MAVSDK\build\src\backend\src\Debug\mavsdk_server.lib' [D:\Work\MAVSDK\build\src\backend\src\mavsdk_server_bin.vcxproj]
[build]
[build] 0 Warning(s)
[build] 1 Error(s)

Most helpful comment

I'm completely speculating, but seeing mavsdk_server.lib and mavsdk_server_bin in the error output make me think it could be related to the way we name our binaries.

Indeed, we have two targets ending up being called mavsdk_server:

  • The target mavsdk_server becomes a shared library (mavsdk_server.so on Linux, I presume mavsdk_server.lib on Windows)
  • The target mavsdk_server_bin becomes an executable: mavsdk_server. By default it should be mavsdk_server_bin, but we rename it with this property.

That's obviously working in our CI, but for Windows we build with MinGW and not with Visual Studio, so maybe that's failing there.

Could you try to comment out these lines and build again?

Thanks a lot. It has worked. mavsdk_server_bin.exe is generated under debug folder.

All 7 comments

I'm completely speculating, but seeing mavsdk_server.lib and mavsdk_server_bin in the error output make me think it could be related to the way we name our binaries.

Indeed, we have two targets ending up being called mavsdk_server:

  • The target mavsdk_server becomes a shared library (mavsdk_server.so on Linux, I presume mavsdk_server.lib on Windows)
  • The target mavsdk_server_bin becomes an executable: mavsdk_server. By default it should be mavsdk_server_bin, but we rename it with this property.

That's obviously working in our CI, but for Windows we build with MinGW and not with Visual Studio, so maybe that's failing there.

Could you try to comment out these lines and build again?

The target mavsdk_server_bin becomes an executable: mavsdk_server. By default it should be mavsdk_server_bin, but we rename it with this property.

Oh I missed this! What should we rename? :smile:

I'm completely speculating, but seeing mavsdk_server.lib and mavsdk_server_bin in the error output make me think it could be related to the way we name our binaries.

Indeed, we have two targets ending up being called mavsdk_server:

  • The target mavsdk_server becomes a shared library (mavsdk_server.so on Linux, I presume mavsdk_server.lib on Windows)
  • The target mavsdk_server_bin becomes an executable: mavsdk_server. By default it should be mavsdk_server_bin, but we rename it with this property.

That's obviously working in our CI, but for Windows we build with MinGW and not with Visual Studio, so maybe that's failing there.

Could you try to comment out these lines and build again?

Thanks a lot. It has worked. mavsdk_server_bin.exe is generated under debug folder.

@uccsoft thanks for trying that out.

@JonasVautherin I vote we rename the library to mavsdk_server_lib. I know that will create the ugly file libmavsdk_server_lib.lib/so but that's better than renaming the bin, right?

@JonasVautherin I vote we rename the library to mavsdk_server_lib. I know that will create the ugly file libmavsdk_server_lib.lib/so but that's better than renaming the bin, right?

I would first try to see if there is a way to make that work for Visual Studio (it works everywhere else). If there isn't, then I think I would rather rename the executable only for Visual Studio. So that everybody has mavsdk_server, and people building with Visual Studio have mavdsk_server_bin.exe.

If you rename the library, it has consequences on the CMakeLists linking it. Whereas the executable is an "end product" :sweat_smile:.

@JonasVautherin alright, convinced. I vote we change it unless someone knows how to avoid the problem in VS Studio but I doubt it.

Fair enough.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hamishwillee picture hamishwillee  路  5Comments

shakthi-prashanth-m picture shakthi-prashanth-m  路  7Comments

hamishwillee picture hamishwillee  路  6Comments

mrpollo picture mrpollo  路  5Comments

julianoes picture julianoes  路  6Comments