antlr4 icon indicating copy to clipboard operation
antlr4 copied to clipboard

Dynamic ANTLR C++ library not loaded because searched for (in Mac arm64) in the antlr.org Terence Parr's programs

Open boitet2002 opened this issue 1 year ago • 4 comments
trafficstars

We are developing on 2 Macs under Sequoia and ANTLR4-4.13.2. After migrating one Mac to ARM64, we use the "fat" .dylib (and .a). Compiling our application was OK on both Macs. But link-edit gave problems on the arm64 Mac. We found brew did not generate the fat version.

Then we abandoned brew and downloaded the antlr4-complete.jar and the antlr4-runtime from the antlr.org web site. At that point, the link-edit problem disappeared.

Note that, in our project, the ANTLR libs are renamed (by the way of symbolic links) to include the ANTLR version number (libantlr4-4.13.2.dylib is a link to libantlr4.dylib)

A new problem appears now at execution time, only on the arm64 Mac: the dynamic library does not load properly (see trace below). More precisely, the loader looks for /Users/parrt/antlr/code/antlr4/runtime/Cpp/runtime/libantlr4-runtime.4.13.2.dylib and does not find it (of course).

But why? We certainly don't want our programs to access T. Parr's disks at run time! As the trace shows, our libs are at a correct place on our disks, and have the correct format. What should we do? Or is it a bug?

Thanks for help -- we are on that problem since 1 week. Also, trying to regenerate the entire ANTLR/C++ tool failed (we are not competent enough with the CMake tool).

Thanks in advance,

Ch.Boitet and J.C. Durand

============= trace ===============

  1. trying to execute

...Serveur: lldb serveur.out (lldb) target create "serveur.out" Current executable set to '/Users/boitet/ariane-y/Ariane-Y_prog_2013/Moniteurs/Moniteur-AY/Serveur/serveur.out' (arm64). (lldb) pr la Process 34520 launched: '/Users/boitet/ariane-y/Ariane-Y_prog_2013/Moniteurs/Moniteur-AY/Serveur/serveur.out' (arm64)

dyld[34520]: Library not loaded: /Users/parrt/antlr/code/antlr4/runtime/Cpp/runtime/libantlr4-runtime.4.13.2.dylib Referenced from: <2CF14B04-8497-3164-973F-5F234426ECFC> /Users/Shared/Dev_ex_PC_ou_Linux/Ariane-Y/ariane-y/Ariane-Y_prog_2013/Moniteurs/Moniteur-AY/Serveur/serveur.out

Reason: tried: '/Users/parrt/antlr/code/antlr4/runtime/Cpp/runtime/libantlr4-runtime.4.13.2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/parrt/antlr/code/antlr4/runtime/Cpp/runtime/libantlr4-runtime.4.13.2.dylib' (no such file), '/Users/parrt/antlr/code/antlr4/runtime/Cpp/runtime/libantlr4-runtime.4.13.2.dylib' (no such file) Process 34520 stopped

  • thread #1, stop reason = signal SIGABRT frame #0: 0x00000001988e0628 dyld__abort_with_payload + 8 dyld__abort_with_payload: -> 0x1988e0628 <+8>: b.lo 0x1988e0648 ; <+40> 0x1988e062c <+12>: pacibsp 0x1988e0630 <+16>: stp x29, x30, [sp, #-0x10]! 0x1988e0634 <+20>: mov x29, sp Target 0: (serveur.out) stopped. (lldb) q Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n]
  1. checking the libs

...Serveur: file /usr/local/lib/antlr4-4.13.2/libantlr4-4.13.2.dylib /usr/local/lib/antlr4-4.13.2/libantlr4-4.13.2.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64:Mach-O 64-bit dynamically linked shared library arm64] /usr/local/lib/antlr4-4.13.2/libantlr4-4.13.2.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/local/lib/antlr4-4.13.2/libantlr4-4.13.2.dylib (for architecture arm64): Mach-O 64-bit dynamically linked shared library arm64 ...Serveur: ...Serveur: ...Serveur: pwd /Users/boitet/ariane-y/Ariane-Y_prog_2013/Moniteurs/Moniteur-AY/Serveur

boitet2002 avatar Sep 30 '24 14:09 boitet2002