Author Topic: Program execution within Code::Blocks on Raspbian (Linux)  (Read 12183 times)

Offline Sensei

  • Multiple posting newcomer
  • *
  • Posts: 20
Program execution within Code::Blocks on Raspbian (Linux)
« on: June 13, 2013, 05:33:57 pm »
Hello,

I managed to compile and setup wxWidgets on my Raspberry PI and now want to check whether I'm able to write a small Program using Code::Blocks in order to check that all went right.
The obligatory "Hello World" Program compiles and the release and debug build can be executed on clicking the corresponding buttons.

In the next step I compiled the wxWidgets Template provided with Code::Blocks and the compilation and linking prosses finished without errors.
If I try to execute the wxTemplate by clicking the "play" Button I get a red message that says that the process terminated with status -1.

I discoverd that I have to use ./wxTemplate to run that application from a linux shell. I understand that this happens because the executable isn't located in /usr/bin where the PATH variable points to. But I dont want to copy each build to /usr/bin in order to debug a application. So is there a possibility to setup my Code::Blocks projekt that executables can be run also if the are not in /usr/bin.

The other question is, why does my "Hello World" console application start without having this problem?

For any help I will thank you in advance.

Greetings

Sensei

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Program execution within Code::Blocks on Raspbian (Linux)
« Reply #1 on: June 13, 2013, 05:47:50 pm »
pleas post the build log

Offline Sensei

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: Program execution within Code::Blocks on Raspbian (Linux)
« Reply #2 on: June 14, 2013, 10:24:35 am »
Hi,

the build log won't show something unusual.

Quote
-------------- Build: Release in wxWidgetsTest ---------------

Compiling: wxWidgetsTestApp.cpp
Compiling: wxWidgetsTestMain.cpp
Linking executable: bin/Release/wxWidgetsTest Output size is 38,84 KB Process terminated with status 0 (2 minutes, 11 seconds)
0 errors, 0 warnings

This problem might occur at more Code::Blocks installations running on Linux machines.

Greetings

Sensei

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Sensei

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: Program execution within Code::Blocks on Raspbian (Linux)
« Reply #4 on: June 14, 2013, 12:07:57 pm »
Hello,

her is the log in detail:

Quote
-------------- Clean: Release in wxWidgetsTest ---------------

Cleaned "wxWidgetsTest - Release"

-------------- Build: Release in wxWidgetsTest ---------------

g++ -Wall -I/usr/local/lib/wx/include/gtk2-unicode-release-2.8
g++ -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
g++ -D__WXGTK__ -pthread   -O2   
g++ -I../../../../../usr/local/include/wx-2.8 -I/usr/include/wx-2.8  -c
g++ /home/pi/Projekte/Software/wxWidgetsTest/wxWidgetsTestApp.cpp -o
g++ obj/Release/wxWidgetsTestApp.o -Wall
g++ -I/usr/local/lib/wx/include/gtk2-unicode-release-2.8
g++ -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
g++ -D__WXGTK__ -pthread   -O2   
g++ -I../../../../../usr/local/include/wx-2.8 -I/usr/include/wx-2.8  -c
g++ /home/pi/Projekte/Software/wxWidgetsTest/wxWidgetsTestMain.cpp -o
g++ obj/Release/wxWidgetsTestMain.o -L../../../../../usr/local/lib
g++ -L/usr/lib/arm-linux-gnueabihf  -o bin/Release/wxWidgetsTest
g++ obj/Release/wxWidgetsTestApp.o obj/Release/wxWidgetsTestMain.o   -s
g++ -L/usr/local/lib -pthread   -lwx_gtk2u_richtext-2.8
g++ -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8
g++ -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8
g++ -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8
Output size is 38,84 KB
Process terminated with status 0 (1 minutes, 34 seconds)
0 errors, 0 warnings

Hope this helps.

Greetings

Sensei

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Program execution within Code::Blocks on Raspbian (Linux)
« Reply #5 on: June 14, 2013, 12:29:05 pm »
The output looks pretty much messed up. There should not be g++'s on every row.

Can you compile simple console project on this machine?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Sensei

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: Program execution within Code::Blocks on Raspbian (Linux)
« Reply #6 on: June 14, 2013, 12:53:41 pm »
Hi,

I don't know whether this went this way.

Here is the exaclty same build log as it is shown inside Code::Blocks:

Quote
-------------- Clean: Release in wxWidgetsTest ---------------

Cleaned "wxWidgetsTest - Release"

-------------- Build: Release in wxWidgetsTest ---------------

g++ -Wall -I/usr/local/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread   -O2    -I../../../../../usr/local/include/wx-2.8 -I/usr/include/wx-2.8  -c /home/pi/Projekte/Software/wxWidgetsTest/wxWidgetsTestApp.cpp -o obj/Release/wxWidgetsTestApp.o

