VerifiableRobotics / slugs

SmalL bUt Complete GROne Synthesizer
Other
37 stars 25 forks source link

Building slugs on m1 mac osx #23

Closed shawnxinyaoz closed 1 year ago

shawnxinyaoz commented 1 year ago

Dear maintainer,

Thank you for making this tool. I'm trying to use this on m1 mac osx and got this error after hitting "make":

Undefined symbols for architecture arm64: "ZNKSt3112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4findEcm", referenced from: ZN24XAnalyzeInitialPositionsI10GR1ContextLb1EE18printLargePreCubesE5BFBddS2_ in main.o _ZN24XAnalyzeInitialPositionsI10GR1ContextLb0EE18printLargePreCubesE5BFBddS2 in main.o ZN30XAbstractWinningTraceGeneratorI10GR1ContextE7executeEv in main.o ZN33XComputeInterestingRunOfTheSystemI10GR1ContextE10computeRunEv in main.o "ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEmmPKcm", referenced from: _main in main.o __ZN24XExtractExplicitStrategyI18XRoboticsSemanticsI7XIROSFSI10GR1ContextEELb1ELb1EE7executeEv in main.o ...

The list is long...

and at the end: NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. ld: symbol(s) not found for architecture arm64 collect2: error: ld returned 1 exit status make: *** [slugs] Error 1

I am not familiar with osx under arm. Is this an error caused by architecture?

Thanks again.

progirep commented 1 year ago

This is an interesting issue. It's not clear to me why it occurs for arm/osx but not for x86/osx (which was tested once upon a time - perhaps that also broke in the meantime).

Unfortunately, I don't have any osx computer to test. But can you please try the following?

In "src/Makefile", there is a line stating:

LINK = g++

Can you change this to?:

LINK = clang++

Since the symbol not found appears to be clang/llvm only (according to my Google search), but this line asks for the GNU linker, I am suspecting that in the GNU version of libc++, this symbol does not exist, and it is only referenced because clang++/llvm is used for compiling the source files. Hence my request.

If that does not work, please paste the complete compilation/linking error here, including the command that was used for trying to build the actual executable (which is the step that appears to fail in your case). Thanks!

shawnxinyaoz commented 1 year ago

I changed the line of the LINK to clang++, and it worked like a charm. Thank you so much for your timely response 🙇‍♂️