Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

‘dladdr’ was not declared in this scope #16529

Open Quuxplusone opened 11 years ago

Quuxplusone commented 11 years ago
Bugzilla Link PR16530
Status NEW
Importance P normal
Reported by Igor (pashev.igor@gmail.com)
Reported on 2013-07-03 10:01:32 -0700
Last modified on 2017-07-26 03:29:22 -0700
Version 3.3
Hardware PC Solaris
CC anton@korobeynikov.info, fedor.v.sergeev@gmail.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments AC_USE_SYSTEM_EXTENSIONS.patch (1202 bytes, text/plain)
Blocks
Blocked by
See also
Created attachment 10814
Proposed patch

autoconf provides a special macro AC_USE_SYSTEM_EXTENSIONS, which results in -
D_GNU_SOURCE on glibc-based systems or -D__EXTENSIONS__ 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 -D__STDC_CONSTANT_MACROS -D__STDC_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.
Quuxplusone commented 11 years ago

Attached AC_USE_SYSTEM_EXTENSIONS.patch (1202 bytes, text/plain): Proposed patch

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

Thanks!
Quuxplusone commented 7 years ago

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