{"action":"created","issue":{"url":"https://api.github.com/repos/p8a/yara-java/issues/10","repository_url":"https://api.github.com/repos/p8a/yara-java","labels_url":"https://api.github.com/repos/p8a/yara-java/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/p8a/yara-java/issues/10/comments","events_url":"https://api.github.com/repos/p8a/yara-java/issues/10/events","html_url":"https://github.com/p8a/yara-java/issues/10","id":197208039,"number":10,"title":"Build fails on Linux on hawtjni-plugin step","user":{"login":"m91snik","id":1584865,"avatar_url":"https://avatars.githubusercontent.com/u/1584865?v=3","gravatar_id":"","url":"https://api.github.com/users/m91snik","html_url":"https://github.com/m91snik","followers_url":"https://api.github.com/users/m91snik/followers","following_url":"https://api.github.com/users/m91snik/following{/other_user}","gists_url":"https://api.github.com/users/m91snik/gists{/gist_id}","starred_url":"https://api.github.com/users/m91snik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m91snik/subscriptions","organizations_url":"https://api.github.com/users/m91snik/orgs","repos_url":"https://api.github.com/users/m91snik/repos","events_url":"https://api.github.com/users/m91snik/events{/privacy}","received_events_url":"https://api.github.com/users/m91snik/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-12-22T16:08:34Z","updated_at":"2016-12-29T16:51:44Z","closed_at":"2016-12-27T16:06:33Z","body":"Hi,\r\n\r\nI've tried to build yara-java on OpenSuse Leap and I followed instructions to clone and make Yara first of all and after that clone yara-java to corresponding directory and run `mvn clean install` there.\r\n\r\nI noticed that `hawtjni-plugin` plugin was configured only for `mac`, so I've added `unix` profile as \r\n\r\n```\r\n<id>unix</id>\r\n<activation><os><family>unix</family></os></activation>\r\n<build>\r\n    <plugins>\r\n        <plugin>\r\n            <groupId>org.fusesource.hawtjni</groupId>\r\n            <artifactId>maven-hawtjni-plugin</artifactId>\r\n            <configuration>\r\n                <osgiPlatforms>\r\n                    <osgiPlatform>osname=Linux;processor=x86-64</osgiPlatform>\r\n                </osgiPlatforms>\r\n                <configureArgs>\r\n                    <arg>--with-universal=x86_64</arg>\r\n                    <arg>--disable-shared</arg>\r\n                </configureArgs>\r\n                <platform>linux64</platform>\r\n            </configuration>\r\n        </plugin>\r\n    </plugins>\r\n</build>\r\n```\r\n\r\nwithout `--disable-shared` arg I'm getting error\r\n\r\n```\r\n[INFO] *** static library /opt/workspace/samples/yara/yara-java/target/native-build/../../../libyara/.libs/libyara.a is not portable!\r\n[INFO] libtool: link: gcc -shared  -fPIC -DPIC  src/.libs/yara-wrapper_stats.o src/.libs/yara-wrapper.o src/.libs/yara-wrapper_structs.o src/.libs/hawtjni.o src/.libs/hawtjni-callback.o   /opt/workspace/samples/yara/yara-java/target/native-build/../../../libyara/.libs/libyara.a  -O2   -Wl,-soname -Wl,libyara-wrapper-3.4.0-SNAPSHOT.so -o .libs/libyara-wrapper-3.4.0-SNAPSHOT.so\r\n[INFO] /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: /opt/workspace/samples/yara/yara-java/target/native-build/../../../libyara/.libs/libyara.a(compiler.o): relocation R_X86_64_32 against `yr_object_destroy' can not be used when making a shared object; recompile with -fPIC\r\n[INFO] /opt/workspace/samples/yara/yara-java/target/native-build/../../../libyara/.libs/libyara.a: error adding symbols: Bad value\r\n```\r\nand with `--disable-shared` as in config above, I'm getting\r\n```\r\nMake based build did not generate: /opt/workspace/samples/yara/yara-java/target/native-build/target/lib/libyara-wrapper.so\r\n```\r\nbut in the same time I see in lib64 directory that wrapper library is generated as .a:\r\n```\r\nyara-java/target/native-build/target/lib64> ls\r\nlibyara-wrapper.a  libyara-wrapper.la\r\n```\r\n\r\n@p8a, have you checked yara-java on non-mac platforms? May be you have advices about solving this issue"},"comment":{"url":"https://api.github.com/repos/p8a/yara-java/issues/comments/269658405","html_url":"https://github.com/p8a/yara-java/issues/10#issuecomment-269658405","issue_url":"https://api.github.com/repos/p8a/yara-java/issues/10","id":269658405,"user":{"login":"m91snik","id":1584865,"avatar_url":"https://avatars.githubusercontent.com/u/1584865?v=3","gravatar_id":"","url":"https://api.github.com/users/m91snik","html_url":"https://github.com/m91snik","followers_url":"https://api.github.com/users/m91snik/followers","following_url":"https://api.github.com/users/m91snik/following{/other_user}","gists_url":"https://api.github.com/users/m91snik/gists{/gist_id}","starred_url":"https://api.github.com/users/m91snik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m91snik/subscriptions","organizations_url":"https://api.github.com/users/m91snik/orgs","repos_url":"https://api.github.com/users/m91snik/repos","events_url":"https://api.github.com/users/m91snik/events{/privacy}","received_events_url":"https://api.github.com/users/m91snik/received_events","type":"User","site_admin":false},"created_at":"2016-12-29T16:51:44Z","updated_at":"2016-12-29T16:51:44Z","body":"@p8a , I build it for 64 bit system. It seems to be wrong that https://github.com/fusesource/hawtjni/blob/master/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/BuildMojo.java calls ./configure script without specifying libdir explicitly, but later assumes that libdir was \"lib\" and not \"lib64\".\r\n\r\nSo, point is that .so is generated correctly and placed to lib64, but [BuildMojo tries to use it from \"lib\" directory](https://github.com/fusesource/hawtjni/blob/master/maven-hawtjni-plugin/src/main/java/org/fusesource/hawtjni/maven/BuildMojo.java#L343).\r\n\r\nSo, specifying libdir explicitly solves this issue and it's quite quick fix.\r\nI think that it's a kind of workaround because more general solution will be BuildMojo fix to use not hardcoded \"lib\", but evaluate it based on architecture."}}
{"actor":{"display_login":"m91snik"}}