Skip to content

[devloop] Debug build linker errors in tests on Unix #68279

Closed
@lambdageek

Description

@lambdageek

The change to pal_assert.h in #64631 broke Debug configuration builds of the native test libraries on non-Windows:

[100%] Linking CXX shared library libProfiler.dylib
Undefined symbols for architecture x86_64:
  "_PAL_fprintf", referenced from:
      void EventPipeWritingProfiler::WriteToBuffer<unsigned short>(unsigned char*, unsigned long, unsigned long*, unsigned short) in eventpipewritingprofiler.cpp.o
      void EventPipeWritingProfiler::WriteToBuffer<int>(unsigned char*, unsigned long, unsigned long*, int) in eventpipewritingprofiler.cpp.o
  "_PAL_get_stderr", referenced from:
      void EventPipeWritingProfiler::WriteToBuffer<unsigned short>(unsigned char*, unsigned long, unsigned long*, unsigned short) in eventpipewritingprofiler.cpp.o
      void EventPipeWritingProfiler::WriteToBuffer<int>(unsigned char*, unsigned long, unsigned long*, int) in eventpipewritingprofiler.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [profiler/native/libProfiler.dylib] Error 1
make[1]: *** [profiler/native/CMakeFiles/Profiler.dir/all] Error 2

Repro with CoreCLR:

$ ./build.sh clr+libs
[... builds ok...]
$ ./src/tests/build.sh skipmanaged debug
[... build output with linker error above ...]

Repro with Mono:

$ ./build.sh mono+libs+clr.hosts
[... builds ok ...]
$ ./src/tests/build.sh mono skipmanaged debug
[... build output with linker error above ...]

The issue is that the new definition of _ASSERTE in pal_assert.h depends on the coreclrpal static library, which is not linked into any of the native libraries in src/tests.

Maybe the tests don't need to depend on the CLR PAL

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions