User forums > Help

Installing Code::Blocks from source on Linux

<< < (4/7) > >>

christo:

--- Quote from: Krice on March 16, 2025, 09:43:43 am ---In some unrelated projects people have solved this by creating a symlink to libtiff which in this case is libtiff.so.6.0.2 (other files are symlinks themselves) so I did that in my usr/lib64, but now it's just giving an error already in the compile phase, in astyle.h:


--- Code: ---In file included from asstreamiterator.h:15,
                 from asstreamiterator.cpp:10:
/usr/include/astyle.h:295:44: error: 'std::string_view' has not been declared
  295 |         const std::string* findHeader(std::string_view line, int i,
      |                                            ^~~~~~~~~~~

--- End code ---

This seems to indicate that something doesn't include std::string header, right?

Edit: also, there could be some kind of confusion in including astyle.h in asstreamiterator.h. If you use angle brackets it's trying to find the file in usr/library while there is also plugins/astyle/astyle directory where you can find another astyle.h which is not included unless you write #include "astyle/astyle.h", well I guess depending how this project is handling that kind of stuff, could be something else happening.

--- End quote ---

This is because if astyle is installed in the PC,  codeblocks uses it instead of that in sdk. Astyle installed in your PC is new and uses c++17 features, but codeblocks still uses c++11 flags. That is why compilation fails.

You can try following patch


--- Code: ---diff --git a/configure.ac b/configure.ac
index 1d4898a28..b8ed0b7cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -361,7 +361,7 @@ CPPFLAGS="$CPPFLAGS -DPIC $CB_TINYXML_CFLAGS"
 CXXFLAGS="$CXXFLAGS $PIC_CFLAGS -fexceptions"
 AC_SUBST(codeblocks_PCH_FLAGS, "$PCH_FLAGS")
 
-AX_CXX_COMPILE_STDCXX(11, noext)
+AX_CXX_COMPILE_STDCXX(17, noext)
 
 dnl AM_PATH_GTK(1.2.7, ,
 dnl             AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?),

--- End code ---

stahta01:
If I remember correctly, "AX_CXX_COMPILE_STDCXX(17, noext)" will result in wxSmith not building.

Tim S.

Krice:
Fixed astyle by searching which files were including astyle.h with angle brackets, there are three headers in astyle directory: asstreamiterator.h, dlgformattersettings.h and formattersettings.h. Changed those to "astyle/astyle.h" which seemed like what they should be in the first place, because now they are using the astyle that is in the plugin directory.

I still got wx errors after that so I thought why not compile wx from the source, because it seems to want to use the usr/local version anyway. Wx compiled without errors which means I must have compiled it earlier. Then sudo make install and that was it. Code::Blocks compiled after that.

I don't know if this is supposed to happen, but the new Code::Blocks overwrites the one installed from Fedora Software, because when you click the icon it runs the new version.

Miguel Gimenez:
Angle brackets changed to double quotes in r13635, thank you for reporting.

christo:
@Miguel Gimenez I think above patch can cause compiling against astyle headers provided in codeblocks,  and link to astyle libraries present in the system. This might cause issues because of ABI incompatibility.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version