Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting unknown mnemonic error for aarch64 #820

Closed
dextran52 opened this issue Aug 20, 2018 · 2 comments
Closed

Getting unknown mnemonic error for aarch64 #820

dextran52 opened this issue Aug 20, 2018 · 2 comments
Assignees
Labels
Cross Compilation Cross compiling (e.g. aarch64) Help Needed Modeling/Usage problem
Projects
Milestone

Comments

@dextran52
Copy link

dextran52 commented Aug 20, 2018

Hello,

While compiling ortools for aarch64 i am getting below assembler error:

/tmp/ccgHyQUs.s: Assembler messages:
/tmp/ccgHyQUs.s:1478: Error: unknown mnemonic `addq' -- `addq x2,x0'
/tmp/ccgHyQUs.s:1479: Error: unknown mnemonic `cmovoq' -- `cmovoq x1,x0'

This may be because aarch64 does not support apple like syntax. But what can i do to resolve this error i don't know. Is there any hack available? and if i need to change code than where to change?
Please help!
error_ortools.txt

@Mizux Mizux added Help Needed Modeling/Usage problem Cross Compilation Cross compiling (e.g. aarch64) labels Aug 20, 2018
@Mizux
Copy link
Collaborator

Mizux commented Aug 20, 2018

I guess the problem come from this line:

#if defined(__GNUC__) && defined(ARCH_K8)
// TODO(user): port this to other architectures.
inline int64 CapAddFast(int64 x, int64 y) {
const int64 cap = CapWithSignOf(x);
int64 result = x;
// clang-format off
asm volatile( // 'volatile': ask compiler optimizer "keep as is".
"\t" "addq %[y],%[result]"
"\n\t" "cmovoq %[cap],%[result]" // Conditional move if overflow.

and its use in
inline int64 CapAdd(int64 x, int64 y) {
#if defined(__GNUC__) && defined(ARCH_K8)
return CapAddFast(x, y);
#else
return CapAddGeneric(x, y);
#endif

Few things:

  • You should modify base/integral_types.h so ARCH_K8 is not defined:
    // Detect 64 bit.
    #undef ARCH_K8
    #if defined(_MSC_VER) && defined(_WIN64)
    #define ARCH_K8
    #elif defined(__APPLE__) && defined(__GNUC__)
    #define ARCH_K8 // We only support 64 bit on Mac OS X.
    #elif defined(__GNUC__) && defined(__LP64__) // Linux
    #define ARCH_K8
    #endif
// Detect 64 bit.
#undef ARCH_K8
#if defined(_MSC_VER) && defined(_WIN64)
#define ARCH_K8
#elif defined(__APPLE__) && defined(__GNUC__)
#define ARCH_K8  // We only support 64 bit on Mac OS X.
#elif defined(__GNUC__) && defined(__LP64__) && !defined(__aarch64__) // Linux
#define ARCH_K8
#endif

note: You can also try https://github.com/google/snappy/blob/master/snappy-stubs-internal.h#L70

@dextran52
Copy link
Author

It worked Thank you very much!!

@Mizux Mizux added this to ToDo in Kanban v6.9 via automation Aug 20, 2018
@Mizux Mizux added this to the v6.9 milestone Aug 20, 2018
@Mizux Mizux moved this from ToDo to Done in Kanban v6.9 Aug 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cross Compilation Cross compiling (e.g. aarch64) Help Needed Modeling/Usage problem
Projects
No open projects
Kanban v6.9
  
Done
Development

No branches or pull requests

3 participants