{"action":"opened","number":2060,"pull_request":{"url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/pulls/2060","id":140043330,"html_url":"https://github.com/FreeRADIUS/freeradius-server/pull/2060","diff_url":"https://github.com/FreeRADIUS/freeradius-server/pull/2060.diff","patch_url":"https://github.com/FreeRADIUS/freeradius-server/pull/2060.patch","issue_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/issues/2060","number":2060,"state":"open","locked":false,"title":"Fix rlm_sql_sqlite build under FreeBSD","user":{"login":"topical","id":8225055,"avatar_url":"https://avatars2.githubusercontent.com/u/8225055?v=4","gravatar_id":"","url":"https://api.github.com/users/topical","html_url":"https://github.com/topical","followers_url":"https://api.github.com/users/topical/followers","following_url":"https://api.github.com/users/topical/following{/other_user}","gists_url":"https://api.github.com/users/topical/gists{/gist_id}","starred_url":"https://api.github.com/users/topical/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/topical/subscriptions","organizations_url":"https://api.github.com/users/topical/orgs","repos_url":"https://api.github.com/users/topical/repos","events_url":"https://api.github.com/users/topical/events{/privacy}","received_events_url":"https://api.github.com/users/topical/received_events","type":"User","site_admin":false},"body":"Under freebsd, detection of sqlite3 partially fails. You get various warnings and errors at runtime due to assumed lack of features making the module unusable.\r\n\r\nThere is an issue with autoconf. The following line works fine:\r\n\r\n/src/modules/rlm_sql/drivers/rlm_sql_sqlite/configure.ac:131 - \"FR_SMART_CHECK_LIB(sqlite3, sqlite3_open)\"\r\n\r\nso the library is found. But all subsequent function checks fail, making the freeradius module believe that we have a really outdated version of sqlite. \r\n\r\nThere seems to be a fundamental flaw in library path detection. In FR_SMART_CHECK_LIB of  file /acinclude.m4, there is quite some magic to detect proper linker settings. Under FreeBSD, the default settings \"just work\", so line acinclude.m4:161 is successful:\r\n\r\n```\r\ndnl #\r\ndnl #  Try using the default library path\r\ndnl #\r\nif test \"x$smart_lib\" = \"x\"; then\r\n  AC_MSG_CHECKING([for $2 in -l$1])\r\n  LIBS=\"-l$1 $old_LIBS\"\r\n  AC_TRY_LINK([extern char $2();],\r\n\t      [$2()],\r\n\t      [\r\n\t        smart_lib=\"-l$1\"\r\n\t        AC_MSG_RESULT(yes)\r\n\t      ],\r\n\t      [AC_MSG_RESULT(no)])\r\n  LIBS=\"$old_LIBS\"\r\nfi\r\n```\r\n\r\nReason is that LD_CONFIG contains \"-L /usr/local/lib\" under FreeBSD by default and sqlite3 is located at this directory. If LD_CONFIG would be empty, the library couldn't be found.\r\n\r\nSo we get smart_lib=\"-lsqlite3\" after this test.\r\n\r\nUpon return we have\r\n```\r\ndnl #\r\ndnl #  Found it, set the appropriate variable.\r\ndnl #\r\nif test \"x$smart_lib\" != \"x\"; then\r\n  eval \"ac_cv_lib_${sm_lib_safe}_${sm_func_safe}=yes\"\r\n  LIBS=\"$smart_ldflags $smart_lib $old_LIBS\"\r\n  SMART_LIBS=\"$smart_ldflags $smart_lib $SMART_LIBS\"\r\nfi\r\n```\r\n\r\nThus, SMARTLIBS=\"-lsqlite3\" (all other expanded variables are empty).\r\n\r\nUpon return, configure.ac of rlm_sql_sqlite continues with\r\n\r\n```\r\n    dnl # Ensure we use the library we just found the rest of the checks\r\n    LDFLAGS=\"${SMART_LIBS}\"\r\n```\r\n\r\nSo we get LDFLAGS=\"-lsqlite3\".\r\n\r\nThis is wrong. The default search path is lost and thus libsqlite3 cannot be found subsequently and thus all further function existance checks will fail.\r\n\r\nThere are various ways to solve this:\r\n  * don't overwrite \"LDFLAGS\" but \"LIBS\"\r\n  * append SMART_LIBS to LDFLAGS (this is what I did; rlm_krb5 does it too)\r\n  * replace return values of FR_SMART_CHECK_LIB (see below)\r\n\r\nBasically, FR_SMART_CHECK_LIB fiddles with LIB and CPPFLAGS, so it should really return those two values.\r\n\r\nI checked the source code and found that there is no consens how to interpret the result of FR_SMART_CHECK_LIB. I assume that most do it wrong.\r\n\r\nThe attached patch works for FreeBSD but a proper fix would probably to rewrite FR_SMART_CHECK_LIB and all its callees. Looking at the remarks inside the function and seeing all the magic, I'm really reluctant to do that.","created_at":"2017-09-08T13:55:30Z","updated_at":"2017-09-08T13:55:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/pulls/2060/commits","review_comments_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/pulls/2060/comments","review_comment_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/issues/2060/comments","statuses_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/statuses/6288b6f685dbe2ed987a6ae75a2d1546a26fb2ba","head":{"label":"topical:v3.0.x","ref":"v3.0.x","sha":"6288b6f685dbe2ed987a6ae75a2d1546a26fb2ba","user":{"login":"topical","id":8225055,"avatar_url":"https://avatars2.githubusercontent.com/u/8225055?v=4","gravatar_id":"","url":"https://api.github.com/users/topical","html_url":"https://github.com/topical","followers_url":"https://api.github.com/users/topical/followers","following_url":"https://api.github.com/users/topical/following{/other_user}","gists_url":"https://api.github.com/users/topical/gists{/gist_id}","starred_url":"https://api.github.com/users/topical/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/topical/subscriptions","organizations_url":"https://api.github.com/users/topical/orgs","repos_url":"https://api.github.com/users/topical/repos","events_url":"https://api.github.com/users/topical/events{/privacy}","received_events_url":"https://api.github.com/users/topical/received_events","type":"User","site_admin":false},"repo":{"id":102587909,"name":"freeradius-server","full_name":"topical/freeradius-server","owner":{"login":"topical","id":8225055,"avatar_url":"https://avatars2.githubusercontent.com/u/8225055?v=4","gravatar_id":"","url":"https://api.github.com/users/topical","html_url":"https://github.com/topical","followers_url":"https://api.github.com/users/topical/followers","following_url":"https://api.github.com/users/topical/following{/other_user}","gists_url":"https://api.github.com/users/topical/gists{/gist_id}","starred_url":"https://api.github.com/users/topical/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/topical/subscriptions","organizations_url":"https://api.github.com/users/topical/orgs","repos_url":"https://api.github.com/users/topical/repos","events_url":"https://api.github.com/users/topical/events{/privacy}","received_events_url":"https://api.github.com/users/topical/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/topical/freeradius-server","description":"FreeRADIUS - A multi-protocol policy server.","fork":true,"url":"https://api.github.com/repos/topical/freeradius-server","forks_url":"https://api.github.com/repos/topical/freeradius-server/forks","keys_url":"https://api.github.com/repos/topical/freeradius-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/topical/freeradius-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/topical/freeradius-server/teams","hooks_url":"https://api.github.com/repos/topical/freeradius-server/hooks","issue_events_url":"https://api.github.com/repos/topical/freeradius-server/issues/events{/number}","events_url":"https://api.github.com/repos/topical/freeradius-server/events","assignees_url":"https://api.github.com/repos/topical/freeradius-server/assignees{/user}","branches_url":"https://api.github.com/repos/topical/freeradius-server/branches{/branch}","tags_url":"https://api.github.com/repos/topical/freeradius-server/tags","blobs_url":"https://api.github.com/repos/topical/freeradius-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/topical/freeradius-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/topical/freeradius-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/topical/freeradius-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/topical/freeradius-server/statuses/{sha}","languages_url":"https://api.github.com/repos/topical/freeradius-server/languages","stargazers_url":"https://api.github.com/repos/topical/freeradius-server/stargazers","contributors_url":"https://api.github.com/repos/topical/freeradius-server/contributors","subscribers_url":"https://api.github.com/repos/topical/freeradius-server/subscribers","subscription_url":"https://api.github.com/repos/topical/freeradius-server/subscription","commits_url":"https://api.github.com/repos/topical/freeradius-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/topical/freeradius-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/topical/freeradius-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/topical/freeradius-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/topical/freeradius-server/contents/{+path}","compare_url":"https://api.github.com/repos/topical/freeradius-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/topical/freeradius-server/merges","archive_url":"https://api.github.com/repos/topical/freeradius-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/topical/freeradius-server/downloads","issues_url":"https://api.github.com/repos/topical/freeradius-server/issues{/number}","pulls_url":"https://api.github.com/repos/topical/freeradius-server/pulls{/number}","milestones_url":"https://api.github.com/repos/topical/freeradius-server/milestones{/number}","notifications_url":"https://api.github.com/repos/topical/freeradius-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/topical/freeradius-server/labels{/name}","releases_url":"https://api.github.com/repos/topical/freeradius-server/releases{/id}","deployments_url":"https://api.github.com/repos/topical/freeradius-server/deployments","created_at":"2017-09-06T09:10:01Z","updated_at":"2017-09-06T09:10:07Z","pushed_at":"2017-09-08T13:08:38Z","git_url":"git://github.com/topical/freeradius-server.git","ssh_url":"git@github.com:topical/freeradius-server.git","clone_url":"https://github.com/topical/freeradius-server.git","svn_url":"https://github.com/topical/freeradius-server","homepage":"http://freeradius.org","size":73209,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"v4.0.x"}},"base":{"label":"FreeRADIUS:v3.0.x","ref":"v3.0.x","sha":"a4ef12aa46e014659b452fb3b63b0184f045dff2","user":{"login":"FreeRADIUS","id":2430370,"avatar_url":"https://avatars0.githubusercontent.com/u/2430370?v=4","gravatar_id":"","url":"https://api.github.com/users/FreeRADIUS","html_url":"https://github.com/FreeRADIUS","followers_url":"https://api.github.com/users/FreeRADIUS/followers","following_url":"https://api.github.com/users/FreeRADIUS/following{/other_user}","gists_url":"https://api.github.com/users/FreeRADIUS/gists{/gist_id}","starred_url":"https://api.github.com/users/FreeRADIUS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FreeRADIUS/subscriptions","organizations_url":"https://api.github.com/users/FreeRADIUS/orgs","repos_url":"https://api.github.com/users/FreeRADIUS/repos","events_url":"https://api.github.com/users/FreeRADIUS/events{/privacy}","received_events_url":"https://api.github.com/users/FreeRADIUS/received_events","type":"Organization","site_admin":false},"repo":{"id":35649,"name":"freeradius-server","full_name":"FreeRADIUS/freeradius-server","owner":{"login":"FreeRADIUS","id":2430370,"avatar_url":"https://avatars0.githubusercontent.com/u/2430370?v=4","gravatar_id":"","url":"https://api.github.com/users/FreeRADIUS","html_url":"https://github.com/FreeRADIUS","followers_url":"https://api.github.com/users/FreeRADIUS/followers","following_url":"https://api.github.com/users/FreeRADIUS/following{/other_user}","gists_url":"https://api.github.com/users/FreeRADIUS/gists{/gist_id}","starred_url":"https://api.github.com/users/FreeRADIUS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FreeRADIUS/subscriptions","organizations_url":"https://api.github.com/users/FreeRADIUS/orgs","repos_url":"https://api.github.com/users/FreeRADIUS/repos","events_url":"https://api.github.com/users/FreeRADIUS/events{/privacy}","received_events_url":"https://api.github.com/users/FreeRADIUS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FreeRADIUS/freeradius-server","description":"FreeRADIUS - A multi-protocol policy server.","fork":false,"url":"https://api.github.com/repos/FreeRADIUS/freeradius-server","forks_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/forks","keys_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/teams","hooks_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/hooks","issue_events_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/issues/events{/number}","events_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/events","assignees_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/assignees{/user}","branches_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/branches{/branch}","tags_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/tags","blobs_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/statuses/{sha}","languages_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/languages","stargazers_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/stargazers","contributors_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/contributors","subscribers_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/subscribers","subscription_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/subscription","commits_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/contents/{+path}","compare_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/merges","archive_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/downloads","issues_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/issues{/number}","pulls_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/pulls{/number}","milestones_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/milestones{/number}","notifications_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/labels{/name}","releases_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/releases{/id}","deployments_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/deployments","created_at":"2008-07-20T18:04:09Z","updated_at":"2017-09-07T13:51:42Z","pushed_at":"2017-09-08T13:42:49Z","git_url":"git://github.com/FreeRADIUS/freeradius-server.git","ssh_url":"git@github.com:FreeRADIUS/freeradius-server.git","clone_url":"https://github.com/FreeRADIUS/freeradius-server.git","svn_url":"https://github.com/FreeRADIUS/freeradius-server","homepage":"http://freeradius.org","size":73349,"stargazers_count":595,"watchers_count":595,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":495,"mirror_url":null,"open_issues_count":63,"forks":495,"open_issues":63,"watchers":595,"default_branch":"v4.0.x"}},"_links":{"self":{"href":"https://api.github.com/repos/FreeRADIUS/freeradius-server/pulls/2060"},"html":{"href":"https://github.com/FreeRADIUS/freeradius-server/pull/2060"},"issue":{"href":"https://api.github.com/repos/FreeRADIUS/freeradius-server/issues/2060"},"comments":{"href":"https://api.github.com/repos/FreeRADIUS/freeradius-server/issues/2060/comments"},"review_comments":{"href":"https://api.github.com/repos/FreeRADIUS/freeradius-server/pulls/2060/comments"},"review_comment":{"href":"https://api.github.com/repos/FreeRADIUS/freeradius-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FreeRADIUS/freeradius-server/pulls/2060/commits"},"statuses":{"href":"https://api.github.com/repos/FreeRADIUS/freeradius-server/statuses/6288b6f685dbe2ed987a6ae75a2d1546a26fb2ba"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":2,"deletions":2,"changed_files":2}}
{"actor":{"display_login":"topical"}}