Multiple definitions of source files

Sysprogs forums Forums VisualGDB Multiple definitions of source files

Viewing 15 posts - 1 through 15 (of 31 total)
  • Author
    Posts
  • #22233
    salex
    Participant

    Hello,

    I’m evaluating the VisualGDB.

    I’m trying to build ardupilot project with VisualGDB and Visual Studio on Windows.

    Originally, the project was compiled under cygwin.

    In Visual Studio i created a new VisualGDB cygwin project, and added the Ardupilot directories recursively from the original location, with the source files.

    At the end of the compilation i get following error (for almost all files in the project) :

    1>Debug/AP_Arming.o: In function `AP_Arming::AP_Arming()':
     1>c:\Users\salex\source\repos\WindowsProject1\WindowsProject1\..\..\..\..\..\..\cygwin\home\alex\ardupilot\libraries\AP_Arming\AP_Arming.cpp(95): error : multiple definition of `AP_Arming::AP_Arming()'
     1>Debug/AP_Arming.o: /cygdrive/c/Users/salex/source/repos/WindowsProject1/WindowsProject1/../../../../../../cygwin/home/salex/ardupilot/libraries/AP_Arming/AP_Arming.cpp:95: first defined here

    The files are not appear twice in the project.

    Why i’m getting multiple definition of the same file at same location, just the first one is pointed directly, and the second relative to cygwin ?

    How can i solve it ?

    #22235
    support
    Keymaster

    Hi,

    Most likely the same source file got included in the project twice (or multiple source files with the same name got included, causing obj file conflicts). The exact steps to fix this depend on your project type, but normally searching for the file name shown in the error message in Solution Explorer should help you narrow it down (ensure that only 1 instance is included in the project).

    #22238
    salex
    Participant

    You were right.

    There are multiple files with same name are included in the project. The problem is that i need it them all. Files with same names are located in different directories and inherit one from another.

    How can i tell the compiler to build unique object for each file ? Or build object tree exactly like the source tree ?

     

    #22246
    support
    Keymaster

    Hi,

    If you are using MSBuild, you can override the object file directory for each file using the regular VS properties. Alternatively, please consider switching your project to CMake with the Advanced CMake Project Subsystem. It automatically handles such cases and also builds the projects much faster.

    #22259
    salex
    Participant

    Thank you for the support.

    I’ve managed to build the solution. I just split the project to main executable and several static libraries. Later i’ll try also to switch to CMake.

    My next problem is that the debugger (i’m pretty sure it is gdb) refuses to set breakpoint.

    I can run and execute the main program step by step with the debugger, but when i set breakpoint it goes to empty circle, saying that can’t resolve breakpoint location.

    What should i do ?

    Should i add somewhere the main program and libraries sources location ?

    Update: solved using this tutorial.

     

    • This reply was modified 6 years, 2 months ago by salex.
    • This reply was modified 6 years, 2 months ago by salex.
    #22264
    salex
    Participant

     

    According to your recommendation i’m trying to switch to CMake with Advanced Project Subsystem.

    I installed CMake on the Cygwin by means of its Setup application.

    When i create on VS New project of type MinGW/Cygwin VisualGDB with CMake, i get the error on Output window:

    Loaded C:\Users\salex\source\repos\WindowsProject1\WindowsProject5\WindowsProject5.vgdbcmake. Waiting for VS to set the active configuration…
    C:\Users\salex\source\repos\WindowsProject1\WindowsProject5\WindowsProject5.vgdbcmake: active configuration changed to Debug
    CMake Error: cmake version 3.6.2
    Usage: cmake -E <command> [arguments…]
    Available commands:
    chdir dir cmd [args…] – run command in a given directory
    compare_files file1 file2 – check if file1 is same as file2
    copy <file>… destination – copy files to destination (either file or directory)
    copy_directory <dir>… destination – copy content of <dir>… directories to ‘destination’ directory
    copy_if_different <file>… destination – copy files if it has changed
    echo [<string>…] – displays arguments as text
    echo_append [<string>…] – displays arguments as text but no new line
    env [–unset=NAME]… [NAME=VALUE]… COMMAND [ARG]…
    – run command in a modified environment
    environment – display the current environment
    make_directory <dir>… – create parent and <dir> directories
    md5sum <file>… – create MD5 checksum of files
    remove [-f] <file>… – remove the file(s), use -f to force it
    remove_directory dir – remove a directory and its contents
    rename oldname newname – rename a file or directory (on one volume)
    tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 …]
    – create or extract a tar or zip archive
    sleep <number>… – sleep for given number of seconds
    time command [args…] – run command and return elapsed time
    touch file – touch a file.
    touch_nocreate file – touch a file but do not create it.
    Available on UNIX only:
    create_symlink old new – create a symbolic link new -> old

    CMake exited with code 1
    System.Exception: Failed to create a Unix domain socket. Please install ‘socat’ on your Linux machine via ‘sudo apt-get install socat’ or ‘yum install socat’
    at fb.e_2()
    at wh1.i()
    at g42.k2(Boolean a, Boolean b)
    System.Exception: Failed to create a Unix domain socket. Please install ‘socat’ on your Linux machine via ‘sudo apt-get install socat’ or ‘yum install socat’
    at fb.e_2()
    at wh1.i()
    at g42.k2(Boolean a, Boolean b)

    What should i do ?

     

    #22265
    salex
    Participant

    I’ve updated manually the CMake to version 3.12.0.

    Now the error is:

    Loaded C:\Users\alexsho\source\repos\WindowsProject1\WindowsProject7\WindowsProject7.vgdbcmake. Waiting for VS to set the active configuration…
    C:\Users\alexsho\source\repos\WindowsProject1\WindowsProject7\WindowsProject7.vgdbcmake: active configuration changed to Debug
    CMake exited with code 127
    Failed to receive a ‘hello’ message from CMake
    System.Exception: Failed to receive a ‘hello’ message from CMake
    at wh1.m1()
    System.Exception: Failed to receive a ‘hello’ message from CMake
    at wh1.m1()

     

    #22266
    support
    Keymaster

    Hi,

    It looks like you have upgraded to CMake that does not support the server mode. Are you using the CMake that is shipped with Cygwin?

    If yes, please try building it from sources as described here: http://visualgdb.com/documentation/cmake/annotations/

    Additionally to enabling the advanced CMake mode, using our CMake fork will let you step through the CMakeLists.txt files, so you will be able to diagnose CMake-related issues faster.

    #22274
    salex
    Participant

    The CMake version that supplied by the latest Cygwin installer is 3.6.2, you can see the error that it throws in my reply #22264. As you can see, it misses some option, probably because it is outdated.

    When i trying to compile the latest CMake from sources inside Cygwin, it fails on the configure step. It probably misses some components because Cygwin is not real Linux.

    If you know about specific component that is required to run CMake properly, please let me know. I’ll try to install it with Cygwin installer.

    Did you really tested Cygwin/CMake support in VisualGDB ?

    #22275
    support
    Keymaster

    Hi,

    Yes, we have tested our CMake fork on Cygwin. We used the following steps to build it:

    1. Install the regular old CMake via the Cygwin package manager. It makes configuration easier as CMake doesn’t need to build a simplified version of itself in order to process its own CMakeLists.txt files.
    2. Attempt the regular configuration (mkdir build && cd build && cmake ..). This will report a few missing libraries that can easily be installed via the Cygwin installer. In our tests, the libraries were libncurses-devel and libuuid-devel. You may want to try out the apt-cyg tool to install Cygwin packages from command line.
    3. Run “make -j <CPU count> && make install”. That should be it. Ensure that VisualGDB uses the /usr/local/bin/cmake, not /bin/cmake and you are good to go.
    #22307
    salex
    Participant

     

    I found your CMake branch here.

    It indeed missed the libraries you’ve mentioned when i run bootstrap (configure).

    After fixing this, i pass bootstrap and make successfully, but have a crash in make install step with error:

    make: *** [Makefile:84: install] Aborted (core dumped)

    Same error when i just run cmake manually.

    Have you got this error also ?

     

    #22308
    support
    Keymaster

    Hi,

    This might be caused by corrupt Cygwin environment. Unfortunately the Cygwin binaries are not backward compatible, so installing newer versions of some libraries or tools in an environment with old cygwin1.dll (or tools built against the old cygwin1.dll) would render the entire environment unusable.

    Please try installing a clean Cygwin environment from scratch – this should get it to work.

    #22311
    salex
    Participant

    I’ve managed to build working CMake with clean Cygwin installation. I have 3.12.2  version (latest from your branch).

    Now the error i get looks different.

    When i Add new Cygwin/CMake project, it shown in Solution Explorer as Loading …. for a long time, actually until i stop it. And then i get the error:

    Unexpected JSON message: expected Reply, got
    System.Exception: Unexpected JSON message: expected Reply, got
    at wh1.c2[_InType,_OutType](_InType a)
    at g61.k(String d, String b, String c, String a)
    at g61.l_2(Hello a)
    at wh1.m1()
    System.Exception: Unexpected JSON message: expected Reply, got
    at wh1.c2[_InType,_OutType](_InType a)
    at g61.k(String d, String b, String c, String a)
    at g61.l_2(Hello a)
    at wh1.m1()

     

    #22319
    support
    Keymaster

    Hi,

    Thanks for the update. We have managed to reproduce the problem. It looks like the Unix domain socket support is broken in the latest Cygwin.

    We should be able to work around it by switching the Cygwin CMake to use regular TCP/IP sockets instead. Please allow 5-10 business days for us to fix it.

    #22326
    salex
    Participant

    Ok,

    Please update me here when the new version is available.

     

Viewing 15 posts - 1 through 15 (of 31 total)
  • You must be logged in to reply to this topic.