I am working on one project where I am using arduino. I am running Fedora 24 and Arduino IDE 1.6.4. I have wanted to continue in my work yesterday but I could not. New compilation error appeared. Last time everything was working OK. A have also tried some other older working sketches, they display the same error now.
Arduino: 1.6.4 (Linux), Board: "Arduino Nano, ATmega328"
Build options changed, rebuilding all
arduino.cpp.o: In function `setup':
/usr/share/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial.h:111: undefined reference to `operator delete(void*, unsigned int)'
/usr/share/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial.h:111: undefined reference to `operator delete(void*, unsigned int)'
collect2: error: ld returned 1 exit status
Error compiling.
I remember that I was using "dnf update" before and it updated also kernel. I have already tried to reinstall arduino IDE with removing the .arduino15 directory and reinstall all of my libraries. Nothing helps. How can I fix ths compiling error?
I have already solved my problem. I have tried different things but this worked:
uninstall Arduino IDE thru terminal
delete .arduino15 folder
search for any directory called arduino and remove it with sudo rm -r
install the lastest Arduino IDE version directly from https://www.arduino.cc/en/Main/Software
Related
*This is my first programming course in over 20 years, so I am basically clueless.
I am trying to complete the last project in the course which includes installing and configuring SDL. Right now all I have is the basic "Hello World" code. I get the error when I add #include .
When I installed SDL, I copied the SDL2 folder and the entire lib folder to MinGW-w64 - as instructed by a tutorial.
I have MinGW-w64 installed. Here is the build error:
C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
I've been googling for hours and cannot seem to find any help.*
Edit:
Thank you both so much for your quick responses.
Here is what I did in settings:
Do I need to put an 'l' in front of these items?
I got some help elsewhere and added #define SDL_MAIN_HANDLED. This allowed the project to build, but it still doesn't run. I get nothing at all when I try to run it. I tried calling SDL_GetError(), but still nothing.
also make sure your main has the following signature:
int main(int, char**) - SDL is pretty militant about it
I have set up a video streaming system with OpenCv and Cairo. Unfortunately, now when I attempt to build, I get all sorts of undefined references to libpangocairo-1.0.so.0. I'd like a solution where I can just ignore these undefined references, or explicitly and exclusively point to the correct dependency.
Side note: I am using CMake.
It seems that my system library files are accidentally being queried instead of the user installed dependencies for OpenCv.
Things I have tried:
• Reinstalled libpangocairo
• Changed the LD_LIBRARY_PATH to explicitly point at our cairo library dependency within the repo
• Updated Glib to 2.27 from 2.0 (source said that Cario/OpenCv depends on the a later version of GLibc - I think he actually said 2.39, which doesn't exist :white_frowning_face:)
• Updated GTK to 3.0 which also contains glib and would install its most recent version
• Copied libpangocairo from /usr/lib to our repositories dependencies (build points correctly to the newly located lib but still same error)
• Completely wiped my environment and set up environment from scratch
Error Message:
//usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0: undefined reference to `cairo_ft_scaled_font_unlock_face'
//usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0: undefined reference to `cairo_ft_font_options_substitute'
//usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0: undefined reference to `cairo_ft_font_face_create_for_pattern'
//usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0: undefined reference to `cairo_ft_scaled_font_lock_face'
collect2: error: ld returned 1 exit status
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
I am getting an "undefined reference" error building my Android app. I am using JNI and the NDK.
What is inexplicable to me is that it seems to be doing an NDK build during my build of the Android app itself. Yet I've already used the command line to build my Android.mk and Application.mk files to produce the desired library. All the the Android app is supposed to do is link to the library and make calls into it. But even if I'm wrong about this, I don't understand why it is complaining about errors in AILSuperFFT.o. This object file is already a part of the library I successfully built. The build process of my Android app should not know anything about AILSuperFFT.cpp or its internal calls to the Superpowered library.
Here's the Console output in Android Studio.
. . .
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:app:compileDebugNdk
/Users/user1/Documents/AndroidStudioProjects/hello-jnicpp/app/build/intermediates/ndk/debug/obj/local/arm64-v8a/objs/hello-jni//Users/user1/Documents/AndroidStudioProjects/hello-jnicpp/app/src/main/jni/sources/AILSuperFFT.o: In function `CAILSuperFFT::LinearFFT_Quick(DSPSplitComplex*, int, int, int, FFTDirection, bool)':
/Users/user1/Documents/AndroidStudioProjects/hello-jnicpp/app/src/main/jni/sources/AILSuperFFT.cpp:139: undefined reference to `SuperpoweredFFTComplex(float*, float*, int, bool)'
/Users/user1/Documents/AndroidStudioProjects/hello-jnicpp/app/src/main/jni/sources/AILSuperFFT.cpp:139: undefined reference to `SuperpoweredFFTComplex(float*, float*, int, bool)'
/Users/user1/Documents/AndroidStudioProjects/hello-jnicpp/app/build/intermediates/ndk/debug/obj/local/arm64-v8a/objs/hello-jni//Users/user1/Documents/AndroidStudioProjects/hello-jnicpp/app/src/main/jni/sources/AILSuperFFT.o: In function `CAILSuperFFT::FFT2D(DSPSplitComplex*, int, int, FFTDirection)':
/Users/user1/Documents/AndroidStudioProjects/hello-jnicpp/app/src/main/jni/sources/AILSuperFFT.cpp:52: undefined reference to `__android_log_print'
collect2: error: ld returned 1 exit status
make: *** [/Users/user1/Documents/AndroidStudioProjects/hello-jnicpp/app/build/intermediates/ndk/debug/obj/local/arm64-v8a/libhello-jni.so] Error 1
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugNdk'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/user1/Documents/NDKDev/android-ndk-r10e/ndk-build'' finished with non-zero exit value 2
BUILD FAILED
and here is very similar output in the Messages window:
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:app:compileDebugNdk
/Users/user1/Documents/AndroidStudioProjects/hello-jnicpp/app/build/intermediates/ndk/debug/obj/local/arm64-v8a/objs/hello-jni//Users/user1/Documents/AndroidStudioProjects/hello-jnicpp/app/src/main/jni/sources/AILSuperFFT.o: In function `CAILSuperFFT::LinearFFT_Quick(DSPSplitComplex*, int, int, int, FFTDirection, bool)':
/Users/user1/Documents/AndroidStudioProjects/hello-jnicpp/app/build/intermediates/ndk/debug/obj/local/arm64-v8a/objs/hello-jni//Users/user1/Documents/AndroidStudioProjects/hello-jnicpp/app/src/main/jni/sources/AILSuperFFT.o: In function `CAILSuperFFT::FFT2D(DSPSplitComplex*, int, int, FFTDirection)':
/Users/user1/Documents/AndroidStudioProjects/hello-jnicpp/app/src/main/jni/sources/AILSuperFFT.cpp
Error:(139) undefined reference to `SuperpoweredFFTComplex(float*, float*, int, bool)'
Error:(139) undefined reference to `SuperpoweredFFTComplex(float*, float*, int, bool)'
Error:(52) undefined reference to `__android_log_print'
Error:error: ld returned 1 exit status
make: *** [/Users/user1/Documents/AndroidStudioProjects/hello-jnicpp/app/build/intermediates/ndk/debug/obj/local/arm64-v8a/libhello-jni.so] Error 1
Error:Execution failed for task ':app:compileDebugNdk'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/user1/Documents/NDKDev/android-ndk-r10e/ndk-build'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 5.858 secs
Information:5 errors
Upon request below is the source code function call that is being complained about. Note that not only does this code build and link fine using ndk-build in Mac's Terminal, but the resulting library is then used without problem in a different app. I am not able to tell (yet) what is the difference between these two apps, but be aware of the dependencies here: Android app uses our proprietary library, which builds and links in the Superpowered lib. The app only knows about the interface exposed by library A, and all of this works fine in one app. (I'm constructing a test app to demonstrate a certain issue, which can't be done with the main app). Log2() returns an int.
DSPSplitComplex data;
data.imagp=(float *) malloc(sizeof(float)*BUF_SIZE*BUF_SIZE);
data.realp=(float *) malloc(sizeof(float)*BUF_SIZE*BUF_SIZE);
. . . (some code)
DSPSplitComplex *pBuffer = &data;
SuperpoweredFFTComplex(&pBuffer->realp[0]), &(pBuffer->imagp[0]), Log2(length), (direction==kFFTDirection_Forward) ? true : false);
An ndk-build will be attempted if you have JNI files and haven't explicitly turned off the auto-build by adding this to your build.gradle:
android {
sourceSets.main {
jni.srcDirs = []
}
}
If the ndk-build you did prior to building the app worked correctly, the reason is likely that the automated ndk-build called by Gradle ignores your Android.mk file.
I need to use mqtt broker in a project of mine. But i felt there is a huge lack of documentation. Some of the available example codes i found didn't really work for me. Followed this example, but got compilation error
[subho#localhost] taboo $ g++ mqtt.cpp -o a
/tmp/ccg9xcFV.o: In function `myMosq::myMosq(char const*, char const*, char const*, int)':
mqtt.cpp:(.text+0x31): undefined reference to `mosqpp::mosquittopp::mosquittopp(char const*, bool)'
mqtt.cpp:(.text+0x41): undefined reference to `mosqpp::lib_init()'
mqtt.cpp:(.text+0x9c): undefined reference to `mosqpp::mosquittopp::connect_async(char const*, int, int)'
mqtt.cpp:(.text+0xa8): undefined reference to `mosqpp::mosquittopp::loop_start()'
mqtt.cpp:(.text+0xb9): undefined reference to `mosqpp::mosquittopp::~mosquittopp()'
/tmp/ccg9xcFV.o: In function `myMosq::~myMosq()':
mqtt.cpp:(.text+0xf5): undefined reference to `mosqpp::mosquittopp::loop_stop(bool)'
mqtt.cpp:(.text+0xfa): undefined reference to `mosqpp::lib_cleanup()'
mqtt.cpp:(.text+0x106): undefined reference to `mosqpp::mosquittopp::~mosquittopp()'
mqtt.cpp:(.text+0x12c): undefined reference to `mosqpp::mosquittopp::~mosquittopp()'
/tmp/ccg9xcFV.o: In function `myMosq::send_message(char const*)':
mqtt.cpp:(.text+0x1b0): undefined reference to `mosqpp::mosquittopp::publish(int*, char const*, int, void const*, int, bool)'
/tmp/ccg9xcFV.o:(.rodata._ZTI6myMosq[_ZTI6myMosq]+0x10): undefined reference to `typeinfo for mosqpp::mosquittopp'
collect2: error: ld returned 1 exit status
Also tried to look into the sample codes given in the mqtt archive but make command failed to compile them. So tried to compile the sample files separately which succeeded but while running it gives buffer overflow and mosquito terminal output is
[subho#localhost] Web_App $ (master) mosquitto
1426996368: mosquitto version 1.3.5 (build date 2014-10-16 10:32:53+0000) starting
1426996368: Using default config.
1426996368: Opening ipv4 listen socket on port 1883.
1426996368: Opening ipv6 listen socket on port 1883.
1426996369: New connection from 127.0.0.1 on port 1883.
1426996369: New client connected from 127.0.0.1 as tempconv (c1, k60).
1426996369: Socket error on client tempconv, disconnecting.
1426997037: New connection from 127.0.0.1 on port 1883.
1426997037: New client connected from 127.0.0.1 as tempconv (c1, k60).
1426997037: Socket error on client tempconv, disconnecting.
1426997314: New connection from 127.0.0.1 on port 1883.
1426997314: New client connected from 127.0.0.1 as tempconv (c1, k60).
1426997314: Socket error on client tempconv, disconnecting.
It would be great if somebody has worked with mqtt before and can share a basic code. Thanks.
I have pushed all the files i tried in github, you can have a look here.
I have the same problem from time to time. Maybe the late answer helps another one, too. Ubuntu has a rather old version of mosquitto. In the meantime it became an eclipse project and some things changed.
This problem occurs, if the mosquitto package of a linux distribution is installed, where the library files go into /usr/lib. For having the header files the source code has to be downloaded and if make install is called, the new library with changed function names or namespace go into /usr/local/lib.
Hence the wrong library is linked.