Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Problems using std::bind with icc/icpc 14.0.2 and gcc 4.8

$
0
0

I have had a some problems in the past using icc/icpc with gcc 4.8 as described here. It appears that the problem has been partially fixed with the release of 14.0.2 however I am still having problems with std::bind and as a result am unable to compile code that is using a Boost library. This problem has also been reported here. I am running 64-bit Xubuntu 13.10 but that user is running openSUSE 12.3. As a test case consider the code below:


#include <vector>
#include <iostream>
#include <functional>

class Bar {

public:
  void foo(double x, double y) {
      std::cout << x << std::endl;
      std::cout << y << std::endl;
  }

  void foo2(double x) {
    using namespace std::placeholders;
    auto function = std::bind(&Bar::foo, this, x, _1);
    function(3);
  }

};

int main(int argc, char **argv) {
  Bar bar;
  bar.foo2(3);
}

Compiling with g++ main.cpp -std=c++11 works fine but with icpc main.cpp -std=c++11 I get this error:


icpc main.cpp -std=c++11
main.cpp(16): error: no instance of overloaded function "std::_Bind<_Functor (_Bound_args...)>::operator() [with _Functor=std::_Mem_fn<void (Bar::*)(double, double)>, _Bound_args=<Bar *, double, std::_Placeholder<1>>]" matches the argument list
            argument types are: (int)
            object type is: std::_Bind<std::_Mem_fn<void (Bar::*)(double, double)> (Bar *, double, std::_Placeholder<1>)>
      function(3);
      ^

compilation aborted for main.cpp (code 2)

Running g++ -v gives:


Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.8.1-10ubuntu9' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu9) 

The output of g++ --print-search-dirs is:


install: /usr/lib/gcc/x86_64-linux-gnu/4.8/
programs: =/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/bin/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/bin/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/bin/
libraries: =/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/x86_64-linux-gnu/4.8/:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/x86_64-linux-gnu/:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/../lib/:/opt/intel/composer_xe_2013_sp1.2.144/ipp/../compiler/lib/intel64/x86_64-linux-gnu/4.8/:/opt/intel/composer_xe_2013_sp1.2.144/ipp/../compiler/lib/intel64/x86_64-linux-gnu/:/opt/intel/composer_xe_2013_sp1.2.144/ipp/../compiler/lib/intel64/../lib/:/opt/intel/composer_xe_2013_sp1.2.144/ipp/lib/intel64/x86_64-linux-gnu/4.8/:/opt/intel/composer_xe_2013_sp1.2.144/ipp/lib/intel64/x86_64-linux-gnu/:/opt/intel/composer_xe_2013_sp1.2.144/ipp/lib/intel64/../lib/:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/x86_64-linux-gnu/4.8/:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/x86_64-linux-gnu/:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/../lib/:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/x86_64-linux-gnu/4.8/:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/x86_64-linux-gnu/:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/../lib/:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/x86_64-linux-gnu/4.8/:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/x86_64-linux-gnu/:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/:/lib/x86_64-linux-gnu/4.8/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/4.8/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/:/opt/intel/composer_xe_2013_sp1.2.144/ipp/../compiler/lib/intel64/:/opt/intel/composer_xe_2013_sp1.2.144/ipp/lib/intel64/:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../:/lib/:/usr/lib/

The output of icpc -# main.cpp -std=c++11 is:


