Skip to content

Instantly share code, notes, and snippets.

@dlangille
Created May 11, 2021 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlangille/78902092fd8839bc4514492f949bad16 to your computer and use it in GitHub Desktop.
Save dlangille/78902092fd8839bc4514492f949bad16 to your computer and use it in GitHub Desktop.
TIMESTAMP = 1619698508
SHA256 (lief-0.11.4.zip) = 2e33789c16b525991c8dc62a4265afdb7003e28b29744251526e3604f40ef3d4
SIZE (lief-0.11.4.zip) = 15698696
PORTNAME= lief
DISTVERSION= 0.11.4
CATEGORIES= vrt devel
MASTER_SITES= CHEESESHOP
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
EXTRACT_SUFX= .zip
MAINTAINER= dvl@FreeBSD.org
COMMENT= modify and abstract ELF, PE and MachO formats.
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE
BUILD_DEPENDS= cmake>0:devel/cmake
USES= python
USE_PYTHON= autoplist distutils
.include <bsd.port.mk>
Ics.py is a pythonic and easy iCalendar library.
Its goals are to read and write ics data in a developer friendly way.
iCalendar is a widely-used and useful format but not user friendly.
WWW: https://github.com/ics-py/ics-py
@dlangille
Copy link
Author

dlangille commented May 11, 2021

Unrelated warnings during the build:

/wrkdirs/usr/ports/vrt/py-lief/work-py38/lief-0.11.4/src/iostream.cpp:247:29: warning: comparison of integers of different signs: 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::size_type' (aka 'unsigned long') and 'std::__1::streamsize' (aka 'long') [-Wsign-compare]
        this->prefix.size() != this->sbuf->sputn(&this->prefix[0], this->prefix.size())) {
        ~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

...


/wrkdirs/usr/ports/vrt/py-lief/work-py38/lief-0.11.4/src/PE/signature/SignatureParser.cpp:1085:96: warning: unused parameter 'stream' [-Wunused-parameter]
result<SignatureParser::SpcPeImageData> SignatureParser::parse_spc_pe_image_data(VectorStream& stream) {
                                                                                               ^
1 warning generated.

@dlangille
Copy link
Author

This is the end of the build:

[100%] Building CXX object api/python/CMakeFiles/pyLIEF.dir/platforms/android/pyVersion.cpp.o
[100%] Linking CXX shared library ../../../lief.so
Strip LIEF Python bindings
[100%] Built target pyLIEF
Copying /wrkdirs/usr/ports/vrt/py-lief/work-py38/lief-0.11.4/build/lief.so into build/lib.freebsd-12.2-RELEASE-p2-amd64-3.8/lief.cpython-38.so
copying /wrkdirs/usr/ports/vrt/py-lief/work-py38/lief-0.11.4/build/lief.so -> build/lib.freebsd-12.2-RELEASE-p2-amd64-3.8/lief.cpython-38.so
copying build/lib.freebsd-12.2-RELEASE-p2-amd64-3.8/lief.cpython-38.so -> 
running build_scripts
creating build/scripts-3.8
copying and adjusting examples/python/elf_reader.py -> build/scripts-3.8
copying and adjusting examples/python/pe_reader.py -> build/scripts-3.8
copying and adjusting examples/python/macho_reader.py -> build/scripts-3.8
changing mode of build/scripts-3.8/elf_reader.py from 644 to 755
changing mode of build/scripts-3.8/pe_reader.py from 644 to 755
changing mode of build/scripts-3.8/macho_reader.py from 644 to 755
===========================================================================
=>> Checking for filesystem violations... done
=======================<phase: run-depends    >============================
===>   py38-lief-0.11.4 depends on package: py38-setuptools>0 - found
===>   py38-lief-0.11.4 depends on file: /usr/local/bin/python3.8 - found
===========================================================================
=>> Recording filesystem state for prestage... done
=======================<phase: stage          >============================
===>  Staging for py38-lief-0.11.4
===>   py38-lief-0.11.4 depends on package: py38-setuptools>0 - found
===>   py38-lief-0.11.4 depends on file: /usr/local/bin/python3.8 - found
===>   Generating temporary packing list
0.11.4
running install
running build
running build_ext
Platform: FreeBSD
Wheel library: lief
cmake /wrkdirs/usr/ports/vrt/py-lief/work-py38/lief-0.11.4 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/wrkdirs/usr/ports/vrt/py-lief/work-py38/lief-0.11.4/build -DPYTHON_EXECUTABLE=/usr/local/bin/python3.8 -DLIEF_PYTHON_API=on -DLIEF_LOGGING_DEBUG=off -DCMAKE_CXX_FLAGS=-O2 -pipe -fstack-protector-strong -fno-strict-aliasing   -DCMAKE_C_FLAGS=-O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -DCMAKE_BUILD_TYPE=Release
-- LIEF 0.11.4
-- Caching: ON
CMake Warning at CMakeLists.txt:59 (message):
  Can't find cache solution


-- Enable JSON support
-- Enable Frozen (C++14 support)
-- CMAKE_CXX_FLAGS_RELEASE:           -O3 -DNDEBUG
-- CMAKE_CXX_FLAGS:                   -O2 -pipe -fstack-protector-strong -fno-strict-aliasing
-- CMAKE_CXX_LINK_EXECUTABLE:         <CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>
-- CMAKE_CXX_LINK_FLAGS:              
-- CMAKE_EXE_LINKER_FLAGS:            -fstack-protector-strong
-- CMAKE_EXE_LINKER_FLAGS_RELEASE:    
-- CMAKE_SHARED_LINKER_FLAGS:         -fstack-protector-strong
-- CMAKE_SHARED_LINKER_FLAGS_RELEASE: 
-- CMAKE_CXX_LINK_LIBRARY_FILE_FLAG:  
-- CMAKE_LINK_LIBRARY_FILE_FLAG:      
-- CMAKE_LINK_INTERFACE_LIBRARIES:    
-- CMAKE_CXX_IMPLICIT_LINK_LIBRARIES: c++;m;gcc;gcc_s;c;gcc;gcc_s
-- CMAKE_SYSTEM_PROCESSOR:            amd64
-- Configuration Types: 
-- Build Types: Release
-- Python version: 3.5
-- Python lib:     /usr/local/lib/libpython3.8.so
-- Python include: /usr/local/include/python3.8
-- Python interpreter: /usr/local/bin/python3.8
-- Configuring done
-- Generating done
-- Build files have been written to: /wrkdirs/usr/ports/vrt/py-lief/work-py38/lief-0.11.4/build/temp.freebsd-12.2-RELEASE-p2-amd64-3.8
Using 1 jobs
[  1%] Built target lief_spdlog
[  2%] Built target lief_utfcpp
[  3%] Built target lief_leaf
[  5%] Built target lief_frozen
[  6%] Built target lief_mbed_tls
[  7%] Built target lief_libjson
[  9%] Built target lief_pybind11
Consolidate compiler generated dependencies of target LIB_LIEF
[ 65%] Built target LIB_LIEF
Consolidate compiler generated dependencies of target pyLIEF
[100%] Built target pyLIEF
Copying /wrkdirs/usr/ports/vrt/py-lief/work-py38/lief-0.11.4/build/lief.so into build/lib.freebsd-12.2-RELEASE-p2-amd64-3.8/lief.cpython-38.so
copying /wrkdirs/usr/ports/vrt/py-lief/work-py38/lief-0.11.4/build/lief.so -> build/lib.freebsd-12.2-RELEASE-p2-amd64-3.8/lief.cpython-38.so
copying build/lib.freebsd-12.2-RELEASE-p2-amd64-3.8/lief.cpython-38.so -> 
running build_scripts
running install_lib
creating /wrkdirs/usr/ports/vrt/py-lief/work-py38/stage/usr/local/lib/python3.8
creating /wrkdirs/usr/ports/vrt/py-lief/work-py38/stage/usr/local/lib/python3.8/site-packages
copying build/lib.freebsd-12.2-RELEASE-p2-amd64-3.8/lief.cpython-38.so -> /wrkdirs/usr/ports/vrt/py-lief/work-py38/stage/usr/local/lib/python3.8/site-packages
writing byte-compilation script '/tmp/tmp6glaun1l.py'
/usr/local/bin/python3.8 /tmp/tmp6glaun1l.py
removing /tmp/tmp6glaun1l.py
running install_egg_info
running egg_info
writing lief.egg-info/PKG-INFO
writing dependency_links to lief.egg-info/dependency_links.txt
writing top-level names to lief.egg-info/top_level.txt
reading manifest file 'lief.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'api/python/build'
warning: no previously-included files matching '*.so' found under directory '*.egg-info'
writing manifest file 'lief.egg-info/SOURCES.txt'
Copying lief.egg-info to /wrkdirs/usr/ports/vrt/py-lief/work-py38/stage/usr/local/lib/python3.8/site-packages/lief-0.11.4-py3.8.egg-info
running install_scripts
copying build/scripts-3.8/elf_reader.py -> /wrkdirs/usr/ports/vrt/py-lief/work-py38/stage/usr/local/bin
copying build/scripts-3.8/macho_reader.py -> /wrkdirs/usr/ports/vrt/py-lief/work-py38/stage/usr/local/bin
copying build/scripts-3.8/pe_reader.py -> /wrkdirs/usr/ports/vrt/py-lief/work-py38/stage/usr/local/bin
changing mode of /wrkdirs/usr/ports/vrt/py-lief/work-py38/stage/usr/local/bin/elf_reader.py to 755
changing mode of /wrkdirs/usr/ports/vrt/py-lief/work-py38/stage/usr/local/bin/macho_reader.py to 755
changing mode of /wrkdirs/usr/ports/vrt/py-lief/work-py38/stage/usr/local/bin/pe_reader.py to 755
writing list of installed files to '/wrkdirs/usr/ports/vrt/py-lief/work-py38/.PLIST.pymodtmp'
====> Compressing man pages (compress-man)
===========================================================================
====> Running Q/A tests (stage-qa)
Warning: You have disabled the licenses framework with DISABLE_LICENSES, unable to run checks
Warning: Ignoring depends_blacklist QA test
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: %%PYTHON_SITELIBDIR%%/lief%%PYTHON_EXT_SUFFIX%%.so
===> Checking for items in pkg-plist which are not in STAGEDIR
Error: Missing: %%PYTHON_SITELIBDIR%%/f-0.11.4/lief%%PYTHON_EXT_SUFFIX%%.so
===> Error: Plist issues found.
*** Error code 1

Stop.
make: stopped in /usr/ports/vrt/py-lief
=>> Error: check-plist failures detected
=======================<phase: Interactive    >============================
[00:28:43] Installing packages
[00:28:43] Installing run-depends for vrt/py-lief | py38-lief-0.11.4
===>   py38-lief-0.11.4 depends on package: py38-setuptools>0 - found
===>   py38-lief-0.11.4 depends on file: /usr/local/bin/python3.8 - found
[00:28:43] Installing vrt/py-lief | py38-lief-0.11.4
pkg-static: /tmp/pkgs/py38-lief-0.11.4.txz: No such file or directory
pkg-static: Was 'pkg install /tmp/pkgs/py38-lief-0.11.4.txz' meant?

Failed to install the following 1 package(s): /tmp/pkgs/py38-lief-0.11.4.txz
*** Error code 1

Stop.
make: stopped in /usr/ports/vrt/py-lief
[00:28:43] Warning: Failed to install vrt/py-lief | py38-lief-0.11.4
[00:28:43] Installing local Pkg repository to /usr/local/etc/pkg/repos
[00:28:43] Entering interactive test mode. Type 'exit' when done.
FreeBSD ?.?.?  (UNKNOWN)

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
FreeBSD Forums:        https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

Edit /etc/motd to change this login announcement.
root@122R-dvl:~ # 

@romainthomas
Copy link

Ack but these scripts aims at packaging the Python bindings or the SDK (or both) ?

@dlangille
Copy link
Author

I'm sorry, I don't know enough to answer that information.

I'm attempting to package lief.

The process relies heavily upon the setup.py file provided in the tarball for what to package. If that does not answer your question, I can pull in someone who knows more about the Python packaging process.

@romainthomas
Copy link

Sorry I'm quite noob with FreeBSD.

So far, I used to package python projects like this:

  • python ./setup.py install (tested on FreeBSD 13)
  • pip install [--user] lief (I didn't compiled wheels for FreeBSD but I could do it)

Let's me know you thoughts regarding the way you tried to package it.

@dlangille
Copy link
Author

I had a more experienced FreeBSD Python packager look at this. They said:

  • i wouldnt be surprised if cmake is part of this issue, how/when is it ivoked? usually properly packaged pypi packages dont need cmake, and only setuptools
  • i wouldnt be using cmake at all
  • it looks like they invoke cmake directly, which then runs the setuptools bits
  • this is weird.
  • they should use cmake @ dev time, to produce the sdist, that is already processed and the resulting sdist uploaded
  • remove the cmake, and just use distutils autoplist
  • let us know how the behaviour changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment