Bug 239725

Summary: net/py-pypcap: Unbreak
Product: Ports & Packages Reporter: Muhammad Moinur Rahman <bofh>
Component: Individual Port(s)Assignee: Po-Chuan Hsieh <sunpoet>
Status: Closed FIXED    
Severity: Affects Many People CC: dbaio, leres, w.schwarzenfeld
Priority: --- Flags: bugzilla: maintainer-feedback? (sunpoet)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Unbreak for amd64
none
patch none

Description Muhammad Moinur Rahman freebsd_committer freebsd_triage 2019-08-08 20:42:08 UTC
Created attachment 206378 [details]
Unbreak for amd64

Fails to build on amd64 architectures of all versions post 11.2; specially crosslinking with 32-bit libraries.

cc -shared -fstack-protector-strong -O2 -pipe -fstack-protector-strong -fno-strict-aliasing build/temp.freebsd-13.0-CURRENT-amd64-3.6/pcap.o build/temp.freebsd-13.0-CURRENT-amd64-3.6/pcap_ex.o -L/usr/lib32 -L/usr/local/lib -lpcap -lpython3.6m -o build/lib.freebsd-13.0-CURRENT-amd64-3.6/pcap.so
ld: error: /usr/lib32/libpcap.so is incompatible with /usr/lib/crti.o
ld: error: /usr/lib32/libgcc_s.so is incompatible with /usr/lib/crti.o
ld: error: /usr/lib32/libc.so.7 is incompatible with /usr/lib/crti.o
ld: error: /usr/lib32/libgcc_s.so is incompatible with /usr/lib/crti.o
cc: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
Comment 1 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2019-08-08 20:56:09 UTC
Am aware about it; it is more likely a problem with SWIG3 incompatibility. Hence I am trying to fix py-pypcap and EXPIRE py-pcap. py-pcap is not maintained any more and requires more work. Whereas py-pypcap has been well maintained and both of them come from the same code.
Comment 3 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2019-08-11 21:02:48 UTC
(In reply to Sunpoet Po-Chuan Hsieh from comment #2)
This seems a problem in 11.3amd64 and 12.0amd64-p9.
http://pdr.bofh.network/data/latest-per-pkg/py36-pypcap/1.2.3/113amd64-default.log
http://pdr.bofh.network/data/latest-per-pkg/py36-pypcap/1.2.3/120amd64-default.log
Comment 4 Po-Chuan Hsieh freebsd_committer freebsd_triage 2019-08-24 16:01:07 UTC
I diff'd the log and I think the main problem is the lib32 libraries.

my poudriere and FreeBSD cluster:
Found libraries in /usr/lib/libpcap.so

Your environment:
Found libraries in /usr/lib32/libpcap.so

But I don't know where does lib32 come from.

Could you please manually run find_lib_path_and_file in setup.py to determine why it finds libpcap.so from /usr/lib32 instead of /usr/lib (line 76)?

BTW, please use poudriere instead of poudriere-devel.
Comment 5 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2019-09-05 12:40:04 UTC
(In reply to Sunpoet Po-Chuan Hsieh from comment #4)
I have moved to poudriere and the problem still persists.
The snippet is as follwoing:
def find_lib_path_and_file(prefix):
    if sys.maxsize > 2 ** 32:
        candidates = [
            'lib64',
            'lib/x64',  # wpdpack
            'lib/x86_64-linux-gnu'
            'lib',
            'lib/i386-linux-gnu',
            ''
        ]
    else:
        candidates = [
            'lib',
            'lib/i386-linux-gnu',
            ''
        ]
There is no lib32 but it still tries to find in lib32.
Comment 6 Craig Leres freebsd_committer freebsd_triage 2019-09-13 17:25:04 UTC
Created attachment 207470 [details]
patch

This is not the right fix (I don't understand why -L/usr/lib32 is being pulled in -- seems like that is the real issue) but adding -L/usr/lib before everything else allows building working py-pypcap (and py-scapy) packages.

Here's a patch that works for me.
Comment 7 Danilo G. Baio freebsd_committer freebsd_triage 2019-09-28 20:26:08 UTC
(In reply to Craig Leres from comment #6)

Same issue here and this fixes the build, thanks.
Comment 8 commit-hook freebsd_committer freebsd_triage 2019-09-30 04:19:31 UTC
A commit references this bug:

Author: sunpoet
Date: Mon Sep 30 04:19:18 UTC 2019
New revision: 513309
URL: https://svnweb.freebsd.org/changeset/ports/513309

Log:
  Workaround to avoid using /usr/lib32 over /usr/lib

  PR:		239725
  Reported by:	bofh
  Submitted by:	leres

Changes:
  head/net/py-pypcap/Makefile
Comment 9 Po-Chuan Hsieh freebsd_committer freebsd_triage 2019-09-30 04:28:56 UTC
Committed. Thanks!