/opt/intel/composer_xe_2013_sp1.2.144/bin/intel64/mcpcom  
    -_g 
    -mP3OPT_inline_alloca 
    -D__HONOR_STD 
    -D__ICC=1400 
    -D__INTEL_COMPILER=1400 
    -D__INTEL_COMPILER_UPDATE=2 
    -D__PTRDIFF_TYPE__=long 
    "-D__SIZE_TYPE__=unsigned long" 
    -D__WCHAR_TYPE__=int 
    "-D__WINT_TYPE__=unsigned int""-D__INTMAX_TYPE__=long int""-D__UINTMAX_TYPE__=long unsigned int" 
    -D__INTEL_CXX11_MODE__ 
    -D__LONG_MAX__=9223372036854775807L 
    -D__QMSPP_ 
    -D__OPTIMIZE__ 
    -D__NO_MATH_INLINES 
    -D__NO_STRING_INLINES 
    -D__GNUC_GNU_INLINE__ 
    -D__STRICT_ANSI__ 
    -D__GXX_EXPERIMENTAL_CXX0X__ 
    -D__GNUG__=4 
    -D__GNUC__=4 
    -D__GNUC_MINOR__=8 
    -D__GNUC_PATCHLEVEL__=0 
    -D__LP64__ 
    -D_LP64 
    -D_GNU_SOURCE=1 
    -D__DEPRECATED=1 
    -D__GXX_WEAK__=1 
    -D__GXX_ABI_VERSION=1002 
    "-D__USER_LABEL_PREFIX__= " 
    -D__REGISTER_PREFIX__= 
    -D__INTEL_RTTI__ 
    -D__EXCEPTIONS=1 
    -D__unix__ 
    -D__unix 
    -D__linux__ 
    -D__linux 
    -D__gnu_linux__ 
    -B 
    "-_Asystem(unix)" 
    -D__ELF__ 
    -D__x86_64 
    -D__x86_64__ 
    "-_Acpu(x86_64)""-_Amachine(x86_64)" 
    -D_MT 
    -D__INTEL_COMPILER_BUILD_DATE=20140120 
    -D__INTEL_OFFLOAD 
    -D__i686 
    -D__i686__ 
    -D__pentiumpro 
    -D__pentiumpro__ 
    -D__pentium4 
    -D__pentium4__ 
    -D__tune_pentium4__ 
    -D__SSE2__ 
    -D__SSE__ 
    -D__MMX__ 
    -_k 
    -_8 
    -_l 
    -_a 
    -_b 
    --gnu_version=480 
    -_W5 
    --gcc-extern-inline 
    -p 
    --bool 
    -tused 
    -x 
    --c++0x 
    --multibyte_chars 
    --sys_include 
    /opt/intel/composer_xe_2013_sp1.2.144/ipp/include 
    --sys_include 
    /opt/intel/composer_xe_2013_sp1.2.144/mkl/include 
    --sys_include 
    /opt/intel/composer_xe_2013_sp1.2.144/tbb/include 
    --sys_include 
    /opt/intel/composer_xe_2013_sp1.2.144/compiler/include/intel64 
    --sys_include 
    /opt/intel/composer_xe_2013_sp1.2.144/compiler/include 
    --sys_include 
    /usr/include/c++/4.8 
    --sys_include 
    /usr/include/c++/4.8/backward 
    --sys_include 
    /usr/local/include 
    --sys_include 
    /usr/lib/gcc/x86_64-linux-gnu/4.8/include 
    --sys_include 
    /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed 
    --sys_include 
    /usr/include 
    --sys_include 
    /usr/include/x86_64-linux-gnu 
    --sys_include 
    /usr/include/x86_64-linux-gnu/c++/4.8 
    --array_section 
    --simd 
    --simd_func 
    --offload_mode=1 
    --offload_target_names=mic,MIC 
    --offload_unique_string=icpc118138593XjgDtQ 
    --bool 
    -mP1OPT_version=14.0-intel64 
    -mGLOB_diag_file=/tmp/icpcKkulxP.diag 
    -mP1OPT_print_version=FALSE 
    -mCG_use_gas_got_workaround=F 
    -mP2OPT_align_option_used=TRUE 
    -mGLOB_gcc_version=480 
    "-mGLOB_options_string=-# -std=c++11" 
    -mGLOB_cxx_limited_range=FALSE 
    -mCG_extend_parms=FALSE 
    -mGLOB_compiler_bin_directory=/opt/intel/composer_xe_2013_sp1.2.144/bin/intel64 
    -mGLOB_as_output_backup_file_name=/tmp/icpc5hcQGOas_.s 
    -mIPOPT_activate 
    -mIPOPT_lite 
    -mGLOB_em64t 
    -mGLOB_instruction_tuning=0x0 
    -mGLOB_product_id_code=0x22006d8e 
    -mCG_bnl_movbe=T 
    -mGLOB_extended_instructions=0x8 
    -mP3OPT_use_mspp_call_convention 
    -mPGOPTI_value_profile_use=T 
    -mP2OPT_il0_array_sections=TRUE 
    -mGLOB_offload_mode=1 
    -mP2OPT_offload_unique_var_string=icpc118138593XjgDtQ 
    -mP2OPT_hlo_level=2 
    -mP2OPT_hlo 
    -mP2OPT_hpo_rtt_control=0 
    -mIPOPT_args_in_regs=0 
    -mP2OPT_disam_assume_nonstd_intent_in=FALSE 
    -mGLOB_imf_mapping_library=/opt/intel/composer_xe_2013_sp1.2.144/bin/intel64/libiml_attr.so 
    -mIPOPT_obj_output_file_name=/tmp/icpcKkulxP.o 
    -mIPOPT_whole_archive_fixup_file_name=/tmp/icpcwarchjGt6Z3 
    -mGLOB_linker_version=2.23.52.20130913 
    -mGLOB_long_size_64 
    -mGLOB_routine_pointer_size_64 
    -mGLOB_driver_tempfile_name=/tmp/icpctempfile7JeaDy 
    -mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS 
    -mGLOB_async_unwind_tables=TRUE 
    -mGLOB_obj_output_file=/tmp/icpcKkulxP.o 
    -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_C_PLUS_PLUS 
    -mP1OPT_source_file_name=main.cpp 
    -mGLOB_eh_linux 
    main.cpp

