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

create_app crashes with 'Error: export ordinal too large: 73406' on Julia v1.10-rc1 #892

Open
dustyirwin opened this issue Nov 12, 2023 · 6 comments

Comments

@dustyirwin
Copy link

dustyirwin commented Nov 12, 2023

Hello, I am experiencing an error when attempting to run:

create_app("MyProj","MyProjCompiled", precompile_statements_file="precompile.jl", include_lazy_artifacts=false, incremental=false)

which eventually throws the error below on (what appears to be) one of the final steps of the compilation process:

... /.julia/artifacts/fdff308295487f361ef6e8dc2d27f5abe8a6eee9/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: Error: export ordinal too large: 73406 collect2.exe: error: ld returned 1 exit status

I do not get this error when incremental=true and the process completes successfully. After some Googling, it appears this error has something to do with exporting too many symbols for a 32-bit Int. I don't know if this is related, but I was not getting this error before installing MSYS2 and Glade3 for Windows for some Gtk development related to this project....

Any ideas?

Julia Version 1.10.0-rc1
Commit 5aaa948543 (2023-11-03 07:44 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 12 × Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 1 on 12 virtual cores

@PallHaraldsson
Copy link
Contributor

it appears this error has something to do with exporting too many symbols for a 32-bit Int.

I'm not sure, the number 73406 obviously may come from Int32 or Int64, possibly more likely, but will not fit into UInt16:

https://stackoverflow.com/questions/47135973/error-export-ordinal-too-large-104116

The maximum ordinal number is defined by the Microsoft PE and COFF format. It is a 16-bit integer with a maximum of 65535.

I don't know the workaround here, other than incremental=true. At least that always works until you have a really huge project? I think it's simply not possible to make huge EXE files, i.e. with many methods, then you need to split projects up into DLLs. etc.

I think it's just an inherent limitation of Windows .exe programs, and I'm not sure if there's a similar limitation for other platforms e.g. Linux too, ELF format. You could try to compile a Linux program, and those actually work in Windows under WSL2...

@dustyirwin
Copy link
Author

dustyirwin commented Nov 21, 2023

Thanks for your response--UInt16 makes more sense :)

I'm targeting Windows for distribution since this is a gaming project using SimpleDirectMediaLayer.jl, but I may try compiling on Linux as a test. For the time being, I'll try trimming out any libs that aren't absolutely necessary.

@sairus7
Copy link

sairus7 commented Jun 17, 2024

I have the same issue here trying to compile an app for Windows with CImGui and ImPlot deps. Didn't check if it compiles in previous versions.

@gbaraldi
Copy link
Member

gbaraldi commented Jun 26, 2024

Could you try on 1.11, I'm curious if it makes a difference. There were some changes in and around this. You will also need a very new C compiler/binutils.

@sairus7
Copy link

sairus7 commented Jun 26, 2024

What should I do for this test? Should I just add Julia 1.11-beta and update env with PackageCompiler? I'm confused with "very new C compiler/binutils" - what does that mean? Aren't all compilers already included in Julia binaries?

@gbaraldi
Copy link
Member

gbaraldi commented Jun 26, 2024

Yeah so first thing I would do is the same workflow you were doing and hitting the error and do it with julia 1.11-beta. Though I think the compiler that PackageCompiler ships with windows is likely too old.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants