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

Missing C library function __builtin_rotateleft32

wclodius
Beginner
765 Views

The following C file test_rotl.c


#include <stdint.h>
#include <string.h>

#if defined(__has_builtin)
# if __has_builtin(__builtin_rotateleft32)
# define NMH_rotl32 __builtin_rotateleft32 /* clang */
# endif
#endif
#if !defined(NMH_rotl32)
# if defined(_MSC_VER)
/* Note: although _rotl exists for minGW (GCC under windows), performance seems poor */
# define NMH_rotl32(x,r) _rotl(x,r)
# else
# define NMH_rotl32(x,r) (((x) << (r)) | ((x) >> (32 - (r))))
# endif
#endif

int main (void) {
int32_t number = 1;
printf("%d", NMH_rotl32(number, 16));
}

 

when compiled and linked by icc

icc test_rotl.c -o test_rotl.exe

 

yields the error message

 

Undefined symbols for architecture x86_64:

  "___builtin_rotateleft32", referenced from:

      _main in iccFqDwPl.o

ld: symbol(s) not found for architecture x86_64

 

whichI believe implies that the icc header files tell the preprocessor that ___builtin_rotateleft32 exists, but the linker cannot find the procedure in the libraries.

 

FWIW

icc --version                   

icc (ICC) 2021.2.0 20210228

Copyright (C) 1985-2021 Intel Corporation.  All rights reserved.

0 Kudos
1 Solution
DitiD_Intel
Moderator
740 Views

Hi,

 

Thank you for posting in Intel Communities.

 

We've tried compiling the code with latest version of icc compiler(2021.4) at our end, and it's working fine.

 

We recommend that you compile the code with the latest version of icc compiler (2021.4).

 

Please do let us know if you still face any issues.

 

Thanks and Regards,

Ditipriya.

 

View solution in original post

0 Kudos
2 Replies
DitiD_Intel
Moderator
741 Views

Hi,

 

Thank you for posting in Intel Communities.

 

We've tried compiling the code with latest version of icc compiler(2021.4) at our end, and it's working fine.

 

We recommend that you compile the code with the latest version of icc compiler (2021.4).

 

Please do let us know if you still face any issues.

 

Thanks and Regards,

Ditipriya.

 

0 Kudos
DitiD_Intel
Moderator
699 Views

Hi, 


Thanks for accepting our solution. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks and Regards,

Ditipriya.


0 Kudos
Reply