DavidAtanasoski
Posts: 31
Joined: Mon Jul 09, 2018 2:37 pm

Problem with a library

Sun Jul 15, 2018 11:35 am

I've been doing some project on my Raspberry PI with Open CV in C++ and the Code Blocks IDE. So, here is the problem. I build the code successfully and when I run it, I get this error

Image

I couldn't find somethign precise on the internet, so tell me your ideas to fix this.
Enthusiast.

User avatar
topguy
Posts: 4611
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Problem with a library

Mon Jul 16, 2018 10:28 am

Are you on Raspbian ? Which version ? Any cross-compiling involved here ?

Only tip I can give is to make sure the package "gettext" is installed and then maybe recompile (all) before trying to run it again.

DavidAtanasoski
Posts: 31
Joined: Mon Jul 09, 2018 2:37 pm

Re: Problem with a library

Mon Jul 16, 2018 5:59 pm

The package "gettext" is installed, I've tried that. The version of the Raspbian is the newest.
Enthusiast.

User avatar
topguy
Posts: 4611
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Problem with a library

Tue Jul 17, 2018 10:00 am

I come back to the question "Is this crosscompiled or is the code originally meant for windows ?"
What are the compiler/project options in codeblocks. Can we see the GCC compiler logs.

In these cases I go to packages.debian.org and search for which package might include the missing file. We have after all mostly the same packages in Raspbian Stretch and Debian Stretch. And according to that site there is no library file in stretch with the name "libgnuintl" so I'm asking myself, how did you successfully link you program if the library cant be installed.

There is also the possibility that your codeblocks project actually creates this library, and therefore manages to link with it, but does not have the correct path configured when running programs depending on it.

DavidAtanasoski
Posts: 31
Joined: Mon Jul 09, 2018 2:37 pm

Re: Problem with a library

Tue Jul 17, 2018 2:49 pm

I come back to the question "Is this crosscompiled or is the code originally meant for windows ?"
I don't understand this question at all. But, I've wrote this code in Visual Studio on Windows and there it works alright. Now, I want to make the same thing on the Raspberry Pi, but I get this error.
Enthusiast.

User avatar
DougieLawson
Posts: 33348
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Problem with a library

Tue Jul 17, 2018 3:12 pm

Did you compile/link the program on Windows and deploy on your Raspberry? Or did you move the source code to your Raspberry and compile on there?

Can you post an example program that doesn't work on here (in [code]... your stuff goes here ...[/code] tags)?
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

User avatar
topguy
Posts: 4611
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Problem with a library

Tue Jul 17, 2018 4:18 pm

DavidAtanasoski wrote:
Tue Jul 17, 2018 2:49 pm
I come back to the question "Is this crosscompiled or is the code originally meant for windows ?"
I don't understand this question at all. But, I've wrote this code in Visual Studio on Windows and there it works alright. Now, I want to make the same thing on the Raspberry Pi, but I get this error.
I expected this based on what I saw on google when I searched "libgnuintl". I think Windows have their own library for translations called "libintl" so when you want to make portable software between Linux and Windows and need to use Linux gettext/libintl you rename it to "libgnuintl" on Windows to avoid linking with the wrong library.

So my best guess is that there still is something in the project or settings of CodeBlocks that still refer to this libgnuintl. But there is a lot of details here we dont know.
- Did you choose to include translation options in your application or is it something OpenCV comes with ?
- In that case how did you install OpenCV ?
- Did you create your application from scratch with OpenCV or did you follow some examples or example project-files for VS ?

DavidAtanasoski
Posts: 31
Joined: Mon Jul 09, 2018 2:37 pm

Re: Problem with a library

Tue Jul 17, 2018 6:33 pm

DougieLawson wrote: Did you compile/link the program on Windows and deploy on your Raspberry? Or did you move the source code to your Raspberry and compile on there?

Can you post an example program that doesn't work on here (in [code]... your stuff goes here ...[/code] tags)?
I just copy the source code and paste it in Code Blocks on Raspberry PI. I can't post the code because its over 1000 lines.
topguy wrote:

I expected this based on what I saw on google when I searched "libgnuintl". I think Windows have their own library for translations called "libintl" so when you want to make portable software between Linux and Windows and need to use Linux gettext/libintl you rename it to "libgnuintl" on Windows to avoid linking with the wrong library.

