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
Related
I'm developing a game, and am trying to use bullet. However, (it seems that) I am having trouble linking the bullet libraries. Edit 2: I have my code on github
This is actually my first time using cmake. I have searched through the FindBullet.cmake file, and could find the variable to link libraries(${BULLET_LIBRARIES}), but linking the libraries in the variable didn't do anything.
find_package(Bullet REQUIRED)
include_directories(${BULLET_INCLUDE_DIR})
target_link_libraries(3DPlatformer ${BULLET_LIBRARIES})
I expected the my code to compile but instead I got a bunch of, "undefined refrence to" then whatever function from bullet it read.
edit:
more undefined references to `btAlignedAllocInternal(unsigned long, int)' follow
^ thats what I got a bunch of
collect2: error: ld returned 1 exit status
And that is the last error.
Full Error
libbullet-dev need to be installed.
sudo apt-get install libbullet-dev
My issue is that one of my if statements was broken.
My if statement:
if(USE_SYSTEM_BULLET)
find_package(Bullet REQUIRED)
include_directories(${BULLET_INCLUDE_DIR})
target_link_libraries(3DPlatformer ${BULLET_LIBRARIES} -lGL -lGLU)
else(USE_SYSTEM_BULLET)
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet" )
include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src")
endif(USE_SYSTEM_BULLET)
was somehow triggering all the code instead of some of it. commenting the code like this:
#if(USE_SYSTEM_BULLET)
find_package(Bullet REQUIRED)
include_directories(${BULLET_INCLUDE_DIR})
target_link_libraries(3DPlatformer ${BULLET_LIBRARIES} -lGL -lGLU)
#else(USE_SYSTEM_BULLET)
# add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet" )
# include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src")
#endif(USE_SYSTEM_BULLET)
fixed it.
I'm unable to compile anything in my linux pc. I have no idea why, probably I've installed some package and made a mess. I've uninstalled and reinstalled gcc and other packages, but no good news.. still this problem.
This is the message:
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-
linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/crt1.o: unrecognized relocation (0x29) in section `.text'
Any idea of what does it mean and how to fix this problem?
cheers
For anyone else that encounters this issue: I think #gabib44's problem was using a older version of ld to link a library that had been built with a newer version.
"unrecognized relocation" occurs when the relocation type is greater than the greatest known relocation type in your version of ld. 0x2a (R_X86_64_REX_GOTPCRELX) is presently the relocation type with the greatest value; I guess #gabib44's ld was old enough to not know about the relocation type before that one (0x29, R_X86_64_GOTPCRELX).
I had this problem myself when I was building a library with binutils v2.26 (which knew about relocation 0x2a) but then incorporating that library on a build machine using binutils v2.24
The fix is either to build the library that you want to link with a older version of the binutils suite, or to upgrade ld on the machine that wants to link that library.
I've found this in another post:
[...which when compiled brings this error:
/usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/../../../../x86_64-pc-linux-
gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-
gnu/6.4.0/../../../../lib64/Scrt1.o: unrecognized relocation (0x2a) in
section `.text'
After trying a lot of things out, including emerging binaries from a different Gentoo system, I finally reverted, and got the problem solved thanks to optiz0r (for solving my issue) and Ryuno-Ki[m] (for letting me know about optiz0rs reply when I had logged off).
sudo binutils-config x86_64-pc-linux-gnu-2.29.1
Very simple! The solution to your problem may differ, but running
sudo binutils-config -l
may reveal the version you can enter instead of the version I used...]
by necrophcodr » Tue Feb 06, 2018 21:24
on https://forum.sabayon.org/viewtopic.php?f=57&t=34076&p=181260#p181260
It worked for me.
I fixed installing gcc-32bit and removing various other packets
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 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
every time I try to compile a sample program I get cv.h not found, highgui.c not found. I try to go to the includes folder in opencv and did a sudo copy * to usr/includes and did not help much: i got the following output can someone tell me what i do wrong?
stream_server.c:19:25: fatal error: /usr/include/highgui.h: Permission denied
compilation terminated.
uc#uc-HP-Pavilion-dv6-Notebook-PC:~/Desktop$ sudo gcc stream_server.c -o streamserver
stream_server.c: In function ‘quit’:
stream_server.c:174:5: warning: format not a string literal and no format arguments [-Wformat-security]
stream_server.c:177:5: warning: format not a string literal and no format arguments [-Wformat-security]
/tmp/ccVnjC7y.o: In function `cvDecRefData':
stream_server.c:(.text+0xa9a): undefined reference to `cvFree_'
stream_server.c:(.text+0xb22): undefined reference to `cvFree_'
/tmp/ccVnjC7y.o: In function `cvGetRow':
stream_server.c:(.text+0xc39): undefined reference to `cvGetRows'
/tmp/ccVnjC7y.o: In function `cvGetCol':
The first problem you have is that you apparently installed some file without the correct permissions. Since it seems you can use sudo, you might want to fix the permissions on the file:
sudo chmod a+r /usr/include/highgui.h
(similar to other files you don't have read permissions to).
The other problem indicates that you got your code to compile but not to link. This is most like because you either miss the library name entirely or you have it in the wrong location: make sure you use -lhighgui -lcvaux -lcxcore(this is what I gather from the docs; I haven't used this library myself) after any translation unit you provide (e.g., after stream_server.c; this looks suspiciously like a C file, implying a wrong language tag in action).