g++ -Wall -I/usr/local/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread   -O2    -I../../../../../usr/local/include/wx-2.8 -I/usr/include/wx-2.8  -c /home/pi/Projekte/Software/wxWidgetsTest/wxWidgetsTestMain.cpp -o obj/Release/wxWidgetsTestMain.o

g++ -L../../../../../usr/local/lib -L/usr/lib/arm-linux-gnueabihf  -o bin/Release/wxWidgetsTest obj/Release/wxWidgetsTestApp.o obj/Release/wxWidgetsTestMain.o   -s -L/usr/local/lib
-pthread   -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8
Output size is 38,84 KB
Process terminated with status 0 (1 minutes, 34 seconds)
0 errors, 0 warnings

Hope this helps?

Greetings

Sensei

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Program execution within Code::Blocks on Raspbian (Linux)
« Reply #7 on: June 14, 2013, 01:10:16 pm »
From this log I can't see any problem:
g++ -L../../../../../usr/local/lib -L/usr/lib/arm-linux-gnueabihf  -o bin/Release/wxWidgetsTest obj/Release/wxWidgetsTestApp.o obj/Release/wxWidgetsTestMain.o   -s -L/usr/local/lib
-pthread   -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8
Output size is 38,84 KB
Process terminated with status 0 (1 minutes, 34 seconds)
0 errors, 0 warnings

the pr0cess terminated with 0... It didn't work when you hit the green run button?

The other question is, why does my "Hello World" console application start without having this problem?

the hello world doesn't use any additional library. The wxWidgets application uses the wxWidgets library, so you have a dependence and if the executable can't find this library it will terminate with a error... I think this is happening with your application, but i can't say where the error is... If you run it from terminal it works? interesting... 90% of the errors are conversely.

Offline Sensei

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: Program execution within Code::Blocks on Raspbian (Linux)
« Reply #8 on: June 14, 2013, 02:12:58 pm »
Hi,

yes I'm also confused.

To run the wxWidgts test app I have to type ./wxWidgetsTestApp in a console window otherwise without ./ it the program will not be executed.

The HelloWord programm can be started by clicking the green run butten but from the console I also need the ./ to execute it.

The fact that ./wxWidgetsTestApp starts the application I would think that the libs can be found but I'm not 100% sure.

My PATH looks like:
/usr/lib/arm-linux-gnueabihf/libfm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usrbin:/sbin:/bin;/usr/local/games:/usr/games:/

The wx-Libraries are located in /usr/local/lib. This directory in detail is not converd in the path variable, but Im not sure that this is the problem.

I think I will try out in adding it to the path variable.

Greetings

Sensei

Offline Sensei

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: Program execution within Code::Blocks on Raspbian (Linux)
« Reply #9 on: June 14, 2013, 02:30:06 pm »
Hi,

UPDATE:

I did:
PATH=$PATH:/usr/local/lib
exoprt PATH

Unfortunately this didn't solve the Problem and I still can not execute the wxWidgetsTestApp by clicking the green run button.

I hope someone out there has further ideas?

Greetings

Sensei

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Program execution within Code::Blocks on Raspbian (Linux)
« Reply #10 on: June 14, 2013, 04:06:06 pm »
set LD_LIBRARY_PATH?
« Last Edit: June 14, 2013, 04:11:05 pm by dmoore »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Program execution within Code::Blocks on Raspbian (Linux)
« Reply #11 on: June 14, 2013, 07:17:14 pm »
If you are in the same folder as the app, you always need the ./ on linux.
It's linux specific and has nothing to do with C::B

Offline Sensei

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: Program execution within Code::Blocks on Raspbian (Linux)
« Reply #12 on: June 17, 2013, 09:15:51 am »
Hi,

Quote
If you are in the same folder as the app, you always need the ./ on linux.
It's linux specific and has nothing to do with C::B

Yes, thats what I thought also, but my question is why I cant run the app by clicking the green run button?
Can this have something to do that I build wxWidgets as shared libraries and have to set some path inside C::B?

Greetings

Sensei

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Program execution within Code::Blocks on Raspbian (Linux)
« Reply #13 on: June 17, 2013, 09:40:22 am »
 try to change the terminal in Settings->Environment Settings->General Settings->Terminal to launch console programs

Offline Sensei

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: Program execution within Code::Blocks on Raspbian (Linux)
« Reply #14 on: June 17, 2013, 10:40:21 am »
Hi,

got it to work.

I deleted the projekt file and setup the projekt again. Selecting advanced Options and then dynamic lib.
Recompiled and now it runs from inside C::B.

I think the problem was the projekt configuration related to the wxWidgets paket distributed with raspbian. After a self compiled wxWidgets the the configuration of the wxSystem was changed.

Thanks for all helping with posts and tips

Greetings

Sensei