[SOLVED] [G++ 4.2.4] Kompilierte & gelinkte programe sind nicht ausführbar
-
HI,
Ich habe wie schon im Titel geschrieben, das Problem, dass egal welches Programm ich mit G++ kompiliere, ich es nicht ausführen kann.Commandline:
shade@bumbleblee ~/code/projects/aufgabe-eli $ g++ -march=i686 main.cpp calculator.cpp -o calc shade@bumbleblee ~/code/projects/aufgabe-eli $ ./calc -bash: ./calc: Keine Berechtigung shade@bumbleblee ~/code/projects/aufgabe-eli $ file ./calc ./calc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped shade@bumbleblee ~/code/projects/aufgabe-eli $ ldd ./calc ldd: warning: you do not have execution permission for `./calc' not a dynamic executable
Umgebungsvariablen:
echo $PATH /usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.2.4:/usr/qt/3/bin:/usr/games/bin:/home/shade/.scripts:/home/shade/bin:/opt/bin:/opt/TeamSpeak2:/opt/VirtualBox echo $LD_LIBRARY_PATH /usr/lib/xorg:/usr/lib:/usr/local/lib:/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/:/usr/lib/libstdc++-v3/:/usr/lib:/usr/local/lib:/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/:/usr/lib/libstdc++-v3/
GCC/G++ Version
shade@bumbleblee ~/code/projects $ gcc -v Es werden eingebaute Spezifikationen verwendet. Ziel: i686-pc-linux-gnu Konfiguriert mit: /var/tmp/portage/sys-devel/gcc-4.2.4/work/gcc-4.2.4/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.2.4 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.2.4 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.2.4/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.2.4/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/include/g++-v4 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --disable-libgcj --with-arch=i686 --enable-languages=c,c++,treelang,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu Thread-Modell: posix gcc-Version 4.2.4 (Gentoo 4.2.4 p1.0)
LD Version
shade@bumbleblee ~/code/projects $ ld -v GNU ld (GNU Binutils) 2.18
LDD/libc Version
shade@bumbleblee ~/code/projects $ ldd --version ldd (GNU libc) 2.6.1 Copyright © 2007 Free Software Foundation, Inc. Dies ist freie Software; in den Quellen befinden sich die Lizenzbedingungen. Es gibt KEINERLEI Garantie; nicht einmal für die TAUGLICHKEIT oder VERWENDBARKEIT FÜR EINEN ANGEGEBENEN ZWECK. Written by Roland McGrath and Ulrich Drepper.
Hier noch der Code des Programms, ist aber noch lange nicht fertig, soll eine Art kleiner Taschenrechner werden ...
main.cpp
/** * @version 20080524-testing * @file main.cpp */ //! C++ STD::LIB && STL Includes #include <iostream> #include <string> #include <vector> //! Project Includes #include "calculator.hpp" int main(int argc, char**argv) { //! Decalre all needed vars Calculator calc; std::wstring input; std::wstring result; std::vector<std::wstring> exp; //! Print Start & copyright message std::wcout << L" Calculator (c) branleb@gmail.com" << std::endl; std::wcout << L"==================================" << std::endl; //! Go into mainloop do { std::wcout << L"Wählen Sie die Art der Eingabe aus:" << std::endl; std::wcout << L"\t1.) Den kompletten Ausdruck eingeben" << std::endl; std::wcout << L"\t2.) Jeden Operanden einzeln eingeben" << std::endl; std::wcout << L"\f"; std::wcout.flush(); //! Get the whole expression and calculate it if(input.compare(L"1")) { std::wcout << L"Geben Sie " << std::endl; std::wcin >> input; calc.set_expression(input); } else { if(input.compare(L"2")) { //! Get the every single operator, assemble the expression and calculate it do { input.clear(); std::wcin >> input; exp.push_back(input); } while(input.compare(L"stop") || input.compare(L"Stop") || input.compare(L"STOP")); calc.set_expression(exp); } } //! Calculate the result, fetch it and print it calc.calculate(); result = calc.get_result(); std::wcout << L"Das Ergebnis:\t" << result << std::endl; } while(input.compare(L"ende") || input.compare(L"quit") || input.compare(L"exit")); }
calculator.hpp
/** * @version 20080524-testing * @file calc.cpp */ //! C++ STD::LIB && STL Includes #include <string> #include <sstream> #include <vector> class Calculator { //! c'tor & d'tor public: Calculator(); Calculator(const std::wstring&); ~Calculator(); //! get-/set-methods public: bool set_expression(const std::wstring&); bool set_expression(const std::vector<std::wstring>&); const std::vector<std::wstring>& get_expression(); const double& get_result(); protected: void set_result(const double&); //! methods public: bool calculate(); //! variables private: double result; std::vector<std::wstring> expression; };
calculator.cpp
/** * @version 20080524-testing * @file calc.hpp */ //! Project Includes #include "calculator.hpp" //! c'tor Calculator::Calculator() : result(0.0), expression() { this->set_result(0.0); } //! d'tor Calculator::~Calculator() { //! Clear vars this->set_result(0); this->set_expression(L""); } const std::vector<std::wstring>& Calculator::get_expression() { //! cast to const and return return const_cast<const std::vector<std::wstring>&>(this->expression); } bool Calculator::set_expression(const std::wstring& exp) { //! Check if should be cleared if(exp.compare(L"")) { this->expression.clear(); } //! Check validity //! store return true; } bool Calculator::set_expression(const std::vector<std::wstring>& exp) { //! Check validity //! store this->expression = const_cast< std::vector<std::wstring>& >(exp); return true; } const double& Calculator::get_result() { //! cast to const and return return const_cast<const double&>(this->result); } void Calculator::set_result(const double& res) { //! cast to const and return this->result = const_cast<double&>(res); } bool Calculator::calculate() { return true; }
Binary Symbols
shade@bumbleblee ~/code/projects $ nm aufgabe-eli/calc 0804cf08 d _DYNAMIC 0804cff4 d _GLOBAL_OFFSET_TABLE_ 08048f90 t _GLOBAL__I_main 0804ab1c R _IO_stdin_used w _Jv_RegisterClasses U _Unwind_Resume@@GCC_3.0 08048f50 t _Z41__static_initialization_and_destruction_0ii 08049dc4 T _ZN10Calculator10get_resultEv 08049dcc T _ZN10Calculator10set_resultERKd 08049db8 T _ZN10Calculator14get_expressionEv 08049fb8 T _ZN10Calculator14set_expressionERKSbIwSt11char_traitsIwESaIwEE 08049f96 T _ZN10Calculator14set_expressionERKSt6vectorISbIwSt11char_traitsIwESaIwEESaIS4_EE 08049ddc T _ZN10Calculator9calculateEv 08049ef2 T _ZN10CalculatorC1Ev 08049f44 T _ZN10CalculatorC2Ev 08049ff0 T _ZN10CalculatorD1Ev 0804a0c8 T _ZN10CalculatorD2Ev 0804987a W _ZN9__gnu_cxx13new_allocatorISbIwSt11char_traitsIwESaIwEEE10deallocateEPS4_j 0804981e W _ZN9__gnu_cxx13new_allocatorISbIwSt11char_traitsIwESaIwEEE8allocateEjPKv 0804968a W _ZN9__gnu_cxx13new_allocatorISbIwSt11char_traitsIwESaIwEEE9constructEPS4_RKS4_ 0804940e W _ZN9__gnu_cxx13new_allocatorISbIwSt11char_traitsIwESaIwEEEC2ERKS5_ 080493c6 W _ZN9__gnu_cxx13new_allocatorISbIwSt11char_traitsIwESaIwEEEC2Ev 080493e0 W _ZN9__gnu_cxx13new_allocatorISbIwSt11char_traitsIwESaIwEEED2Ev 0804a1bc W _ZN9__gnu_cxx17__normal_iteratorIPKSbIwSt11char_traitsIwESaIwEESt6vectorIS4_SaIS4_EEEC1ERKS6_ 0804a3d4 W _ZN9__gnu_cxx17__normal_iteratorIPKSbIwSt11char_traitsIwESaIwEESt6vectorIS4_SaIS4_EEEppEv 080494fe W _ZN9__gnu_cxx17__normal_iteratorIPSbIwSt11char_traitsIwESaIwEESt6vectorIS4_SaIS4_EEEC1ERKS5_ 0804a314 W _ZN9__gnu_cxx17__normal_iteratorIPSbIwSt11char_traitsIwESaIwEESt6vectorIS4_SaIS4_EEEppEv 0804a3a4 W _ZN9__gnu_cxxneIPKSbIwSt11char_traitsIwESaIwEESt6vectorIS4_SaIS4_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_ 0804a2e4 W _ZN9__gnu_cxxneIPSbIwSt11char_traitsIwESaIwEESt6vectorIS4_SaIS4_EEEEbRKNS_17__normal_iteratorIT_T0_EESE_ 0804953c W _ZNK9__gnu_cxx13new_allocatorISbIwSt11char_traitsIwESaIwEEE8max_sizeEv 0804a248 W _ZNK9__gnu_cxx17__normal_iteratorIPKSbIwSt11char_traitsIwESaIwEESt6vectorIS4_SaIS4_EEE4baseEv 0804a3ea W _ZNK9__gnu_cxx17__normal_iteratorIPKSbIwSt11char_traitsIwESaIwEESt6vectorIS4_SaIS4_EEEdeEv 080494d0 W _ZNK9__gnu_cxx17__normal_iteratorIPSbIwSt11char_traitsIwESaIwEESt6vectorIS4_SaIS4_EEE4baseEv 080494d8 W _ZNK9__gnu_cxx17__normal_iteratorIPSbIwSt11char_traitsIwESaIwEESt6vectorIS4_SaIS4_EEEdeEv U _ZNKSbIwSt11char_traitsIwESaIwEE7compareEPKw@@GLIBCXX_3.4 U _ZNKSs4sizeEv@@GLIBCXX_3.4 U _ZNKSsixEj@@GLIBCXX_3.4 08049534 W _ZNKSt12_Vector_baseISbIwSt11char_traitsIwESaIwEESaIS3_EE19_M_get_Tp_allocatorEv 0804a1cc W _ZNKSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EE3endEv 080494e2 W _ZNKSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EE4sizeEv 0804a1f8 W _ZNKSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EE5beginEv 0804a1a0 W _ZNKSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EE8capacityEv 08049546 W _ZNKSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EE8max_sizeEv 0804942e W _ZNSaISbIwSt11char_traitsIwESaIwEEEC1ERKS3_ 080493cc W _ZNSaISbIwSt11char_traitsIwESaIwEEEC1Ev 08049414 W _ZNSaISbIwSt11char_traitsIwESaIwEEEC2ERKS3_ 080493e6 W _ZNSaISbIwSt11char_traitsIwESaIwEEED1Ev 080493fa W _ZNSaISbIwSt11char_traitsIwESaIwEEED2Ev U _ZNSaIwEC1Ev@@GLIBCXX_3.4 U _ZNSaIwED1Ev@@GLIBCXX_3.4 U _ZNSbIwSt11char_traitsIwESaIwEE5clearEv@@GLIBCXX_3.4 U _ZNSbIwSt11char_traitsIwESaIwEEC1EPKwRKS1_@@GLIBCXX_3.4 U _ZNSbIwSt11char_traitsIwESaIwEEC1ERKS2_@@GLIBCXX_3.4 U _ZNSbIwSt11char_traitsIwESaIwEEC1Ev@@GLIBCXX_3.4 U _ZNSbIwSt11char_traitsIwESaIwEED1Ev@@GLIBCXX_3.4 U _ZNSbIwSt11char_traitsIwESaIwEEaSERKS2_@@GLIBCXX_3.4 U _ZNSbIwSt11char_traitsIwESaIwEEaSEw@@GLIBCXX_3.4 08049856 W _ZNSt12_Vector_baseISbIwSt11char_traitsIwESaIwEESaIS3_EE11_M_allocateEj 08049464 W _ZNSt12_Vector_baseISbIwSt11char_traitsIwESaIwEESaIS3_EE12_Vector_implC1ERKS4_ 08049448 W _ZNSt12_Vector_baseISbIwSt11char_traitsIwESaIwEESaIS3_EE12_Vector_implD1Ev 0804988e W _ZNSt12_Vector_baseISbIwSt11char_traitsIwESaIwEESaIS3_EE13_M_deallocateEPS3_j 0804945c W _ZNSt12_Vector_baseISbIwSt11char_traitsIwESaIwEESaIS3_EE19_M_get_Tp_allocatorEv 0804949c W _ZNSt12_Vector_baseISbIwSt11char_traitsIwESaIwEESaIS3_EEC2ERKS4_ 08049cd8 W _ZNSt12_Vector_baseISbIwSt11char_traitsIwESaIwEESaIS3_EED2Ev 0804a566 W _ZNSt13__copy_normalILb0ELb0EE8__copy_nIPSbIwSt11char_traitsIwESaIwEES6_EET0_T_S8_S7_ 0804a45e W _ZNSt13__copy_normalILb1ELb1EE8__copy_nIN9__gnu_cxx17__normal_iteratorIPKSbIwSt11char_traitsIwESaIwEESt6vectorIS7_SaIS7_EEEENS3_IPS7_SC_EEEET0_T_SH_SG_ U _ZNSt13basic_ostreamIwSt11char_traitsIwEE5flushEv@@GLIBCXX_3.4 U _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEPFRS2_S3_E@@GLIBCXX_3.4 080495d4 W _ZNSt15__copy_backwardILb0ESt26random_access_iterator_tagE8__copy_bIPSbIwSt11char_traitsIwESaIwEES7_EET0_T_S9_S8_ 0804963e W _ZNSt22__copy_backward_normalILb0ELb0EE10__copy_b_nIPSbIwSt11char_traitsIwESaIwEES6_EET0_T_S8_S7_ 0804a3f4 W _ZNSt6__copyILb0ESt26random_access_iterator_tagE4copyIPKSbIwSt11char_traitsIwESaIwEEPS6_EET0_T_SB_SA_ 0804a4fc W _ZNSt6__copyILb0ESt26random_access_iterator_tagE4copyIPSbIwSt11char_traitsIwESaIwEES7_EET0_T_S9_S8_ 080498b8 W _ZNSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS3_S5_EERKS3_ 0804a250 W _ZNSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EE15_M_erase_at_endEPS3_ 0804a69c W _ZNSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EE20_M_allocate_and_copyIN9__gnu_cxx17__normal_iteratorIPKS3_S5_EEEEPS3_jT_SD_ 0804950e W _ZNSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EE3endEv 0804a224 W _ZNSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EE5beginEv 0804a2c8 W _ZNSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EE5clearEv 08049c62 W _ZNSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EE9push_backERKS3_ 080494b6 W _ZNSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EEC1ERKS4_ 08049d1c W _ZNSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EED1Ev 0804a764 W _ZNSt6vectorISbIwSt11char_traitsIwESaIwEESaIS3_EEaSERKS5_ U _ZNSt8ios_base4InitC1Ev@@GLIBCXX_3.4 U _ZNSt8ios_base4InitD1Ev@@GLIBCXX_3.4 080496ee W _ZSt10_ConstructISbIwSt11char_traitsIwESaIwEES3_EvPT_RKT0_ 0804a438 W _ZSt10__copy_auxIPKSbIwSt11char_traitsIwESaIwEEPS3_ET0_T_S8_S7_ 0804a540 W _ZSt10__copy_auxIPSbIwSt11char_traitsIwESaIwEES4_ET0_T_S6_S5_ 0804a32a W _ZSt13__destroy_auxIN9__gnu_cxx17__normal_iteratorIPSbIwSt11char_traitsIwESaIwEESt6vectorIS5_SaIS5_EEEEEvT_SB_St12__false_type 08049576 W _ZSt13__destroy_auxIPSbIwSt11char_traitsIwESaIwEEEvT_S5_St12__false_type 08049660 W _ZSt13copy_backwardIPSbIwSt11char_traitsIwESaIwEES4_ET0_T_S6_S5_ U _ZSt17__throw_bad_allocv@@GLIBCXX_3.4 08048e44 t _ZSt17__verify_groupingPKcjRKSs 08049de6 t _ZSt17__verify_groupingPKcjRKSs 0804a650 W _ZSt18uninitialized_copyIN9__gnu_cxx17__normal_iteratorIPKSbIwSt11char_traitsIwESaIwEESt6vectorIS5_SaIS5_EEEEPS5_ET0_T_SE_SD_ 080497d2 W _ZSt18uninitialized_copyIPSbIwSt11char_traitsIwESaIwEES4_ET0_T_S6_S5_ 08049618 W _ZSt19__copy_backward_auxIPSbIwSt11char_traitsIwESaIwEES4_ET0_T_S6_S5_ U _ZSt20__throw_length_errorPKc@@GLIBCXX_3.4 0804a67a W _ZSt22__uninitialized_copy_aIN9__gnu_cxx17__normal_iteratorIPKSbIwSt11char_traitsIwESaIwEESt6vectorIS5_SaIS5_EEEEPS5_S5_ET0_T_SE_SD_SaIT1_E 080497fc W _ZSt22__uninitialized_copy_aIPSbIwSt11char_traitsIwESaIwEES4_S3_ET0_T_S6_S5_SaIT1_E 0804a5b2 W _ZSt24__uninitialized_copy_auxIN9__gnu_cxx17__normal_iteratorIPKSbIwSt11char_traitsIwESaIwEESt6vectorIS5_SaIS5_EEEEPS5_ET0_T_SE_SD_St12__false_type 08049752 W _ZSt24__uninitialized_copy_auxIPSbIwSt11char_traitsIwESaIwEES4_ET0_T_S6_S5_St12__false_type 0804939e W _ZSt3minIjERKT_S2_S2_ 0804a4c0 W _ZSt4copyIN9__gnu_cxx17__normal_iteratorIPKSbIwSt11char_traitsIwESaIwEESt6vectorIS5_SaIS5_EEEENS1_IPS5_SA_EEET0_T_SF_SE_ 0804a588 W _ZSt4copyIPSbIwSt11char_traitsIwESaIwEES4_ET0_T_S6_S5_ U _ZSt4endlIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_@@GLIBCXX_3.4 0804d0a0 B _ZSt4wcin@@GLIBCXX_3.4 0804d140 B _ZSt5wcout@@GLIBCXX_3.4 0804a368 W _ZSt8_DestroyIN9__gnu_cxx17__normal_iteratorIPSbIwSt11char_traitsIwESaIwEESt6vectorIS5_SaIS5_EEEEEvT_SB_ 0804a38a W _ZSt8_DestroyIN9__gnu_cxx17__normal_iteratorIPSbIwSt11char_traitsIwESaIwEESt6vectorIS5_SaIS5_EEEES5_EvT_SB_SaIT0_E 08049598 W _ZSt8_DestroyIPSbIwSt11char_traitsIwESaIwEEEvT_S5_ 080495ba W _ZSt8_DestroyIPSbIwSt11char_traitsIwESaIwEES3_EvT_S5_SaIT0_E 08049562 W _ZSt8_DestroyISbIwSt11char_traitsIwESaIwEEEvPT_ 0804d1d4 b _ZSt8__ioinit U _ZStlsIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_PKS3_@@GLIBCXX_3.4 U _ZStlsIwSt11char_traitsIwESaIwEERSt13basic_ostreamIT_T0_ES7_RKSbIS4_S5_T1_E@@GLIBCXX_3.4 U _ZStrsIwSt11char_traitsIwESaIwEERSt13basic_istreamIT_T0_ES7_RSbIS4_S5_T1_E@@GLIBCXX_3.4 U _ZdlPv@@GLIBCXX_3.4 08049398 W _ZdlPvS_ U _Znwj@@GLIBCXX_3.4 08049390 W _ZnwjPv 0804d08c A __bss_start U __cxa_atexit@@GLIBC_2.1.3 U __cxa_begin_catch@@CXXABI_1.3 U __cxa_end_catch@@CXXABI_1.3 U __cxa_rethrow@@CXXABI_1.3 0804d080 D __data_start 0804d084 D __dso_handle w __gmon_start__ U __gxx_personality_v0@@CXXABI_1.3 0804aaca T __i686.get_pc_thunk.bx 0804ceef d __init_array_end 0804ceef d __init_array_start 0804aa60 T __libc_csu_fini 0804aa70 T __libc_csu_init U __libc_start_main@@GLIBC_2.0 08048fac t __tcf_0 0804d08c A _edata 0804d1d8 A _end 0804aafc T _fini 0804ab18 R _fp_hw 08048b6c T _init 08048da0 T _start 0804d080 W data_start 08048fc0 T main
Ich verwende ansonsten Gentoo Linux,
aktuell geupdated ...GCC USE-Flags
[ebuild R ] sys-devel/gcc-4.2.4 USE="fortran gtk mudflap nls openmp (-altivec) -bootstrap -build -doc -gcj (-hardened) -ip28 -ip32r10k -libffi (-multilib) -multislot (-n32) (-n64) -nocxx -objc -objc++ -objc-gc -test -vanilla" 0 kB
libc USE-Flags
[ebuild R ] sys-libs/glibc-2.6.1 USE="nls -debug -gd -glibc-omitfp (-hardened) (-multilib) -profile (-selinux) -vanilla" 88 kB
Das Problem tritt aber nicht nur hier auf, sondern bei einem einfahcen Hello World Programm. Ich hoffe jemand kann mir helfen, denn Programmieren ist so etwas öde
Ach, und x-bit ist gesetzt und als root kommt die Meldung auch
shade@bumbleblee ~/code/projects $ sudo ./hello sudo: unable to execute ./hello: Keine Berechtigung shade@bumbleblee ~/code/projects $ ls -lasv aufgabe-eli/calc 32 -rwxr-xr-x 1 shade users 29125 25. Mai 12:23 aufgabe-eli/calc shade@bumbleblee ~/code/projects $ ls -lasv hello 8 -rwxr-xr-x 1 shade users 7902 25. Mai 12:41 hello shade@bumbleblee ~/code/projects $ sudo aufgabe-eli/calc sudo: unable to execute aufgabe-eli/calc: Keine Berechtigung
MfG branleb
//! EDIT[solved]
Habs gelöst.
in der /etc/fstab war noexec unter den mount optionen drin ...
-
chmod +x calc
?
/EDIT: grml, erst mal das Posting zuende lesen. Sorry.