Bug in the Veins-5.2 Version? - veins

I have downloaded a veins 5.2 from here. When trying to run veins_inet example available in the subprojects folder, I receive an error saying ./veins_inet/veins_inet.h:37:2: error: #error Veins version 5.1 or compatible required
"Compatible" is defined as
#if !(VEINS_VERSION_MAJOR == 5 && VEINS_VERSION_MINOR >= 1)
#error Veins version 5.1 or compatible required
#endif
But if I go to the veins-veins-5.2 folder and run ./print-veins-version, indeed 5.0 gets returned.
Is this a bug? And is it safe just to comment the above codeblock out, so I can run the simulation.

No, Veins 5.2 uses #define VEINS_VERSION_MINOR 2 (see https://github.com/sommer/veins/blob/veins-5.2/src/veins/veins.h#L36). Maybe you downloaded and old and a new version and got confused as to which one you are using.

Related

Cross compiling libtorrent for raspberry pi 3 model B

I've been trying to cross compile jlibtorrent for the raspberry pi which uses boost build for compiling. I am using the officially provided cross compiler with the following config.jam:
import os ;
using gcc : arm : arm-linux-gnueabihf-g++ :
<cxxflags>-fPIC
<cxxflags>-std=c++14
<cxxflags>-fno-strict-aliasing
<cxxflags>-fvisibility=hidden
<linkflags>-m32
<linkflags>-static-libstdc++
<linkflags>-static-libgcc
<linkflags>"-z noexecstack"
# debug information
<cxxflags>-g
<cxxflags>-gdwarf-4
<cxxflags>-ggdb
;
I basically copied the existing configuration for linux-x86 and replaced the compiler, but I'm getting the following compilation error:
libtorrent/src/entry.cpp: In member function 'libtorrent::entry& libtorrent::entry::operator[](libtorrent::string_view)':
libtorrent/src/entry.cpp:86:33: error: no matching function for call to
'std::map<std::basic_string<char>, libtorrent::entry, libtorrent::aux::strview_less, std::allocator<std::pair<const std::basic_string<char>, libtorrent::entry> > >::find(libtorrent::string_view&)'
auto const i = dict().find(key);
My only guess is that the version of the cross compiler (4.9.3) is not compatible with libtorrent, because I saw in the linux-32-config.jam that it uses g++-5. Is there anything else I am missing?
You can find the modified repository in my github repositories. I am using swig/build-linux-armv7.sh for building.
that call (std::map::find()) was added in C++14 (see docs). I see you pass in -std=c++14 on the command line as well. Are you sure your GCC supports C++14? It seems a bit old for that.
The current stable branch of libtorrent only requires C++11 support, if that is the branch you're building, there may be something wrong with the compiler support detection here. If you are building from libtorrent master, it requires proper C++14 support. So in that case you may want to use the stable release.
Thanks to #Arvid I managed to compile it using the current stable branch for libtorrent (RC_1_2) and the following jam file, which you can find here.
import os ;
using gcc : arm : arm-linux-gnueabihf-g++ :
<cxxflags>-fPIC
<cxxflags>-std=c++11
<cxxflags>-fno-strict-aliasing
<cxxflags>-fvisibility=hidden
<linkflags>-static-libstdc++
<linkflags>-static-libgcc
<linkflags>"-z noexecstack"
# debug information
<cxxflags>-g
<cxxflags>-gdwarf-4
<cxxflags>-ggdb;

SwiftUI app crash on run in macOS environment [duplicate]

I build an app with the 2nd beta of Xcode 11, using SwiftUI, and everything worked completely fine, but now, with the 3rd beta, the app isn't even build. I get errors like "Use of undeclared type 'View'", "Unknown attribute 'State'" etc. What can I do? Is the problem in my code or is it just a bug?
The problem is when I'm trying to build the app to run on my Mac (with UIKit for Mac)
#State var score = 0
The error is "Unknown attribute 'State'"
struct ContentView : View {
/*...*/
}
The error is "Use of undeclared type 'View'"
Got same issue on Xcode 11.2. Found out that the reason was that somewhere in same module I declared protocol State {}. This breaks compiler without any reasonable errors.
This is from the Xcode 11 Beta 3 Release Notes.
Known Issues
Xcode 11 doesn’t support working with SwiftUI in an iPad app brought to macOS. (41416222, 51201699)
I downloaded the Xcode 11 Beta 3 myself just to confirm the errors you mentioned, and I had the same issues when trying to build a SwiftUI project for Mac.
I would suggest going back to using Xcode Beta 2 if possible. Unfortunately, Apple doesn't provide download links to previous betas, so hopefully you have a Time Machine backup or Beta 2 still installed on your computer. Otherwise, you might be out of luck until the next beta is released.
I was getting the same "Unknown attribute 'State'" issue in Beta 5. But I was doing "#state" and not "#State". Case matters. It's hard to notice because both ways are shown as purple.
If you are doing a Kotlin multi-platform project, check if your shared module has a component named "State".
Instead #main, please replace #UIApplicationMain.
I've attached screenshots.
https://prnt.sc/vimvwn
I got the same error while trying to compile a Swift project created with Xcode 13 on Xcode 11. The problem was that the newer version uses the SDK 12.1 while the older one uses the SDK 10.15. To let the project compile on the older Xcode/SDK I just performed these steps:
remove the #main attribute from the swift source code
add Cocoa.framework in the section Frameworks, Libraries, and Embedded Content
add a file named main.m to the project (no bridge header) with this content:
#include <Cocoa/Cocoa.h>
int main(int argc, const char * argv[]) {
return NSApplicationMain(argc, argv);
}

