LINBIT / saas

Spatch As A Service
GNU General Public License v3.0
4 stars 3 forks source link

Libpython-dev is required for Ubuntu 22.04 #2

Closed kvaps closed 2 years ago

kvaps commented 2 years ago

When I trying to build drbd for Ubuntu 22.04. I see the errors:

root@spaas-77fbcff5cc-qf5jc:/# make -C /tmp/saas839853613/drbd-9.1.11/drbd compat
make: Entering directory '/tmp/saas839853613/drbd-9.1.11/drbd'
  GENPATCHNAMES   _
drbd-kernel-compat/gen_patch_names.c: In function 'main':
drbd-kernel-compat/gen_patch_names.c:303:3: warning: #warning "Unknown bio rw flags, check compat layer" [-Wcpp]
  303 | # warning "Unknown bio rw flags, check compat layer"
      |   ^~~~~~~
  SPATCH   _  _
    drbd-kernel-compat/cocci_cache/_/.compat.cocci
    : warning: line 24: should peer_device be a metavariable?
    : warning: rule starting on line 80: metavariable bioset not used in the - or context code
    : warning: line 489: bio, previously declared as a metavariable, is used as an identifier
    : warning: line 489: bio, previously declared as a metavariable, is used as an identifier
    : warning: rule starting on line 482: metavariable other_q not used in the - or context code
    : warning: line 552: bio, previously declared as a metavariable, is used as an identifier
    : warning: line 559: bio, previously declared as a metavariable, is used as an identifier
    : warning: rule starting on line 599: metavariable err not used in the - or context code
    : warning: line 1164: op, previously declared as a metavariable, is used as an identifier
    : warning: line 1167: op, previously declared as a metavariable, is used as an identifier
    : warning: line 1892: should nla_strscpy be a metavariable?
    : Cannot infer Python version
make: *** [Makefile:180: drbd-kernel-compat/cocci_cache/_/compat.patch] Error 255
make: Leaving directory '/tmp/saas839853613/drbd-9.1.11/drbd'

If I switch default python to python3, then python3-dev is still required

root@spaas-77fbcff5cc-qf5jc:/# make -C /tmp/saas839853613/drbd-9.1.11/drbd compat
make: Entering directory '/tmp/saas839853613/drbd-9.1.11/drbd'
  GENPATCHNAMES   _
drbd-kernel-compat/gen_patch_names.c: In function 'main':
drbd-kernel-compat/gen_patch_names.c:303:3: warning: #warning "Unknown bio rw flags, check compat layer" [-Wcpp]
  303 | # warning "Unknown bio rw flags, check compat layer"
      |   ^~~~~~~
  SPATCH   _  _
    drbd-kernel-compat/cocci_cache/_/.compat.cocci
    : warning: line 24: should peer_device be a metavariable?
    : warning: rule starting on line 80: metavariable bioset not used in the - or context code
    : warning: line 489: bio, previously declared as a metavariable, is used as an identifier
    : warning: line 489: bio, previously declared as a metavariable, is used as an identifier
    : warning: rule starting on line 482: metavariable other_q not used in the - or context code
    : warning: line 552: bio, previously declared as a metavariable, is used as an identifier
    : warning: line 559: bio, previously declared as a metavariable, is used as an identifier
    : warning: rule starting on line 599: metavariable err not used in the - or context code
    : warning: line 1164: op, previously declared as a metavariable, is used as an identifier
    : warning: line 1167: op, previously declared as a metavariable, is used as an identifier
    : warning: line 1892: should nla_strscpy be a metavariable?
    : Py.find_library: unable to find the Python library [libpython2.7m.so returned Library not found] [/usr/bin/../lib/libpython2.7m.so returned Library not found] [libpython2.7.so returned Library not found] [/usr/bin/../lib/libpython2.7.so returned Library not found]
make: *** [Makefile:180: drbd-kernel-compat/cocci_cache/_/compat.patch] Error 255
make: Leaving directory '/tmp/saas839853613/drbd-9.1.11/drbd'
rck commented 2 years ago

does not reproduce.

So maybe you can at least provide the compat.h that should trigger the bug?

kvaps commented 2 years ago

Sure,

steps to reproduce ```bash mkdir -p drbd-kernel-compat/cocci_cache/_/ touch drbd-kernel-compat/cocci_cache/_/compat.h echo 5.15.0-46-generic > drbd-kernel-compat/cocci_cache/_/kernelrelease.txt cat drbd-kernel-compat/cocci_cache/_/compat.h <<\EOT #define COMPAT___VMALLOC_HAS_2_PARAMS #define COMPAT_ADD_DISK_RETURNS_INT /* #undef COMPAT_BEFORE_4_13_KERNEL_READ */ /* #undef COMPAT_BIO_ALLOC_HAS_4_PARAMS */ /* #undef COMPAT_BLKDEV_ISSUE_ZEROOUT_DISCARD */ /* #undef COMPAT_CAN_INCLUDE_VERMAGIC_H */ /* #undef COMPAT_FS_DAX_GET_BY_BDEV_TAKES_START_OFF */ #define COMPAT_GENL_POLICY_IN_OPS #define COMPAT_HAVE_BIO_MAX_VECS #define COMPAT_HAVE_CRYPTO_TFM_NEED_KEY /* #undef COMPAT_HAVE_GENHD_FL_NO_PART */ #define COMPAT_HAVE_SHASH_DESC_ON_STACK #define COMPAT_HAVE_WB_CONGESTED_ENUM #define COMPAT_HAVE_ALLOW_KERNEL_SIGNAL #define COMPAT_HAVE_BDEV_NR_SECTORS /* #undef COMPAT_HAVE_BDGRAB */ /* #undef COMPAT_HAVE_BDI_CONGESTED_FN */ #define COMPAT_HAVE_BIO_BI_BDEV /* #undef COMPAT_HAVE_BIO_BI_ERROR */ #define COMPAT_HAVE_BIO_BI_OPF #define COMPAT_HAVE_BIO_BI_STATUS #define COMPAT_HAVE_BIO_CLONE_FAST /* #undef COMPAT_HAVE_BIO_OP_SHIFT */ #define COMPAT_HAVE_BIO_SET_DEV #define COMPAT_HAVE_BIO_SET_OP_ATTRS #define COMPAT_HAVE_BIO_START_IO_ACCT #define COMPAT_HAVE_BIOSET_INIT /* #undef COMPAT_HAVE_BIOSET_NEED_BVECS */ #define COMPAT_HAVE_BLK_ALLOC_DISK /* #undef COMPAT_HAVE_BLK_ALLOC_QUEUE_RH */ #define COMPAT_HAVE_BLK_CHECK_PLUGGED /* #undef COMPAT_HAVE_BLK_QC_T_MAKE_REQUEST */ #define COMPAT_HAVE_BLK_QC_T_SUBMIT_BIO #define COMPAT_HAVE_BLK_QUEUE_FLAG_SET /* #undef COMPAT_HAVE_BLK_QUEUE_MAKE_REQUEST */ /* #undef COMPAT_HAVE_BLK_QUEUE_MERGE_BVEC */ #define COMPAT_HAVE_BLK_QUEUE_SPLIT_BIO /* #undef COMPAT_HAVE_BLK_QUEUE_SPLIT_Q_BIO */ /* #undef COMPAT_HAVE_BLK_QUEUE_SPLIT_Q_BIO_BIOSET */ /* #undef COMPAT_HAVE_BLK_QUEUE_UPDATE_READAHEAD */ #define COMPAT_HAVE_BLK_QUEUE_WRITE_CACHE #define COMPAT_HAVE_D_INODE #define COMPAT_HAVE_DISK_UPDATE_READAHEAD #define COMPAT_HAVE_FALLTHROUGH #define COMPAT_HAVE_FS_DAX_GET_BY_BDEV /* #undef COMPAT_HAVE_GENERIC_START_IO_ACCT_Q_RW_SECT_PART */ /* #undef COMPAT_HAVE_GENERIC_START_IO_ACCT_RW_SECT_PART */ #define COMPAT_HAVE_GENL_FAMILY_PARALLEL_OPS /* #undef COMPAT_HAVE_HD_STRUCT */ #define COMPAT_HAVE_IB_CQ_INIT_ATTR /* #undef COMPAT_HAVE_IB_GET_DMA_MR */ #define COMPAT_HAVE_IDR_IS_EMPTY #define COMPAT_HAVE_INODE_LOCK #define COMPAT_HAVE_KTIME_TO_TIMESPEC64 #define COMPAT_HAVE_KVFREE #define COMPAT_HAVE_MAX_SEND_RECV_SGE #define COMPAT_HAVE_NLA_NEST_START_NOFLAG #define COMPAT_HAVE_NLA_PARSE_DEPRECATED #define COMPAT_HAVE_NLA_PUT_64BIT #define COMPAT_HAVE_NLA_STRSCPY #define COMPAT_HAVE_PART_STAT_H #define COMPAT_HAVE_PART_STAT_READ_ACCUM /* #undef COMPAT_HAVE_POINTER_BACKING_DEV_INFO */ #define COMPAT_HAVE_PROC_CREATE_SINGLE #define COMPAT_HAVE_QUEUE_FLAG_STABLE_WRITES #define COMPAT_HAVE_RB_DECLARE_CALLBACKS_MAX #define COMPAT_HAVE_REFCOUNT_INC /* #undef COMPAT_HAVE_REQ_HARDBARRIER */ /* #undef COMPAT_HAVE_REQ_NOIDLE */ #define COMPAT_HAVE_REQ_NOUNMAP #define COMPAT_HAVE_REQ_OP_WRITE #define COMPAT_HAVE_REQ_OP_WRITE_ZEROES /* #undef COMPAT_HAVE_REQ_WRITE */ /* #undef COMPAT_HAVE_REVALIDATE_DISK_SIZE */ #define COMPAT_HAVE_SCHED_SET_FIFO /* #undef COMPAT_HAVE_SECURITY_NETLINK_RECV */ #define COMPAT_HAVE_SENDPAGE_OK #define COMPAT_HAVE_SET_CAPACITY_AND_NOTIFY #define COMPAT_HAVE_SHASH_DESC_ZERO #define COMPAT_HAVE_SIMPLE_POSITIVE #define COMPAT_HAVE_SOCK_SET_KEEPALIVE #define COMPAT_HAVE_STRUCT_BVEC_ITER #define COMPAT_HAVE_STRUCT_SIZE #define COMPAT_HAVE_SUBMIT_BIO_NOACCT #define COMPAT_HAVE_TCP_SOCK_SET_CORK #define COMPAT_HAVE_TCP_SOCK_SET_NODELAY #define COMPAT_HAVE_TCP_SOCK_SET_QUICKACK #define COMPAT_HAVE_TIME64_TO_TM #define COMPAT_HAVE_TIMER_SETUP /* #undef COMPAT_HAVE_VOID_MAKE_REQUEST */ /* #undef COMPAT_HAVE_VOID_SUBMIT_BIO */ #define COMPAT_IB_ALLOC_PD_HAS_2_PARAMS #define COMPAT_IB_DEVICE_HAS_OPS #define COMPAT_IB_POST_SEND_CONST_PARAMS /* #undef COMPAT_IB_QUERY_DEVICE_HAS_3_PARAMS */ /* #undef COMPAT_NEED_MAKE_REQUEST_RECURSION */ #define COMPAT_PART_STAT_READ_TAKES_BLOCK_DEVICE /* #undef COMPAT_QUEUE_LIMITS_HAS_DISCARD_ZEROES_DATA */ #define COMPAT_RDMA_CREATE_ID_HAS_NET_NS #define COMPAT_SOCK_CREATE_KERN_HAS_FIVE_PARAMETERS #define COMPAT_SOCK_OPS_RETURNS_ADDR_LEN #define COMPAT_STRUCT_GENDISK_HAS_BACKING_DEV_INFO EOT ```

We based our spaas image on debian bullseye, I think the problem is that it is using gcc v10, while ubuntu jammy is using gcc v11 by default.

Meanwhile patch generation was successful after installing additional dependencies and setting symlink for python

rck commented 2 years ago

your compat.h still works for my jammy container. so if your image is actually based on something else, then fix that yourself please. my guess (and that might be perfectly wrong) is that the symlink alone would be good enough and the dependency is not even needed. that is why I wanted to reproduce it in the first place.

anyways if it is an actual bug in the code we have here, then that is something we need to fix, if it happens somewhere else, then please fix it there. sorry, I currently don't have the time to play around with other base images where this might reproduce. thanks. closing till proven otherwise.