Conan Paket strange error

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
StefanSchmelz
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Feb 26, 2020 2:13 pm

Conan Paket strange error

Post by StefanSchmelz »

Hi together, I'm pretty new to wxWidgets, but I already have a pretty niche problem:
My boss wants me to use the conan package manager or git submodules for our dependencies.
We work with c++11, wxWidgets 3.1.3 and gcc7 under linux.

I started by extending the official hello world program and it worked with a local install of wxWidgets. afterwards my boss complained that he does not want to install anything and I changed from local install to building as a git submodule and this extended build times outside of our comfortable range. I got this to work with relatively little trouble. Then we discovered conan as a dependency manager and I changed from git submodules to conan.
After this change is once got it to work and afterwards i got strange errors like: "free(): invalid size" oder "double free or corruption (out)".

I think that these happen in the constructor of the inherited wxApp class that i did not overwrite, because none of my debug outputs gets printed.
Did somebody know the symtoms or has worked with th conan package o wxWidgets before?
Here is the github link to our repo: https://github.com/dasys-lab/clingo-debug-gui
I am a native german speaker and I will formulate the same question in german too just for reference.
Thanks in advance :-D


Hi zusammen, ich hab noch nicht viel erfahrung mit wxWidgets, aber schon ein Problem mit Spezialfall:
Ich benutze den conan package manager um wxWidgets in mein Projekt zu integrieren. Bitte stellt Conan nicht in Frage, das ist ne Vorgabe von meinem Chef. alternativ könnte ich noch git submodule benutzen.
Wir arbeiten mit c++11 und wxwidgets 3.1.3 im moment unter linux mit gcc 7.

Ich hatte eine kleine App zum anfangen geschrieben, die funktionierte. Im Prinzip ein erweitertes Hallo Welt Programm. Mit einem Lokal installierten wxWidgets funktionierte das Programm und auch mit einem git submodule hab ich es dazu bekommen ungefähr das zu tun was ich erwarte.
Dann hab ich umgestellt auf conan und habe seltsame Fehler bekommen:
"free(): invalid size" oder "double free or corruption (out)".
Die Fehler treten wahrscheinlich schon im Konstruktor von wxApp auf, da keine meiner Debugausgaben ausgegeben wird.
Hat jemand schon Erfahrungen damit gemacht oder kennt zumindest die Symthome?
Hier noch der github link zu unserem repo: https://github.com/dasys-lab/clingo-debug-gui
Schon mal danke im Voraus :-D
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Conan Paket strange error

Post by ONEEYEMAN »

Hi,
First of all - there is no conan dependency for wxWidgets. It probably comes from some other software that you guys use.
Second - you said that everything was working fine when you didn't use conan and now you have issues. Doesn't this mean you shuold blame conan for the issue?

Thank you.
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 550
Joined: Fri Nov 03, 2006 2:00 pm

Re: Conan Paket strange error

Post by stahta01 »

You do realize that your git repo has no source code in it, right?

Tim S.
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 550
Joined: Fri Nov 03, 2006 2:00 pm

Re: Conan Paket strange error

Post by stahta01 »

And, your "conanfile.py" is using wxWidgets version 3.1.2?

Tim S.
StefanSchmelz
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Feb 26, 2020 2:13 pm

Re: Conan Paket strange error

Post by StefanSchmelz »

Sry, I forgot to push the changes I had made ](*,)
I changed the version of wxWidgets to 3.1.1 but the error still exists.

I know that conan is not a dependency of wxWidgets, but since conan works in many other projects I would think that this might be a problem with wxWidgets.
I used conan in a few other projects and never got problems. conan by itself has nothing to do with the code, it is only a piece of software written in Python that provides a package manager for c++ like pip is for python.
And before it was not really working fine - we managed to fail about 10 times to install the library at all.

I love coding with wxWidgets, but I really hate installing it.

Nevertheless I was also getting a verry similar error before we switched.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Conan Paket strange error

Post by ONEEYEMAN »

Hi,
StefanSchmelz wrote: Wed Feb 26, 2020 9:08 pm Sry, I forgot to push the changes I had made ](*,)
I changed the version of wxWidgets to 3.1.1 but the error still exists.

I know that conan is not a dependency of wxWidgets, but since conan works in many other projects I would think that this might be a problem with wxWidgets.
I used conan in a few other projects and never got problems. conan by itself has nothing to do with the code, it is only a piece of software written in Python that provides a package manager for c++ like pip is for python.
And before it was not really working fine - we managed to fail about 10 times to install the library at all.

I love coding with wxWidgets, but I really hate installing it.
Then just don't install it. Or at least do it the "standard *nix way" with "make install".
Now, you do realize that all you need to do is to get wxWidgets as a submodule in your project tree and modify the Makefile's in order to build wx first.
Keep in mind that this is how wxWidgets is doing its business with all 3rd party software right now - all those libraries are added as a "modules in wxWidgets GitHub repo and when someone clones it they will become available from the cloning submodues.

Thank you.
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 550
Joined: Fri Nov 03, 2006 2:00 pm

Re: Conan Paket strange error

Post by stahta01 »

I can not get conan to work under MSys2 (Windows 7 64 bit).
So, I am going to give up trying to help in this thread.

Edit: It appeared to be downloading a lot of stuff and I have a slow Internet connection. So, I gave up.

Tim S.
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 550
Joined: Fri Nov 03, 2006 2:00 pm

Re: Conan Paket strange error

Post by stahta01 »

NOTE: The patch below was *not* needed.

Figured out a patch that got the build to go farther. No idea if this will help you or not.
Code written by others on cmake/conan websites. Note: I changed to using CONAN_IN_LOCAL_CACHE because of a issue I read about. I also change the download URL.

MSys2 now complains about a clash between "Expat" and "expat" and it requires a case sensitive file system.

Tim S.

Code: Select all

From 31603d258175c8421ce785a24c5765bc97bd65d6 Mon Sep 17 00:00:00 2001
From: Tim Stahlhut <[email protected]>
Date: Wed, 26 Feb 2020 21:09:42 -0500
Subject: Add use of CONAN_IN_LOCAL_CACHE

---
 CMakeLists.txt | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 848b260..ee96cdf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,11 +31,25 @@ project(ClingoDebugGui                                              # This direc
 
 set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})   # This directive adds the cmake directory of
                                                                             # this project to the cmake search path.
+# Download automatically, you can also just copy the conan.cmake file
+if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
+   message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
+   file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/develop/conan.cmake"
+                 "${CMAKE_BINARY_DIR}/conan.cmake")
+endif()
 
 ## Conan setup ##
-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
-conan_basic_setup(TARGETS)
-
+if(CONAN_IN_LOCAL_CACHE) # in conan local cache
+    # standard conan installation, deps will be defined in conanfile.py
+    # and not necessary to call conan again, conan is already running
+    include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
+    conan_basic_setup()
+else() # in user space
+    include("${CMAKE_BINARY_DIR}/conan.cmake")
+    # Make sure to use conanfile.py to define dependencies, to stay consistent
+    conan_cmake_run(CONANFILE conanfile.py
+                    BASIC_SETUP)
+endif()
 
 add_executable(${CMAKE_PROJECT_NAME}
     src/appmain.cpp
@@ -47,4 +61,4 @@ target_include_directories(${CMAKE_PROJECT_NAME}
 )
 target_link_libraries(${CMAKE_PROJECT_NAME}
     CONAN_PKG::wxwidgets
-)
\ No newline at end of file
+)
-- 
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 550
Joined: Fri Nov 03, 2006 2:00 pm

Re: Conan Paket strange error

Post by stahta01 »

I had to enable case sensitive under Windows 7 to get past the "expat" library case issue.

How to enable case sensitive under Windows 7; reboot is required after change.
From https://cygwin.com/cygwin-ug-net/using- ... names.html
If you really want case-sensitivity in Cygwin, you can switch it on by setting the registry value
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\obcaseinsensitive
to 0 and reboot the machine.
I also changed the "posix=0" in /etc/fstab to "posix=1"

Software needed to be installed

Code: Select all

pacman -S --needed ${MINGW_PACKAGE_PREFIX}-gcc        && \
pacman -S --needed ${MINGW_PACKAGE_PREFIX}-make       && \
pacman -S --needed ${MINGW_PACKAGE_PREFIX}-cmake      && \
pacman -S --needed ${MINGW_PACKAGE_PREFIX}-python-pip && \
pip install conan


Command to build package

Code: Select all

cd clingo-debug-gui && \
conan install . --build missing && \
cmake -G'MSYS Makefiles' -DCONAN_COMPILER=gcc -DCONAN_COMPILER_VERSION=9.2 \
    -DCMAKE_MAKE_PROGRAM=mingw32-make.exe -DCMAKE_BUILD_TYPE=Release . && \
mingw32-make.exe
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 550
Joined: Fri Nov 03, 2006 2:00 pm

Re: Conan Paket strange error

Post by stahta01 »

Have you tried using a single file version of helloworld as from https://docs.wxwidgets.org/trunk/overvi ... world.html
to see if it also has the problem?

If yes, could you see if the samples/minimal/minimal.cpp has the problem.

I now know enough about conan to try to see if I can duplicate the error when I get time.

Tim S.
StefanSchmelz
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Feb 26, 2020 2:13 pm

Re: Conan Paket strange error

Post by StefanSchmelz »

Hi there,
stahta01 wrote: Fri Feb 28, 2020 12:52 am Have you tried using a single file version of helloworld as from https://docs.wxwidgets.org/trunk/overvi ... world.html
to see if it also has the problem?

If yes, could you see if the samples/minimal/minimal.cpp has the problem.

I now know enough about conan to try to see if I can duplicate the error when I get time.

Tim S.
I tried the single file example and i get the same sort of problem but a different error this time:
munmap_chunk(): invalid pointer

Thanks for your help :)
I will try to run the minimal sample now. with the minimal sample I still get free(): invalid size.


I'm starting to get sick of this problem and am tempted to simply revert to git submodules without telling my boss...
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 550
Joined: Fri Nov 03, 2006 2:00 pm

Re: Conan Paket strange error

Post by stahta01 »

Yeah, I understand. With drmemory on Windows 7 I get more detected problems when building using conan.
But, using the normal MSys2 wxWidgets package drmemory is working only with static built wxWidgets.

NOTE: I just realized that conan is using cmake to build wxWidgets app; did you use cmake before you went to conan?
It is possible, building with cmake is causing the leak and other detected problems.

Tim S.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Conan Paket strange error

Post by ONEEYEMAN »

Hi,
A software development paradigm: "don't touch anything, don't change anything, as long as it works" ;-)

Thank you.
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 550
Joined: Fri Nov 03, 2006 2:00 pm

Re: Conan Paket strange error

Post by stahta01 »

In addition to possible cmake change, did you which between static and shared wxWidgets libraries?

Tim S.
StefanSchmelz
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Feb 26, 2020 2:13 pm

Re: Conan Paket strange error

Post by StefanSchmelz »

stahta01 wrote: Tue Mar 03, 2020 3:22 pm Yeah, I understand. With drmemory on Windows 7 I get more detected problems when building using conan.
But, using the normal MSys2 wxWidgets package drmemory is working only with static built wxWidgets.

NOTE: I just realized that conan is using cmake to build wxWidgets app; did you use cmake before you went to conan?
It is possible, building with cmake is causing the leak and other detected problems.

Tim S.
I used cmake throughout the project.
ONEEYEMAN wrote: Tue Mar 03, 2020 3:23 pm Hi,
A software development paradigm: "don't touch anything, don't change anything, as long as it works" ;-)

Thank you.
This time it was not my desicion.
stahta01 wrote: Tue Mar 03, 2020 3:44 pm In addition to possible cmake change, did you which between static and shared wxWidgets libraries?

Tim S.
I did not try, but I could try it now.
Post Reply