Building mariadb client with Android NDK

Yet another linux build newb here, struggling to build mariadb-client for Android using the NDK.
I have already succesfully built openssl and libiconv, which are perquisites.
Here is what I am doing:
export ANDROID_NDK_ROOT="/home/dev/android-ndk-r12b"
SR="$ANDROID_NDK_ROOT/platforms/android-16/arch-arm"
BR="$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-"
mkdir build && cd build
PKG_CONFIG_PATH=$SR/usr/lib/pkgconfig cmake -DCMAKE_AR="$BR"ar -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$BR"gcc -DCMAKE_C_FLAGS=--sysroot=$SR -DCMAKE_INSTALL_PREFIX=$SR/usr -DCMAKE_LINKER="$BR"ld -DCMAKE_NM="$BR"nm -DCMAKE_OBJCOPY="$BR"objcopy -DCMAKE_OBJDUMP="$BR"objdump -DCMAKE_RANLIB="$BR"ranlib -DCMAKE_STRIP="$BR"strip -DWITH_EXTERNAL_ZLIB=ON -DICONV_INCLUDE_DIR=$SR/usr/include -DICONV_LIBRARIES=$SR/usr/lib/libiconv.a -DZLIB_INCLUDE_DIR=$SR/usr/include -DZLIB_LIBRARY=$SR/usr/lib/libz.so ../
make install
To break down that last part so it is more readable:
PKG_CONFIG_PATH=$SR/usr/lib/pkgconfig
cmake
-DCMAKE_AR="$BR"ar
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_COMPILER="$BR"gcc
-DCMAKE_C_FLAGS=--sysroot=$SR
-DCMAKE_INSTALL_PREFIX=$SR/usr
-DCMAKE_LINKER="$BR"ld
-DCMAKE_NM="$BR"nm
-DCMAKE_OBJCOPY="$BR"objcopy
-DCMAKE_OBJDUMP="$BR"objdump
-DCMAKE_RANLIB="$BR"ranlib
-DCMAKE_STRIP="$BR"strip
-DWITH_EXTERNAL_ZLIB=ON
-DICONV_INCLUDE_DIR=$SR/usr/include
-DICONV_LIBRARIES=$SR/usr/lib/libiconv.a
-DZLIB_INCLUDE_DIR=$SR/usr/include
-DZLIB_LIBRARY=$SR/usr/lib/libz.so
The first error I got was that program_invocation_short_name was undefined in this bit of code:
#elif defined(_GNU_SOURCE)
const char * appname = program_invocation_short_name;
#elif defined(WIN32)
I couldn't find why this is and how to fix, so I decided to cheat my way through by assigning an empty string to it. Possibly with negative repercussions, but I noticed the source doing the same thing a few lines down so I decided to give it a go nonetheless.
Another build attempt, and now I am getting undefined references for iconv functions:
CMakeFiles/mariadb_obj.dir/ma_charset.c.o:ma_charset.c:function mariadb_convert_string: error: undefined reference to 'iconv_open'
CMakeFiles/mariadb_obj.dir/ma_charset.c.o:ma_charset.c:function mariadb_convert_string: error: undefined reference to 'iconv'
CMakeFiles/mariadb_obj.dir/ma_charset.c.o:ma_charset.c:function mariadb_convert_string: error: undefined reference to 'iconv_close'
CMakeFiles/mariadb_obj.dir/ma_context.c.o:ma_context.c:function my_context_spawn_internal: error: undefined reference to 'setcontext'
CMakeFiles/mariadb_obj.dir/ma_context.c.o:ma_context.c:function my_context_continue: error: undefined reference to 'swapcontext'
The libraries are definitely there, as defined in the configuration above. Maybe that's a side effect of the above cheat?
Or maybe something else entirely is going wrong?
Once again, a complete newb in this regard, but I get a newb hunch that it may have something to do with cmake. Is it possibly using the host machine cmake but should be using some "android toolchain" cmake instead? I couldn't find much info on that either, but it could explain why it isn't picking the program_invocation_short_name thingie and the libs.
So, any ideas what is going wrong and how to fix it?
The build env should be clear by the first few lines of code but just in case, it's Ubuntu 16.04 x64, using NDK r12b and the GCC 4.9 toolchain. I am using the following versions of the libraries: libiconv 1.15, openssl 1.1.0f and mariadb_connector_c 3.0.3.
Currently MariaDB Connector/C doesn't support Android NDK, this is planned for the upcoming 3.0.3 release.
To build MariaDB Connector/C with Android NDK you need to checkout the 3.0-portable branch of MariaDB Connector/C.
Iconv support currently doesn't work, same is valid for Kerberos/GSSAPI authentication plugin.
For building MariaDB Connector/C with Android NDK you have specify additionally the following CMake parameters:
-DWITH_ICONV=OFF -DWITH_DYNCOL=OFF -DAUTH_GSSAPI_TYPE=OFF
If you don't need SSL/TLS support, you can disable it by specifying
-DWITH_SSL=OFF

