MobiVM / robovm

Ahead of time compiler for JVM bytecode targetting iOS, Mac OSX and Linux
https://mobivm.github.io
942 stars 132 forks source link

Getting "compact unwind compressed function offset doesn't fit in 24 bits" while compiling with last robovm #750

Closed scooterman closed 9 months ago

scooterman commented 9 months ago

Issue details

I'm trying to compile a project on the latest robovm and got this error. This was not happening on 2.3.19. Let me know if you need any other information. Cleaning the caches and recompiling doesn't fix the issue.

Browsing the internet it seems I need to pass the flag -ld64 or -ld_classic to the linker but I couldn't find a way to do it.

Reproduction steps/code

I can't provide the the code to reproduce it but I can provider further information if needed be.

Configuration

Build Tools:

Versions:

Please provide the version of RoboVM, XCode and JDK used

Build Targets:

Iphone 14 on simulator, regular arm64 build.


Stacktrace

[ERROR] 20:54:03.292 0  0x108910f43  __assert_rtn + 64
[ERROR] 20:54:03.292 1  0x1088b8d4b  void dispatchForEach<mach_o::CompactUnwind::Diff24Fixup const, ld::LayoutExecutable::writeCompactUnwind(std::__1::span<unsigned char, 18446744073709551615ul>, unsigned long long, ld::SectionLayout const&) const::$_26>(std::__1::span<mach_o::CompactUnwind::Diff24Fixup const, 18446744073709551615ul>, unsigned long, ld::LayoutExecutable::writeCompactUnwind(std::__1::span<unsigned char, 18446744073709551615ul>, unsigned long long, ld::SectionLayout const&) const::$_26)::'lambda'(unsigned long)::operator()(unsigned long) const + 347
[ERROR] 20:54:03.292 2  0x7ff819036066  _dispatch_client_callout2 + 8
[ERROR] 20:54:03.292 3  0x7ff81904918f  _dispatch_apply_invoke_and_wait + 213
[ERROR] 20:54:03.292 4  0x7ff819048692  _dispatch_apply_with_attr_f + 1207
[ERROR] 20:54:03.292 5  0x7ff819048847  dispatch_apply + 45
[ERROR] 20:54:03.292 6  0x1088b9116  ld::LayoutExecutable::writeContentWithoutLinkEdit(std::__1::span<unsigned char, 18446744073709551615ul>, unsigned long long) + 950
[ERROR] 20:54:03.292 7  0x1088c09fa  ld::LayoutExecutable::writeToFile(char const*) + 21546
[ERROR] 20:54:03.292 8  0x10885ff9f  main + 12831
[ERROR] 20:54:03.292 ld: Assertion failed: (false && "compact unwind compressed function offset doesn't fit in 24 bits"), function operator(), file Layout.cpp, line 5758.
[ERROR] 20:54:03.332 clang: error: linker command failed with exit code 1 (use -v to see invocation)
[ERROR] Couldn't compile app
dkimitsa commented 9 months ago

it seems to be Xcode 15 issue. Add following to robovm.xml

<tools>
        <linker>
            <flags>
                <flag>-ld_classic</flag>
            </flags>
        </linker>
    </tools>
scooterman commented 9 months ago

Hello @dkimitsa,

Thank you, adding the link flag worked.

ImUrX commented 9 months ago

For posterity's sake, Go had some info about it

dkimitsa commented 9 months ago

this seems to be xcode issue, here is a discussion

ollyde commented 8 months ago
-ld_classic

My robovm.xml looks like this; where is it supposed to go? @dkimitsa

Screenshot 2023-10-31 at 14 11 17
lmythz commented 8 months ago

This worked for me, Thanks dkimitsa my robovm.xml

<config>
   ... 
  <tools>
    <linker>
      <flags>
        <flag>-ld_classic</flag>
      </flags>
    </linker>
  </tools>
</config>