RPGHacker / asar

(Now) official repository of the SNES assembler Asar, originally created by Alcaro
Other
199 stars 42 forks source link

Asar does not link with VS2019 #259

Closed kleinesfilmroellchen closed 1 year ago

kleinesfilmroellchen commented 1 year ago

On master, running

cmake -S src -B build -G "Visual Studio 16 2019"
cmake --build build

gives me

main.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_load8". [asar\build\asar\asar-standalone.vcxproj]
asar_math.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_load8". [asar\build\asar\asar-standalone.vcxproj]
arch-superfx.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_load8". [asar\build\asar\asar-standalone.vcxproj]
assembleblock.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_load8". [asar\build\asar\asar-standalone.vcxproj]
libcon.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_load8". [asar\build\asar\asar-standalone.vcxproj]
libsmw.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_load8". [asar\build\asar\asar-standalone.vcxproj]
interface-cli.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_load8". [asar\build\asar\asar-standalone.vcxproj]
addr2line.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_load8". [asar\build\asar\asar-standalone.vcxproj]
arch-65816.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_load8". [asar\build\asar\asar-standalone.vcxproj]
arch-spc700.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_load8". [asar\build\asar\asar-standalone.vcxproj]
warnings.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store1". [asar\build\asar\asar-standalone.vcxproj]
file-helpers.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store1". [asar\build\asar\asar-standalone.vcxproj]
macro.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store1". [asar\build\asar\asar-standalone.vcxproj]
main.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store1". [asar\build\asar\asar-standalone.vcxproj]
asar_math.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store1". [asar\build\asar\asar-standalone.vcxproj]
virtualfile.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store1". [asar\build\asar\asar-standalone.vcxproj]
arch-superfx.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store1". [asar\build\asar\asar-standalone.vcxproj]
assembleblock.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store1". [asar\build\asar\asar-standalone.vcxproj]
libcon.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store1". [asar\build\asar\asar-standalone.vcxproj]
libstr.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store1". [asar\build\asar\asar-standalone.vcxproj]
interface-cli.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store1". [asar\build\asar\asar-standalone.vcxproj]
addr2line.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store1". [asar\build\asar\asar-standalone.vcxproj]
arch-65816.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store1". [asar\build\asar\asar-standalone.vcxproj]
arch-spc700.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store1". [asar\build\asar\asar-standalone.vcxproj]
warnings.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
errors.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
file-helpers.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
macro.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
main.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
asar_math.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
virtualfile.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
arch-superfx.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
assembleblock.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
libsmw.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
libstr.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
interface-cli.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
addr2line.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
arch-65816.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
arch-spc700.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store4". [asar\build\asar\asar-standalone.vcxproj]
warnings.obj : error LNK2001: Nicht aufgelöstes externes Symbol "__asan_report_store8". [asar\build\asar\asar-standalone.vcxproj]

(couldn't resolve symbol xyz a thousand times over) which suggests to me that the linker is not given all arguments.

I have tried

Am I missing something here?

Atari2 commented 1 year ago

Are you sure that you have this installed in VS2019?

image

Because without those libraries the symbols for asan things will not be on your PC. A temporary fix without installing those would be to just build the release version of asar, by using cmake --build . --config Release

spooonsss commented 1 year ago

I've had this issue in the past, but can't seem to reproduce it now. The workaround: in Visual Studio, remove -fsanitize=address from both C/C++>Command Line and Linker>Command Line. Turn off Enable Address Sanitizer under C/C++.

Something is strange with the asar cmakelists, as it references CMAKE_LINKER_FLAGS_DEBUG here https://github.com/RPGHacker/asar/blob/f5283d29636850df628a46d13d9e2bf10b2dacef/src/asar/CMakeLists.txt#L15 but it isn't documented as a cmake variable https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html

kleinesfilmroellchen commented 1 year ago

That very much looks like the problem, I'll investigate tomorrow. Release build sounds better for me anyways (I'm benchmarking asar against other software) so thanks for the hint, but that should be in the documentation.

kleinesfilmroellchen commented 1 year ago

@Atari2 thanks for the hints, a quick update and everything builds now!