llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.69k stars 11.87k forks source link

‘dladdr’ was not declared in this scope #16904

Open llvmbot opened 11 years ago

llvmbot commented 11 years ago
Bugzilla Link 16530
Version 3.3
OS Solaris
Attachments Proposed patch
Reporter LLVM Bugzilla Contributor
CC @asl,@Theodor

Extended Description

autoconf provides a special macro AC_USE_SYSTEM_EXTENSIONS, which results in -D_GNU_SOURCE on glibc-based systems or -DEXTENSIONS on Solaris-based systems

Synopsis:

if g++ -I/home/pashev/build/include -I/home/pashev/build/lib/Support -I/home/pashev/llvm/include -I/home/pashev/llvm/lib/Support -D_DEBUG -include llvm/Su pport/Solaris.h -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -fomit-frame-pointer -fvisibility-inlines-hidden -fn o-exceptions -fno-rtti -fPIC -Woverloaded-virtual -Wcast-qual -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-uninitialized -Wno-missing-field-initia lizers -c -MMD -MP -MF "/home/pashev/build/lib/Support/Release+Asserts/Path.d.tmp" -MT "/home/pashev/build/lib/Support/Release+Asserts/Path.o" -MT "/home/pa shev/build/lib/Support/Release+Asserts/Path.d" /home/pashev/llvm/lib/Support/Path.cpp -o /home/pashev/build/lib/Support/Release+Asserts/Path.o ; \ then /usr/bin/mv -f "/home/pashev/build/lib/Support/Release+Asserts/Path.d.tmp" "/home/pashev/build/lib/Support/Release+Asserts/Path.d"; else /usr/b in/rm "/home/pashev/build/lib/Support/Release+Asserts/Path.d.tmp"; exit 1; fi In file included from /home/pashev/llvm/lib/Support/Path.cpp:986:0: /home/pashev/llvm/lib/Support/Unix/Path.inc: In function ‘std::string llvm::sys::fs::getMainExecutable(const char, void)’: /home/pashev/llvm/lib/Support/Unix/Path.inc:278:3: error: ‘Dl_info’ was not declared in this scope /home/pashev/llvm/lib/Support/Unix/Path.inc:278:11: error: expected ‘;’ before ‘DLInfo’ /home/pashev/llvm/lib/Support/Unix/Path.inc:279:31: error: ‘DLInfo’ was not declared in this scope /home/pashev/llvm/lib/Support/Unix/Path.inc:279:37: error: ‘dladdr’ was not declared in this scope rm: /home/pashev/build/lib/Support/Release+Asserts/Path.d.tmp: No such file or directory gmake[1]: *** [/home/pashev/build/lib/Support/Release+Asserts/Path.o] Error 1

In the example above DLInfo and dladdr() are not exposed on Solaris unless EXTENSIONS is defined.

Theodor commented 7 years ago

This is no longer relevant for trunk (cmake-driven build does not have this problem).

asl commented 11 years ago
  1. You need to submit patch to llvm-commits mailing list
  2. You have to handle cmake as well

Thanks!