-
-
Notifications
You must be signed in to change notification settings - Fork 624
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
Static on macosx #4332
base: master
Are you sure you want to change the base?
Static on macosx #4332
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I see the .dSYM is not created for a
-debug -build-mode:static
, it should be possible right? - It must be possible to set an entry/init section in the static library so the
runtime._startup_runtime()
and similar things can be called
link_command_line = gb_string_appendc(link_command_line, " -Wno-unused-command-line-argument "); | ||
link_command_line = gb_string_append_fmt(link_command_line, " -o \"%.*s\" ", LIT(output_filename)); | ||
|
||
link_command_line = gb_string_appendc(link_command_line, object_files); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you move the object files from before the -o to after it?
@@ -631,7 +627,7 @@ gb_internal i32 linker_stage(LinkerData *gen) { | |||
link_settings = gb_string_append_fmt(link_settings, "-mmacosx-version-min=%.*s ", LIT(build_context.minimum_os_version_string)); | |||
} | |||
|
|||
if (build_context.build_mode != BuildMode_DynamicLibrary) { | |||
if (build_context.build_mode != BuildMode_DynamicLibrary && build_context.build_mode != BuildMode_StaticLibrary) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not look needed? link_settings
isn't used when you do a static library from what I can tell.
static_link_command_line = gb_string_appendc(static_link_command_line, object_files); | ||
return system_exec_command_line_app("libtool", static_link_command_line); | ||
} else { | ||
compiler_error("-build-mode:static on Linux and similar targets"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compiler_error("-build-mode:static on Linux and similar targets"); | |
compiler_error("TODO: -build-mode:static on this target"); |
Looks like I need to call "dsymutil <your_program>" somehow, but it says that the object files don't have debug data. I'll look into it later However I have no problem debugging in my example code, so maybe it isn't a thing for static libraries? |
I have tested that this works with the iPhone simulator
Basically just call "libtool -static" on the object files
An unfortunate thing I have to do when linking to a static odin library, is to call runtime._startup_runtime()