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

Using compile cache can break linking certain library builds #1180

Open
tobil4sk opened this issue Jan 23, 2025 · 1 comment
Open

Using compile cache can break linking certain library builds #1180

tobil4sk opened this issue Jan 23, 2025 · 1 comment

Comments

@tobil4sk
Copy link
Member

When compiling a Build.xml like this, the build fails on mac while linking the default target with HXCPP_COMPILE_CACHE enabled:

<xml>
	<files id="lib">
		<cache value="true" asLibrary="true" />
		<file name="lib.c" />
	</files>

	<target id="default" output="lib${DBG}" tool="linker" toolid="static_link">
		<files id="lib" />
	</target>
</xml>
fatal error: /Applications/Xcode_15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file list file: obj/darwin64/all_objs is empty

The problem is that the lib files are cached by hxcpp in a static library, and apart from that there are no object files. This means there is an empty all_objs file generated, which libtool doesn't seem to like. On other platforms (with different static linking tools) this is not an issue.

@tobil4sk
Copy link
Member Author

Similarly, this example breaks dynamic library builds with the compile cache on windows:

<xml>

	<files id="lib">
		<cache value="true" asLibrary="true" />
		<file name="lib.c" />
	</files>

	<target id="default" output="lib${DBG}" tool="linker" toolid="dll">
		<files id="lib" />
	</target>

</xml>
Link: lib.dll
LINK : warning LNK4001: no object files specified; libraries used
LINK : error LNK2001: unresolved external symbol _DllMainCRTStartup
obj\lib\lib.dll : fatal error LNK1120: 1 unresolved externals

#1184 will solve the LNK4001 warning as well as the mac libtool error. However, for the dll linking problem, I'm not sure what the solution would be.

@tobil4sk tobil4sk changed the title Using compile cache can break static library builds on mac Using compile cache can break linking certain library builds Jan 31, 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

No branches or pull requests

1 participant