Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7954 Discussions

Error while compiling simple hello world program

padlar
Beginner
719 Views

I am using intel c compiler for the fist time and I cant get past compiling a "hello world" program.

$ uname -a

Linux padlar123 3.0.0-12-generic-pae #20-Ubuntu SMP Fri Oct 7 16:37:17 UTC 2011 i686 i686 i386 GNU/Linux

$ icc -v hello.c

icc version 12.1.0 (gcc version 4.6.0 compatibility)

/opt/intel/composer_xe_2011_sp1.7.256/bin/ia32/mcpcom -_g -mP3OPT_inline_alloca -D__HONOR_STD -D__ICC=1210 -D__INTEL_COMPILER=1210 "-_Acpu(i386)" "-_Amachine(i386)" -D__PTRDIFF_TYPE__=int -D__SIZE_TYPE__=unsigned "-D__WCHAR_TYPE__=long int" "-D__WINT_TYPE__=unsigned int" "-D__INTMAX_TYPE__=long long int" "-D__UINTMAX_TYPE__=long long unsigned int" -D__QMSPP_ -D__OPTIMIZE__ -D__NO_MATH_INLINES -D__NO_STRING_INLINES -D__NO_INLINE__ -D__GNUC_GNU_INLINE__ -D__GNUC__=4 -D__GNUC_MINOR__=6 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=1002 "-D__USER_LABEL_PREFIX__= " -D__REGISTER_PREFIX__= -D__INTEL_RTTI__ -D__unix__ -D__unix -D__linux__ -D__linux -D__gnu_linux__ -B -Dunix -Dlinux "-_Asystem(unix)" -D__ELF__ -D__i386 -D__i386__ -Di386 -D__INTEL_COMPILER_BUILD_DATE=20111011 -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ -D__pentium4 -D__pentium4__ -D__tune_pentium4__ -D__SSE2__ -D__SSE__ -D__MMX__ -_3 -_b --gnu_version=460 -_W7 --gcc-extern-inline --multibyte_chars --array_section --simd --simd_func -mP1OPT_version=Mainline-ia32 -mGLOB_diag_file=/tmp/iccT9HoUx.diag -mP1OPT_print_version=FALSE -mCG_use_gas_got_workaround=F -mGLOB_gcc_version=460 "-mGLOB_options_string=-long_double -v" -mGLOB_cxx_limited_range=FALSE -mGLOB_as_output_backup_file_name=/tmp/iccGg5aHoas_.s -mIPOPT_activate -mIPOPT_lite -mGLOB_machine_model=GLOB_MACHINE_MODEL_PW -mGLOB_product_id_code=0x21006d76 -mCG_bnl_movbe=T -mGLOB_extended_instructions=0x8 -mP3OPT_use_mspp_call_convention -mP2OPT_il0_array_sections=TRUE -mP2OPT_hlo_level=2 -mP2OPT_hlo -mP2OPT_hpo_rtt_control=0 -mGLOB_imf_mapping_library=/opt/intel/composer_xe_2011_sp1.7.256/bin/ia32/libiml_attr.so -mIPOPT_obj_output_file_name=/tmp/iccT9HoUx.o -mGLOB_linker_version=2.21.53.20110810 -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS -mGLOB_obj_output_file=/tmp/iccT9HoUx.o -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_C -mP1OPT_source_file_name=hello.c hello.c

#include "..." search starts here:

#include <...> search starts here:

/opt/intel/composer_xe_2011_sp1.7.256/compiler/include/ia32

/opt/intel/composer_xe_2011_sp1.7.256/compiler/include

/usr/local/include

/usr/lib/gcc/i686-linux-gnu/4.6.1/include

/usr/lib/gcc/i686-linux-gnu/4.6.1/include-fixed

/usr/include

End of search list.

/usr/include/gnu/stubs.h(7): catastrophic error: cannot open source file "gnu/stubs-32.h"

# include

^

compilation aborted for hello.c (code 4)

Can somebody help me why it is looking for stubs-32.h when I am compiling the program on a 32-bit OS?

0 Kudos
6 Replies
Om_S_Intel
Employee
719 Views
Could you try using gcc 4.5.x development environment with icc 12.1?
0 Kudos
Brandon_H_Intel
Employee
719 Views
What version of Ubuntu are you using? It's possible you may need to update to get the latest support if you're using a recent version.
0 Kudos
SergeyKostrov
Valued Contributor II
719 Views
A C/C++ compilerneeds some declarations, macros, defines, etc. All these things are declared in different header files ( in some libraries or SDKs )and 'stubs-32.h'is one of them. There is nothing wrong with it and this is how things are orginized in 16-bit, 32-bit or 64-bit compilers.

The error message '...cannot open source file...'clearly tells you that there is a problem with a path, or a relative path to 'stubs-32.h' header file.
0 Kudos
Om_S_Intel
Employee
719 Views

It would be nice if you can attach the test case?

Om

0 Kudos
sandroacoelho
Beginner
719 Views
If you use -v option when you compile, you can see a lot of information about the icc proccess. Check out the follow information :

#include <...> search starts here:
/opt/intel/composerxe-2011.0.084/mkl/include
/opt/intel/composerxe-2011.0.084/compiler/include/ia32
/opt/intel/composerxe-2011.0.084/compiler/include
/usr/local/include
/usr/include
/usr/lib/gcc/i686-linux-gnu/4.6.1/include

ICC is trying to find all include files in some specific paths, like /usr/include/gnu/ . I solved my problem copying stubs-32.h file that has stored from /usr/include/i386-linux-gnu/gnu to /usr/include/gnu/ . I think it isn't the elegant solution, but solved my problem


Best regards

0 Kudos
jimdempseyatthecove
Honored Contributor III
719 Views
You should consider adding

/usr/include/i386-linux-gnu/gnu

to your include folders.
0 Kudos
Reply