So my best guess is that there still is something in the project or settings of CodeBlocks that still refer to this libgnuintl. But there is a lot of details here we dont know.
- Did you choose to include translation options in your application or is it something OpenCV comes with ?
- In that case how did you install OpenCV ?
- Did you create your application from scratch with OpenCV or did you follow some examples or example project-files for VS ?
- I didn't include anything connected with translation.
- I installed the OpenCV according to this manual:
https://www.pyimagesearch.com/2017/09/0 ... pberry-pi/
- I've created the whole program from scratch ( all the logic, etc. ), except one thing and that is the circle recognition which I took from here:
https://docs.opencv.org/2.4/doc/tutoria ... ircle.html
And I've changed a little bit for my purpose.

And now let me tell you a fun fact. I'm going in an Academy about programming, robotics and mathematics. They own Raspberry Pi, I've tried the same code there and went OK. It worked with no problem.
Enthusiast.

User avatar
DougieLawson
Posts: 33348
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Problem with a library

Tue Jul 17, 2018 7:39 pm

If you can't answer a simple question with a simple answer and a simple source code example, then I'm out of here.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

DavidAtanasoski
Posts: 31
Joined: Mon Jul 09, 2018 2:37 pm

Re: Problem with a library

Tue Jul 17, 2018 10:36 pm

I just copy the source code and paste it in Code Blocks on RPi. The build was successful, but when i run it I get that error. I don't know what's not answered.
Enthusiast.

User avatar
topguy
Posts: 4611
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Problem with a library

Wed Jul 18, 2018 10:05 am

They own Raspberry Pi, I've tried the same code there and went OK. It worked with no problem.
Using codeblocks there too ? Running same version of Raspbian ?

There is this "ldd" command that you can run on a compiled program, it will tell you all the dynamic libraries it depends on and where they are found (if found).

So if you run

Code: Select all

ldd /home/pi/vehicle/bin/Debug/vehicle
And do the same on the Pi where it works, then you can compare and see if:
- The working code depends on "libgnuintl" and its found there. ( and where its found is important )
- The working code does not depend on "libgnuintl", meaning that there are differences in compiler environment.

DavidAtanasoski
Posts: 31
Joined: Mon Jul 09, 2018 2:37 pm

Re: Problem with a library

Wed Jul 18, 2018 11:50 am

I've just realized that the problem isn't my code. I've write this simple * Hello World * code and I get the same error. Even I reinstalled the Code Blocks and there were not improvements.

Image
Enthusiast.

DavidAtanasoski
Posts: 31
Joined: Mon Jul 09, 2018 2:37 pm

Re: Problem with a library

Wed Jul 18, 2018 6:13 pm

I've checked the versions of the Pi's Raspbian and I realized that they're different, as you can see on the images below:

This one is from academy:

Image

And this is mine:

Image
Enthusiast.

DavidAtanasoski
Posts: 31
Joined: Mon Jul 09, 2018 2:37 pm

Re: Problem with a library

Thu Jul 19, 2018 12:21 pm

.
Enthusiast.

User avatar
topguy
Posts: 4611
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Problem with a library

Thu Jul 19, 2018 2:23 pm

Compile it by hand.

Code: Select all

[email protected]:~$ g++ -o hello hello.cpp
[email protected]:~$ ./hello 
Hello World
[email protected]:~$ ldd ./hello
	linux-vdso.so.1 (0x7eb14000)
	/usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76f45000)
	libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x76e57000)
	libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x76ddc000)
	libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x76daf000)
	libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x76c6e000)
	/lib/ld-linux-armhf.so.3 (0x54b32000)
Then you can verify that the installed compiler works..

User avatar
scruss
Posts: 1726
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Problem with a library

Thu Jul 19, 2018 3:57 pm

No problem building the commad-line test C++ code here in Code::Blocks under Raspbian Stretch.

What is the output of your build log window?

How did you install it? This is what I did:

Code: Select all

sudo apt update
sudo apt -y dist-upgrade
sudo apt -y install build-essential codeblocks codeblocks-common codeblocks-contrib
This gave me version 16.01.

