[erlang-patches] Add 'global' driver option to erl_ddll:try_load/3

Fredrik fredrik@REDACTED
Mon Mar 25 10:52:58 CET 2013


On 03/22/2013 05:11 PM, Lukas Larsson wrote:
> Hello,
>
> The problem was OS X. In /usr/include/dlfcn.h (actually it was 
> stdbool.h which was included through dlfcn.h) there is this nice bit 
> of code:
>
> #define bool    _Bool
> #if __STDC_VERSION__ < 199901L && __GNUC__ < 3
> typedef int     _Bool;
> #endif
>
> which effectively renamed the variable called bool in  beam_debug.c to 
> _Bool and then defined it as a type.... oh the wonders of single macro 
> namespacing! This problem did not show up before as dlfcn.h was only 
> included in sys_dll.c.
>
> We have renamed the variables to something else and now it seems to 
> compile.
>
> Lukas
>
> On 22/03/13 15:57, Olivier Girondel wrote:
>> On Fri, Mar 22, 2013 at 11:09 AM, Fredrik <fredrik@REDACTED> wrote:
>>> Hello,
>>> Your patch seems not to build on Arch: x86, OS: darwin 9.8.0
>>>
>>> beam/beam_debug.c: In function 'erts_debug_breakpoint_2':
>>> beam/beam_debug.c:81: error: two or more data types in declaration
>>> specifiers
>>> beam/beam_debug.c:81: error: syntax error before '=' token
>>> beam/beam_debug.c:89: error: syntax error before '_Bool'
>>> beam/beam_debug.c:126: error: syntax error before '_Bool'
>> Hi Fredrik & Lukas,
>>
>> This is kind of strange, given I have not modified those files and 
>> they are
>> not generated
>>
>> For example, I can't figure out why
>>
>> https://github.com/erlang/otp/blob/pu/erts/emulator/beam/beam_debug.c#L81 
>>
>>
>> would fail, and alas I don't have a Darwin handy, so I can't help now...
>>
>>> beam/beam_debug.c:93: error: label 'error' used but not defined
>>> beam/beam_debug.c:86: warning: unused variable 'res'
>>> beam/beam_debug.c: At top level:
>>> beam/beam_debug.c:130: error: syntax error before 'else'
>>> beam/beam_debug.c:132: warning: type defaults to 'int' in 
>>> declaration of
>>> 'erts_commit_staged_bp'
>>> beam/beam_debug.c:132: warning: function declaration isn't a prototype
>>> beam/beam_debug.c:132: error: conflicting types for 
>>> 'erts_commit_staged_bp'
>>> beam/beam_bp.h:116: error: previous declaration of 
>>> 'erts_commit_staged_bp'
>>> was here
>>> beam/beam_debug.c:132: warning: data definition has no type or 
>>> storage class
>>> beam/beam_debug.c:133: error: syntax error before '&' token
>>> beam/beam_debug.c:133: warning: type defaults to 'int' in 
>>> declaration of
>>> 'erts_uninstall_breakpoints'
>>> beam/beam_debug.c:133: warning: function declaration isn't a prototype
>>> beam/beam_debug.c:133: error: conflicting types for
>>> 'erts_uninstall_breakpoints'
>>> beam/beam_bp.h:126: error: previous declaration of
>>> 'erts_uninstall_breakpoints' was here
>>> beam/beam_debug.c:133: warning: data definition has no type or 
>>> storage class
>>> beam/beam_debug.c:135: error: syntax error before '&' token
>>> beam/beam_debug.c:135: warning: type defaults to 'int' in 
>>> declaration of
>>> 'erts_consolidate_bp_data'
>>> beam/beam_debug.c:135: warning: function declaration isn't a prototype
>>> beam/beam_debug.c:135: error: conflicting types for
>>> 'erts_consolidate_bp_data'
>>> beam/beam_bp.h:127: error: previous declaration of
>>> 'erts_consolidate_bp_data' was here
>>> beam/beam_debug.c:135: warning: data definition has no type or 
>>> storage class
>>> beam/beam_debug.c:136: warning: type defaults to 'int' in 
>>> declaration of
>>> 'res'
>>> beam/beam_debug.c:136: error: 'f' undeclared here (not in a function)
>>> beam/beam_debug.c:136: warning: data definition has no type or 
>>> storage class
>>> beam/beam_debug.c:137: error: syntax error before '&' token
>>> beam/beam_debug.c:137: warning: type defaults to 'int' in 
>>> declaration of
>>> 'erts_bp_free_matched_functions'
>>> beam/beam_debug.c:137: warning: function declaration isn't a prototype
>>> beam/beam_debug.c:137: error: conflicting types for
>>> 'erts_bp_free_matched_functions'
>>> beam/beam_bp.h:123: error: previous declaration of
>>> 'erts_bp_free_matched_functions' was here
>>> beam/beam_debug.c:137: warning: data definition has no type or 
>>> storage class
>>> beam/beam_debug.c:139: warning: type defaults to 'int' in 
>>> declaration of
>>> 'erts_thr_progress_unblock'
>>> beam/beam_debug.c:139: warning: function declaration isn't a prototype
>>> beam/beam_debug.c:132: warning: type defaults to 'int' in 
>>> declaration of
>>> 'erts_commit_staged_bp'
>>> beam/beam_debug.c:132: warning: function declaration isn't a prototype
>>> beam/beam_debug.c:132: error: conflicting types for 
>>> 'erts_commit_staged_bp'
>>> beam/beam_bp.h:116: error: previous declaration of 
>>> 'erts_commit_staged_bp'
>>> was here
>>> beam/beam_debug.c:132: warning: data definition has no type or 
>>> storage class
>>> beam/beam_debug.c:133: error: syntax error before '&' token
>>> beam/beam_debug.c:133: warning: type defaults to 'int' in 
>>> declaration of
>>> 'erts_uninstall_breakpoints'
>>> beam/beam_debug.c:133: warning: function declaration isn't a prototype
>>> beam/beam_debug.c:141: warning: data definition has no type or 
>>> storage class
>>> beam/beam_debug.c:142: error: syntax error before 'return'
>>> beam/beam_debug.c: In function 'erts_debug_breakpoint_2':
>>> beam/beam_debug.c:81: error: two or more data types in declaration
>>> specifiers
>>> beam/beam_debug.c:81: error: syntax error before '=' token
>>> beam/beam_debug.c:89: error: syntax error before '_Bool'
>>> beam/beam_debug.c:126: error: syntax error before '_Bool'
>>> beam/beam_debug.c:93: error: label 'error' used but not defined
>>> beam/beam_debug.c:86: warning: unused variable 'res'
>>> beam/beam_debug.c: At top level:
>>> beam/beam_debug.c:130: error: syntax error before 'else'
>>> beam/beam_debug.c:132: warning: type defaults to 'int' in 
>>> declaration of
>>> 'erts_commit_staged_bp'
>>> beam/beam_debug.c:132: warning: function declaration isn't a prototype
>>> beam/beam_debug.c:132: error: conflicting types for 
>>> 'erts_commit_staged_bp'
>>> beam/beam_bp.h:116: error: previous declaration of 
>>> 'erts_commit_staged_bp'
>>> was here
>>> beam/beam_debug.c:132: warning: data definition has no type or 
>>> storage class
>>> beam/beam_debug.c:133: error: syntax error before '&' token
>>> beam/beam_debug.c:133: warning: type defaults to 'int' in 
>>> declaration of
>>> 'erts_uninstall_breakpoints'
>>> beam/beam_debug.c:133: warning: function declaration isn't a prototype
>>> beam/beam_debug.c:133: error: conflicting types for
>>> 'erts_uninstall_breakpoints'
>>> beam/beam_bp.h:126: error: previous declaration of
>>> 'erts_uninstall_breakpoints' was here
>>> beam/beam_debug.c:133: warning: data definition has no type or 
>>> storage class
>>> beam/beam_debug.c:135: error: syntax error before '&' token
>>> beam/beam_debug.c:135: warning: type defaults to 'int' in 
>>> declaration of
>>> 'erts_consolidate_bp_data'
>>> beam/beam_debug.c:135: warning: function declaration isn't a prototype
>>> beam/beam_debug.c:135: error: conflicting types for
>>> 'erts_consolidate_bp_data'
>>> beam/beam_bp.h:127: error: previous declaration of
>>> 'erts_consolidate_bp_data' was here
>>> beam/beam_debug.c:135: warning: data definition has no type or 
>>> storage class
>>> beam/beam_debug.c:136: warning: type defaults to 'int' in 
>>> declaration of
>>> 'res'
>>> beam/beam_debug.c:136: error: 'f' undeclared here (not in a function)
>>> beam/beam_debug.c:136: warning: data definition has no type or 
>>> storage class
>>> beam/beam_debug.c:137: error: syntax error before '&' token
>>> beam/beam_debug.c:137: warning: type defaults to 'int' in 
>>> declaration of
>>> 'erts_bp_free_matched_functions'
>>> beam/beam_debug.c:137: warning: function declaration isn't a prototype
>>> beam/beam_debug.c:137: error: conflicting types for
>>> 'erts_bp_free_matched_functions'
>>> beam/beam_bp.h:123: error: previous declaration of
>>> 'erts_bp_free_matched_functions' was here
>>> beam/beam_debug.c:137: warning: data definition has no type or 
>>> storage class
>>> beam/beam_debug.c:139: warning: type defaults to 'int' in 
>>> declaration of
>>> 'erts_thr_progress_unblock'
>>> beam/beam_debug.c:139: warning: function declaration isn't a prototype
>>> beam/beam_debug.c:139: error: conflicting types for
>>> 'erts_thr_progress_unblock'
>>> beam/erl_thr_progress.h:48: error: previous declaration of
>>> 'erts_thr_progress_unblock' was here
>> [in 'pu']:
>> beam/beam_debug.c:139:
>> erts_smp_thr_progress_unblock();
>>
>> and
>> beam/erl_thr_progress.h:48:
>> void erts_thr_progress_unblock(void);
>>
>>> beam/beam_debug.c:139: warning: data definition has no type or 
>>> storage class
>>> beam/beam_debug.c:140: error: syntax error before '(' token
>>> beam/beam_debug.c:141: warning: type defaults to 'int' in 
>>> declaration of
>>> 'erts_release_code_write_permission'
>>> beam/beam_debug.c:141: warning: function declaration isn't a prototype
>>> beam/beam_debug.c:141: error: conflicting types for
>>> 'erts_release_code_write_permission'
>>> beam/code_ix.h:95: error: previous declaration of
>>> 'erts_release_code_write_permission' was here
>>> beam/beam_debug.c:141: warning: data definition has no type or 
>>> storage class
>>> beam/beam_debug.c:142: error: syntax error before 'return'
>>> lipo: can't figure out the architecture type of: /var/tmp//ccpYKJDY.out
>>> make[3]: *** [obj/i386-apple-darwin9.8.0/opt/smp/beam_debug.o] Error 1
>>> make[2]: *** [opt] Error 2
>>> make[1]: *** [smp] Error 2
>>> make: *** [emulator] Error 2
>> Furthermore, looking at all these errors, I don't have a clue...
>>
>> Maybe it's simply a merge/patch/git-thing that got broken ?
>>
This seems to break more stuff though on darwin,
This few lines cannot be in erl_driver.h
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
It seems like you have to include them local, to the files where you 
need them.

-- 

BR Fredrik Gustafsson
Erlang OTP Team




More information about the erlang-patches mailing list