Created attachment 145504 [details] add -fpic flag I was trying to build program depending on libtomcrypt and found that build failed on amd64 because libtomcrypt is built w/o fpic flag. After adding it to libtomcrypt makefule build was successful.
Shouldn't this be applied only to arch amd64?
(In reply to John Marino from comment #1) > Shouldn't this be applied only to arch amd64? I don't really now. When i was grepping fpic on different makefiles i found both approaches - for amd64 only or for all platforms. And i don't really know if fpic on other platforms will/can make a problems.
I think it's amd64 only. You can test this on i386, try building your program without modifying libtomcrypt, it should work. Or if you don't want to test, just modify this to be AMD64 only, e.g. CFLAGS_amd64= -fPIC e.g. http://svnweb.freebsd.org/ports/head/devel/libcfg/Makefile?revision=345872&view=markup
Please don't add -fPIC like that. It'll cause static libraries and executables to be build with as well and that's wrong. Problems with -fPIC are almost always because a configure test fails, so please search config.log for -fPIC and see if there are any problems there.
(In reply to Tijl Coosemans from comment #4) > Please don't add -fPIC like that. It'll cause static libraries and > executables to be build with as well and that's wrong. Problems with -fPIC > are almost always because a configure test fails, so please search > config.log for -fPIC and see if there are any problems there. In this case it's causing link error on the third party software depending on this tool. As far as i could see this port generating only .a library: root@bsd10:~ # pkg info -l libtomcrypt-1.17_2|grep -v include libtomcrypt-1.17_2: /usr/local/lib/libtomcrypt.a so i think that patch is ok. I am ok to apply it only to amd64 if needed.
(In reply to John Marino from comment #3) > I think it's amd64 only. > You can test this on i386, try building your program without modifying > libtomcrypt, it should work. > > Or if you don't want to test, just modify this to be AMD64 only, e.g. > CFLAGS_amd64= -fPIC > > e.g. > http://svnweb.freebsd.org/ports/head/devel/libcfg/ > Makefile?revision=345872&view=markup I am ok to apply it as CFLAGS_amd64= -fPIC. Should i submit new patch?
I'm looking into building a shared library of libtomcrypt.
Created attachment 145521 [details] proposed patch Does this patch work for you?
(In reply to Tijl Coosemans from comment #8) > Created attachment 145521 [details] > proposed patch > > Does this patch work for you? No, its not. Configure failing: Package libtomcrypt was not found in the pkg-config search path. Perhaps you should add the directory containing `libtomcrypt.pc' to the PKG_CONFIG_PATH environment variable Package 'libtomcrypt', required by 'world', not found configure:12728: $? = 1 configure:12840: checking if libtomcrypt is usable configure:12853: cc -o conftest -I/usr/local/include -L/usr/local/lib conftest.c -ltomcrypt >&5 /usr/local/lib/libtomcrypt.so: undefined reference to `mp_prime_is_prime' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_mulmod' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_mul_d' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_div_2' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_sqrmod' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_copy' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_cnt_lsb' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_sqr' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_to_unsigned_bin' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_invmod' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_exptmod' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_mul' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_add_d' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_montgomery_reduce' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_mod_d' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_sub' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_gcd' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_div' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_clear' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_get_int' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_montgomery_setup' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_cmp' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_read_radix' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_count_bits' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_add' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_lcm' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_unsigned_bin_size' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_read_unsigned_bin' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_toradix' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_set_int' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_2expt' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_cmp_d' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_neg' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_init' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_montgomery_calc_normalization' /usr/local/lib/libtomcrypt.so: undefined reference to `mp_sub_d' cc: error: linker command failed with exit code 1 (use -v to see invocation) configure:12853: $? = 1 Just in case, i am checking with stoken tool, you can try it on your own as well.
Created attachment 145525 [details] patch2 New patch. Dependencies should be linked in now.
(In reply to Tijl Coosemans from comment #10) > Created attachment 145525 [details] > patch2 > > New patch. Dependencies should be linked in now. Confirmed - works, and according to ldd linked with correct library: $ ldd stoken stoken: libstoken.so.1 => not found (0) libtomcrypt.so.0 => /usr/local/lib/libtomcrypt.so.0 (0x800821000) libxml2.so.2 => /usr/local/lib/libxml2.so.2 (0x800ab8000) libc.so.7 => /lib/libc.so.7 (0x800e38000) libz.so.6 => /lib/libz.so.6 (0x8011d1000) liblzma.so.5 => /usr/lib/liblzma.so.5 (0x8013e6000) libm.so.5 => /lib/libm.so.5 (0x801609000)
A commit references this bug: Author: tijl Date: Fri Aug 8 16:35:35 UTC 2014 New revision: 364372 URL: http://svnweb.freebsd.org/changeset/ports/364372 Log: Build shared library and simplify DOCS option PR: 192501 Tested by: samm@os2.kiev.ua Changes: head/security/libtomcrypt/Makefile head/security/libtomcrypt/files/ head/security/libtomcrypt/pkg-plist