Skip to content

Conversation

@xlxs4
Copy link
Contributor

@xlxs4 xlxs4 commented Nov 2, 2025

To modify the flags passed to the julia and cc compiler invocations by JuliaC, I'm using it programmatically. To modify the arguments passed to julia I can use julia_args. If I use the JuliaC binary (juliac) I can pass arguments passed to julia using the -- separator. To modify the compile command (both the compiler used and the flags passed to it) I'm using JULIA_CC.

I'd like to be able to decouple specifying the cc compiler from specifying user-supplied flags passed to the compiler, so that I can pass any flags I want while also taking advantage of the auto compiler discovery logic in get_compiler_cmd

# ...
link = LinkRecipe(
    image_recipe = img,
    outname = "libmylib",
    rpath = nothing, # set automatically when bundling
    cc_flags = ["-O2"]
)
# ...

@xlxs4
Copy link
Contributor Author

xlxs4 commented Nov 2, 2025

This would also simplify my building configuration, because I would be able to pass -soname/-install_name directly during linkage, instead of post-build modifications: https://discourse.julialang.org/t/cmake-configuration-for-working-with-juliac-compiled-libraries/133320

@xlxs4
Copy link
Contributor Author

xlxs4 commented Nov 11, 2025

This would also simplify my building configuration, because I would be able to pass -soname/-install_name directly during linkage, instead of post-build modifications: https://discourse.julialang.org/t/cmake-configuration-for-working-with-juliac-compiled-libraries/133320

E: #74

src/JuliaC.jl Outdated
image_recipe::ImageRecipe = ImageRecipe()
outname::String = ""
rpath::Union{String, Nothing} = nothing
cc_flags::Vector{String} = String[]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are technically link flags so I would name something like ld_flags. Specially since the image recipe already has flags

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbaraldi
Copy link
Member

I know cc_flags isn't super well tested but could you add a test to this?

@xlxs4 xlxs4 force-pushed the xl/cc-flags branch 3 times, most recently from d3c5ddd to 8ce9e07 Compare November 30, 2025 15:56
@xlxs4
Copy link
Contributor Author

xlxs4 commented Nov 30, 2025

Wasn't really sure what to test for, you could also just check the output from --verbose instead

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

Successfully merging this pull request may close these issues.

2 participants