I'm following this guide but when I try to build the c++ library I get the following fatal error.
../../../../gcc-11.1.0/libsanitizer/asan/asan_linux.cpp: In function ‘void __asan::AsanCheckIncompatibleRT()’:
../../../../gcc-11.1.0/libsanitizer/asan/asan_linux.cpp:199:21: error: ‘PATH_MAX’ was not declared in this scope
199 | char filename[PATH_MAX];
| ^~~~~~~~
../../../../gcc-11.1.0/libsanitizer/asan/asan_linux.cpp:200:35: error: ‘filename’ was not declared in this scope; did you mean ‘rename’?
200 | MemoryMappedSegment segment(filename, sizeof(filename));
| ^~~~~~~~
|
This appears to be a bug in libsanitizer/asan/asan_linux.cpp. It seems to find the wrong limits.h file.
I was able to work around it by modifying asan_linux.cpp as follows.
-#include <limits.h>
+#include <linux/limits.h>
Related
i'm trying to compile a Linux image with sysroot and cross-compiler by buildroot for ATSAMA5D27-WLSOM1 evaluation kit by Microchip.
I'm on a virtual machine (VBox) with Ubuntu 18.04.5 LTS.
I'm following this guide: https://microchip.wikidot.com/32mpu:egt-prepare#prepHost
I arrived at point 6, but there are some errors in compilation, the one I can't solve is the following one:
In file included from /home/ubuntu4sam/buildroot/output/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.3.0/include-fixed/pthread.h:42,
from work_thread.c:13:
work_thread.c:45:58: error: missing binary operator before token "("
45 | #if defined (PTHREAD_STACK_MIN) && THREAD_MINSTACKSIZE < PTHREAD_STACK_MIN
| ^~~~~~~~~~~~~~~~~
I tried to comment the second condition (THREAD_MINSTACKSIZE < PTHREAD_STACK_MIN) and the error becomes:
work_thread.c:45:58: error: missing binary operator before token "("
45 | #if defined (PTHREAD_STACK_MIN)
so the problem must be PTHREAD_STACK_MIN. I hope someone else has worked on Microchip boards.
Thanks for reading.
I get the following error when compiling omnetpp-5.4.1, do I need to uninstall the libgles2-mesa-dev package ?
In file included from /usr/include/GL/gl.h:2055:
/usr/include/GL/glext.h:469:19: error: typedef redefinition with different types
('ptrdiff_t' (aka 'int') vs 'khronos_intptr_t' (aka 'long'))
typedef ptrdiff_t GLintptr;
^
/usr/include/GLES3/gl31.h:74:26: note: previous definition is here
typedef khronos_intptr_t GLintptr;
^
In file included from osgviewer.cc:27:
In file included from /usr/include/arm-linux-gnueabihf/qt5/QtGui/QOpenGLFunctions:1:
/usr/include/arm-linux-gnueabihf/qt5/QtGui/qopenglfunctions.h:60:16: error:
cannot combine with previous 'double' declaration specifier
typedef double GLdouble;
^
/usr/include/osg/GL:129:38: note: expanded from macro 'GLdouble'
#define GLdouble double
^
3 errors generated.
This seems to be an issue with the system headers. If you do not need OpenSceneGraph/osgEarth support, you can turn it off in the configure.user file and the re-configure/rebuild omnet. That will exclude the OSG specific files from the build process. (if you do not need the graphical environment (Qtenv) you can even turn off that in the configure.user which will prevent also linking with Qt libs).
std::map<std::string, std::ofstream> Map;
std::string name="name";
std::ofstream ofs(name,std::ios::app);
Map[name] = std::move(ofs);
I run the code above but it failed.
I compiled it by g++ 4.9 on Ubuntu12.04 and g++-5 (gcc version 5.4.1 20160904 (Ubuntu 5.4.1-2ubuntu1~12.04) ) using -std=c++11, which induces the same error message below.
error: use of deleted function ‘std::basic_ofstream&
std::basic_ofstream::operator=(const
std::basic_ofstream&)’ Map[name] = std::move(ofs);
/usr/include/c++/4.9/fstream:602:11: note: ‘std::basic_ofstream&
std::basic_ofstream::operator=(const
std::basic_ofstream&)’ is implicitly deleted because the default
definition would be ill-formed:
class basic_ofstream : public basic_ostream<_CharT,_Traits>
Support for moving iostreams was added to GCC 5.1, so you can't do it with GCC 4.9. This is documented in the libstdc++ manual for version 4.9: https://gcc.gnu.org/onlinedocs/gcc-4.9.4/libstdc++/manual/manual/status.html#status.iso.2011
27.5 | Iostreams base classes | Partial | Missing move and swap operations on basic_ios. Missing io_errc and iostream_category. ios_base::failure is not derived from system_error. Missing ios_base::hexfloat.
27.6 | Stream buffers | Y |
27.7 | Formatting and manipulators | Partial | Missing move and swap operations Missing get_time and put_time manipulators.
27.8 | String-based streams | Partial | Missing move and swap operations
27.9 | File-based streams | Partial | Missing move and swap operations
It is supported in GCC 5.x and works fine, so you must be doing something wrong (probably forgetting to use -std=c++11, or pointing it to the 4.9 headers which definitely won't work).
I am trying to use LEDA-6.3 library in Omnet++ 4.2.2. I installed LEDA and ran a simple program using it without problem from Ubuntu terminal. However, when I port the code to Omnet++, it fails. Below is my simple code.
#include <LEDA/graph/graph.h>
#include <omnetpp.h>
class cLeda : public cSimpleModule
{
protected:
virtual void initialize();
};
Define_Module(cLeda);
void cLeda::initialize()
{
EV << "TestLEDA";
graph g;
g.read("nsfnet.txt");
EV << "No. nodes = " <<g.number_of_nodes() << endl;
}
I configured for LEDA paths for compiler and linker as follows: Project -> Properties --> Choose C/C++ General -> Path and Symbols and added:
For Library Paths: /home/grsst/LEDA-6.3/incl
For Libraries: /home/grsst/LEDA-6.3/libleda.a (I didn't add libleda.o
since it doesn't work even with Ubuntu command line)
For Library Paths: /home/grsst/LEDA-6.3
When I compile, the I got errors as follows:
Description Resource Path Location Type
make: *** [all] Error 2 TestLeda C/C++ Problem
make[1]: *** [../out/gcc-debug/src/TestLeda] Error 1 TestLeda C/C++ Problem
undefined reference to `leda::graph::~graph()' cLeda.cc /TestLeda/src line 26 C/C++ Problem
undefined reference to `leda::graph::graph()' cLeda.cc /TestLeda/src line 24 C/C++ Problem
undefined reference to `leda::graph::read(leda::string)' cLeda.cc /TestLeda/src line 25 C/C++ Problem
undefined reference to `leda::memory_manager_init::~memory_manager_init()' TestLeda line 145, external location: /home/grsst/LEDA-6.3/incl/LEDA/system/memory_std.h C/C++ Problem
undefined reference to `leda::memory_manager_init::memory_manager_init()' TestLeda line 145, external location: /home/grsst/LEDA-6.3/incl/LEDA/system/memory_std.h C/C++ Problem
undefined reference to `leda::memory_manager::deallocate_bytes(void*, unsigned int)' TestLeda line 52, external location: /home/grsst/LEDA-6.3/incl/LEDA/internal/handle_types.h C/C++ Problem
undefined reference to `leda::std_memory_mgr' TestLeda line 52, external location: /home/grsst/LEDA-6.3/incl/LEDA/internal/handle_types.h C/C++ Problem
undefined reference to `leda::string::string(char const*)' cLeda.cc /TestLeda/src line 25 C/C++ Problem
I appreciate any idea to help me to make it work. Thanks a million.
OMNeT++ project usually uses Makefile. Try to add LEDA libraries as a Makefrag.
Go to Project Properties, choose OMNeT++ | Makemake | select src | Options | Custom | Makefrag and write:
INCLUDE_PATH += -I/home/grsst/LEDA-6.3/incl
LIBS += -L/home/grsst/LEDA-6.3 -lleda
I have a piece of code that uses boost's unordered_set
#include <boost/unordered_set.hpp>
boost::unordered_set<string> mySet(100);
It compiles and works fine with gcc under unix. When I try cross compiling with mingw32 (gmake 3.8.1) I get the following message:
In file included
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/functional/hash/detail/hash_float.hpp:17,
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/functional/hash/hash.hpp:15,
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/functional/hash.hpp:6,
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/unordered/unordered_set.hpp:17,
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/unordered_set.hpp:16,
from /mnt/VirtualBoxShare/percolator/src/ProteinProbEstimatorHelper.h:33,
from /mnt/VirtualBoxShare/percolator/src/ProteinProbEstimator.cpp:28:
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:105: error: expected unqualified-id before 'unsigned'
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:105: error: expected ';' before 'unsigned'
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:105: error: declaration does not declare anything
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:114: error: expected unqualified-id before 'unsigned'
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:114: error: expected ';' before 'unsigned'
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:114: error: declaration does not declare anything
To me it seems like a template related problem; any suggestions?
Thank you,
Mattia
[EDIT]
other boost functionalities are available, for example the lexical cast
#include <boost/lexical_cast.hpp>
It seems that some typedef breaks the boost cstdint header, which looks like
103 using ::int8_t;
104 using ::int_least8_t;
105 using ::int_fast8_t;
106 using ::uint8_t;
107 using ::uint_least8_t;
108 using ::uint_fast8_t;
on my system. So, some hero probably defined "#define uint8_t" instead of "typedef ... uint8_t", and this code consequently breaks.
You might try to to modify your boost/config/platform/win32.hpp and, if that helps, report the bug to the mingw developers.