Using gperftools with a Jetson TX1 dev kit

I've been recommended gperftools to simply and quickly profile my code. Furthermore, the integration of -lprofiler was already done in the CMAKE of the code I got. Now that I migrated the source code on to the Jetson TX1 and that it worked well, I've tried to use gperftools.
Unfortunately, segmentation faults start to appear as soon as I launch my program with perftools
env CPUPROFILE=./lts.prof /mybin
I've read the documentation and they talk about using the correct libunwind for 64 bit Linux. Unfortunately, the given library (0.99 libunwind, http://download.savannah.gnu.org/releases/libunwind/libunwind-0.99-beta.tar.gz) does not seem to like the Tegra platform.
First of all, there is a problem with the config.guess, that I had to change with the one located in /usr/share/automake*/.
configure: error: cannot guess build type; you must specify one
Then it goes wrong like this :
config.status: error: ./include/libunwind-aarch64.h: file not found
I've tried to use the master tree because they added AARCH64 (which appeared in the error messages), but then I get other messages :
aarch64/is_fpreg.c:31:21: error: 'UNW_AARCH64_V0' undeclared (first use in this function)
return (regnum >= UNW_AARCH64_V0 && regnum <= UNW_AARCH64_V31);
aarch64/is_fpreg.c:31:49: error: 'UNW_AARCH64_V31' undeclared (first use in this function)
return (regnum >= UNW_AARCH64_V0 && regnum <= UNW_AARCH64_V31);
As anyone been able to use gperftools on a Tegra Dev Kit or similar
platform ?
Is the libunwind part of the segfault problem ? Again the
code works without -lprofiler and CPUPROFILER.

Simulink S-Function with C++ code compiles but gives an error at generation/set-up

I have a C++ routine that I would like to pack in a Simulink S-Function. This C++ routines calls other routines that are in several other C++ files.
I could manage to have everything compiled (i.e. the mexglx file is generated) using the legacy_code tool. However, the following warning is issued:
Warning: You are using gcc version "4.4.4-14ubuntu5)". The earliest gcc version
supported with mex is "4.1". The latest version tested for use with mex
is "4.2". To download a different version of gcc, visit http://gcc.gnu.org
The problem arises when I try to generate the S-Function block by issuing the command:
legacy_code('slblock_generate', def);
At this point, the following error mentioning the GLIBCXX version is raised:
??? Error using ==> iAddSfunctionBlock at 183
Error due to multiple causes.
Error in ==>
/opt/matlab/toolbox/simulink/simulink/+legacycode/#LCT/generateslblock.p>
generateslblock at 55
Error in ==> /opt/matlab/toolbox/simulink/simulink/legacy_code.p>legacy_code at
160
Caused by:
Error using ==> iAddSfunctionBlock at 183
Invalid MEX-file 'sfun_vectorRotation_b.mexglx':
/opt/matlab/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6: version
`GLIBCXX_3.4.11' not found (required by sfun_vectorRotation_b.mexglx).
Error using ==> iAddSfunctionBlock at 183
Error while obtaining sizes from MEX S-function 'sfun_vectorRotation_b' in
'untitled1/sfun_vectorRotation_b'. MATLAB error message:
Invalid MEX-file 'sfun_vectorRotation_b.mexglx':
/opt/matlab/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6: version
`GLIBCXX_3.4.11' not found (required by sfun_vectorRotation_b.mexglx).
Honestly I am a bit lost at this point. I do not know if downgrading the g++ compilator would be enough or if I have to do some other things. Do you have a possible solution for this issue?
I am using Matlab 2009b in an Ubuntu 10.10 OS, and the g++ version is:
g++ (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
Thanks a lot in advance
Miquel
Finally I could solve the problem myself. Just download and install (via ./configure, make and make install) a supported version of gcc (anyone between 4.1 and 4.2 will do). In my case I tried gcc-4.2 and it works fine.
Thanks anyway!
Miquel