ld  
    /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o 
    /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o 
    /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o 
    --eh-frame-hdr 
    --build-id 
    -dynamic-linker 
    /lib64/ld-linux-x86-64.so.2 
    -o 
    a.out 
    -L/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64 
    -L/opt/intel/composer_xe_2013_sp1.2.144/ipp/../compiler/lib/intel64 
    -L/opt/intel/composer_xe_2013_sp1.2.144/ipp/lib/intel64 
    -L/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64 
    -L/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64 
    -L/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4 
    -L/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64 
    -L/usr/lib/gcc/x86_64-linux-gnu/4.8/ 
    -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/ 
    -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/ 
    -L/lib/x86_64-linux-gnu/ 
    -L/lib/../lib64 
    -L/lib/../lib/ 
    -L/usr/lib/x86_64-linux-gnu/ 
    -L/usr/lib/../lib/ 
    -L/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/ 
    -L/opt/intel/composer_xe_2013_sp1.2.144/ipp/../compiler/lib/intel64/ 
    -L/opt/intel/composer_xe_2013_sp1.2.144/ipp/lib/intel64/ 
    -L/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64/ 
    -L/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/ 
    -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../ 
    -L/lib64 
    -L/lib/ 
    -L/usr/lib 
    -L/usr/lib/i386-linux-gnu 
    /tmp/icpcKkulxP.o 
    -Bdynamic 
    -Bstatic 
    -limf 
    -lsvml 
    -lirng 
    -Bdynamic 
    -lm 
    -Bstatic 
    -lipgo 
    -ldecimal 
    --as-needed 
    -Bdynamic 
    -lcilkrts 
    --no-as-needed 
    -lstdc++ 
    -lgcc 
    -lgcc_s 
    -Bstatic 
    -lirc 
    -lsvml 
    -Bdynamic 
    -lc 
    -lgcc 
    -lgcc_s 
    -Bstatic 
    -lirc_s 
    -Bdynamic 
    -ldl 
    -lc 
    /usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o 
    /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o

rm /tmp/icpclibgccX2vsJ5
rm /tmp/icpcgnudirsi4XLZk
rm /tmp/icpcKkulxP.o
rm /tmp/icpcdummyKovbO4.c
rm /tmp/icpcdashvZPv24j
rm /tmp/icpcgasVnZAnz
rm /tmp/icpc5hcQGOas_.s
rm /tmp/icpcldashvxw7mjj
rm /tmp/icpctempfile7JeaDy
rm /tmp/icpcarg17dlXN
rm /tmp/icpcgnudirsUrl5ex
rm /tmp/icpcgnudirssLDRzM
rm /tmp/icpcgnudirs42r8U1
rm /tmp/icpcldashvEeWTgh
rm /tmp/icpcdummykbcbDw.c
rm /tmp/icpcgccdashvFGLtZL
rm /tmp/icpcgnudirs9E9sm1
rm /tmp/icpcldashvZXBWJg
rm /tmp/icpcgnudirsCUBT7v
rm /tmp/icpcgnudirs0L0dwL
rm /tmp/icpcKkulxP.o

Viewing all articles
Browse latest Browse all 1616

Trending Articles