The only configuration I did was to set GCC as the default compiler, as it complained it had something mis-configured until I did.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

DavidAtanasoski
Posts: 31
Joined: Mon Jul 09, 2018 2:37 pm

Re: Problem with a library

Fri Jul 20, 2018 10:23 am

topguy wrote:
Thu Jul 19, 2018 2:23 pm
Compile it by hand.

Code: Select all

[email protected]:~$ g++ -o hello hello.cpp
[email protected]:~$ ./hello 
Hello World
[email protected]:~$ ldd ./hello
	linux-vdso.so.1 (0x7eb14000)
	/usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76f45000)
	libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x76e57000)
	libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x76ddc000)
	libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x76daf000)
	libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x76c6e000)
	/lib/ld-linux-armhf.so.3 (0x54b32000)
Then you can verify that the installed compiler works..
It seems that is OK like this, here's the output:

Code: Select all

[email protected]:~/motori $ ./main
Hello world!
[email protected]:~/motori $ ldd ./main
	linux-vdso.so.1 (0x7ef7f000)
	/usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76f97000)
	libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x76e36000)
	libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x76db7000)
	libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x76d8a000)
	libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x76c4b000)
	/lib/ld-linux-armhf.so.3 (0x76fad000)
scruss wrote: No problem building the commad-line test C++ code here in Code::Blocks under Raspbian Stretch.

What is the output of your build log window?

How did you install it? This is what I did:

Code: Select all

sudo apt update
sudo apt -y dist-upgrade
sudo apt -y install build-essential codeblocks codeblocks-common codeblocks-contrib
This gave me version 16.01.

The only configuration I did was to set GCC as the default compiler, as it complained it had something mis-configured until I did.
I did this and It went everything okey. I've rebooted the Raspberry and opened Code Blocks again and I get this message:

Image

And this is how my Spell Checker looks like:

Image
Enthusiast.

User avatar
topguy
Posts: 4611
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Problem with a library

Fri Jul 20, 2018 10:37 am

The spellchecker setup is probably not very relevant...
What is the output of your build log window?
but several people have asked for this.. please give us this if you want relevant help..

DavidAtanasoski
Posts: 31
Joined: Mon Jul 09, 2018 2:37 pm

Re: Problem with a library

Fri Jul 20, 2018 12:27 pm

There you have

Image
Enthusiast.

DavidAtanasoski
Posts: 31
Joined: Mon Jul 09, 2018 2:37 pm

Re: Problem with a library

Sat Jul 21, 2018 4:06 pm

...
Enthusiast.

User avatar
scruss
Posts: 1726
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Problem with a library

Sat Jul 21, 2018 9:08 pm

Please stop bumping the thread. People (not just me) have tried to repeat your process. It works for them, it doesn't work for you. There must be something else wrong with your setup. We can't repeat your errors, so please stop expecting us to magic up answers.

If it's of any help, here's my build log for the bare C++ console project:

Code: Select all

-------------- Build: Debug in test (compiler: GNU GCC Compiler)---------------

g++ -Wall -fexceptions -g  -c /home/pi/Documents/codeblocks/test/main.cpp -o obj/Debug/main.o
g++  -o bin/Debug/test obj/Debug/main.o   
Output file is bin/Debug/test with size 27.77 KB
Process terminated with status 0 (0 minute(s), 1 second(s))
0 error(s), 0 warning(s) (0 minute(s), 1 second(s))
 

-------------- Run: Debug in test (compiler: GNU GCC Compiler)---------------

Checking for existence: /home/pi/Documents/codeblocks/test/bin/Debug/test
Executing: xterm -T test -e /usr/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. /home/pi/Documents/codeblocks/test/bin/Debug/test  (in /home/pi/Documents/codeblocks/test/.)
Process terminated with status 0 (0 minute(s), 3 second(s))
Must you use Code::Blocks? One of your screnshots suggests you are following tutorials from Meccanismo Complesso, and it doesn't look like they require it. Their tutorials are a bit old (like they recommend building OpenCV; it's in the repos now) so they may be leading you astray
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Return to “Troubleshooting”

Who is online

Users browsing this forum: 4wd, grimepoch, SEI and 36 guests