Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

use native uuid_create on BSD systems #2

Merged
merged 6 commits into from Aug 24, 2012

Conversation

Projects
None yet
2 participants
Contributor

joecaswell commented Aug 24, 2012

When running moss on bsd there is a namespace conflict between ossp-uuid and uuid provided with the os. The linking is done dynamically when run under erlang, resulting in segfault if the native uuid_create is used instead of the ossp variety.
The native function returns data in the same format and so can be used as a drop in replacement.

@kellymclaughlin kellymclaughlin commented on an outdated diff Aug 24, 2012

rebar.config.script
@@ -0,0 +1,21 @@
+Config=[
+ {so_name, "druuid,so"},
+ {port_sources, ["c_src/*,c"]},
+ {deps, [ ]},
+ {deps_dir, "c_src"},
+ {port_envs, [
+ %% Make sure to set -fPIC when compiling ossp-uuid
+ {"CFLAGS", "$CFLAGS -fPIC"},
+ {"^bsd","DRV_CFLAGS", "$DRV_CFLAGS -Werror -I c_src/uuid-1,6,2"},
+ {"^bsd","DRV_LDFLAGS", "$DRV_LDFLAGS c_src/uuid-1,6,2/,libs/libuuid,a"},
+ %% BSD provides uuid_create natively
+ {"bsd","DRV_CFLAGS", "$DRV_CFLAGS -Werror"},
@kellymclaughlin

kellymclaughlin Aug 24, 2012

Owner

The comma at the end of this line and the following line give me a synax error when trying to run make.

Joe Caswell requires new rebar for dynamic config
typos in config script
b330ff2

@kellymclaughlin kellymclaughlin commented on an outdated diff Aug 24, 2012

rebar.config.script
+Config=[
+ {so_name, "druuid,so"},
+ {port_sources, ["c_src/*,c"]},
+ {deps, [ ]},
+ {deps_dir, "c_src"},
+ {port_envs, [
+ %% Make sure to set -fPIC when compiling ossp-uuid
+ {"CFLAGS", "$CFLAGS -fPIC"},
+ {"^bsd","DRV_CFLAGS", "$DRV_CFLAGS -Werror -I c_src/uuid-1,6,2"},
+ {"^bsd","DRV_LDFLAGS", "$DRV_LDFLAGS c_src/uuid-1,6,2/,libs/libuuid,a"},
+ %% BSD provides uuid_create natively
+ {"bsd","DRV_CFLAGS", "$DRV_CFLAGS -Werror"},
+ ]},
+],
+case rebar_utils:is_arch("bsd") of
+match ->
@kellymclaughlin

kellymclaughlin Aug 24, 2012

Owner

rebar_utils:is_arch/1 will return true or false instead of match or nomatch.

Owner

kellymclaughlin commented Aug 24, 2012

The dynamic rebar configs will require the repo version of rebar to be updated. Could you add that also?

joecaswell and others added some commits Aug 24, 2012

@kellymclaughlin kellymclaughlin pushed a commit that referenced this pull request Aug 24, 2012

Kelly McLaughlin Merge pull request #2 from joecaswell/master
Use native uuid_create on BSD systems
b3c5c2a

@kellymclaughlin kellymclaughlin merged commit b3c5c2a into kellymclaughlin:master Aug 24, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment