Skip to content

Fix compile error with ldc-1.40.0 on OSX#14

Merged
elementgreen merged 1 commit intoKymorphia:mainfrom
gizmomogwai:main
Mar 2, 2025
Merged

Fix compile error with ldc-1.40.0 on OSX#14
elementgreen merged 1 commit intoKymorphia:mainfrom
gizmomogwai:main

Conversation

@gizmomogwai
Copy link
Copy Markdown
Contributor

No description provided.

@dejlek
Copy link
Copy Markdown
Contributor

dejlek commented Mar 2, 2025

I do not have ldc 1.40 here so will soon have an lxc container with latest Fedora to test this PR...

@dejlek
Copy link
Copy Markdown
Contributor

dejlek commented Mar 2, 2025

I've tested this PR on a Fedora 41 LXC container with manually built LDC 1.40. It works as expected. No issues.
However I have no issues with building current main branch with LDC 1.40, so could it be that you have this issue on OSX? If so could you put that in your PR next time, so people do not waste time testing on wrong OS. :)
PS. current main also builds with DMD v2.110.0-rc.1 on Fedora Linux.

So what is really the issue, and on which OS?

@elementgreen
Copy link
Copy Markdown
Contributor

@gizmomogwai It seems like there shouldn't be an issue with assigning to the lib foreach variable. As @dejlek mentioned, it sounds like you have OSX, based on the PR changes you proposed. You are the first person to test giD on OSX, which is great!

I do see an existing bug with the line of code you proposed to change though. I think instead of this:

version (OSX) lib = lib.buildPath(basePath, lib);

It should be this:

version (OSX) lib = buildPath(basePath, lib);

Could you try that and provide more details if you are still getting a compilation error?

@gizmomogwai
Copy link
Copy Markdown
Contributor Author

my apologies, was not the best pull request i have to admit.

the error i am encountering (e.g. when running dub run gid-gtk4-examples) is:

../../../../../.dub/packages/gid/0.9.3/gid/packages/glib2/gid/loader.d(144,21): Error: cannot modify `immutable` expression `lib`

when running / compiling from sha c34a5b7 on OSX (as you suspected).

@gizmomogwai gizmomogwai changed the title Fix compile error with ldc-1.40.0 Fix compile error with ldc-1.40.0 on OSX Mar 2, 2025
@gizmomogwai
Copy link
Copy Markdown
Contributor Author

not sure why dub run fetches that latest sha instead of the last tag for me though.

@gizmomogwai
Copy link
Copy Markdown
Contributor Author

sorry @elementgreen i get the same compilation error with your proposal:

../../../../../.dub/packages/gid/0.9.3/gid/packages/glib2/gid/loader.d(144,21): Error: cannot modify `immutable` expression `lib`

@gizmomogwai
Copy link
Copy Markdown
Contributor Author

one additional thing that i can recommend is to use the install.sh of dlang.org to put several versions of the compiler to ~/dlang ... no need for any containers or anything. still would not expose the problem, as the assignment is only done for osx. one way to reproduce it is to just assign another string to lib for every version. e.g. lib = "examplestring";

@elementgreen
Copy link
Copy Markdown
Contributor

elementgreen commented Mar 2, 2025

Thanks for posting the compiler error message. I can now see what the issue is. libs is an immutable array of strings, so lib would thus be immutable. Can you update your PR to include the fix to the lib assignment as well? As it is, it would end up building a path that is lib/basePath/lib which would of course be incorrect.

@dejlek
Copy link
Copy Markdown
Contributor

dejlek commented Mar 2, 2025

I am indeed happy to see an OSX user giving giddy a try. Please either file issues that you encounter, here, or ask any questions on our forum.

@gizmomogwai
Copy link
Copy Markdown
Contributor Author

actually i am quite happy to see this just working gtk binding. cross platform uis is one of the areas where dlang especially does not shine.

i hope the change is now as you would expect it to be, interestingly i printed the old and new values (in case of osx now, and for me they are all the same, so i wonder if that is required at all or for which special case this is required). i also now tried to remove the version osx line completely and that works for me. i do have a little strange setup, that i have to set DYLD_LIBRARY_PATH to my homebrew folder for gtk4 libs though (e.g. env DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH dub run for running in the example git folder).

@dejlek
Copy link
Copy Markdown
Contributor

dejlek commented Mar 2, 2025

This change builds successfully on Fedora with gdc, ldc and dmd so I am fine with merging this as long as @gizmomogwai is happy with it on OSX.

@elementgreen elementgreen merged commit 954f92f into Kymorphia:main Mar 2, 2025
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.

3 participants