vmprof / vmprof-python

vmprof - a statistical program profiler
http://vmprof.com
Other
433 stars 54 forks source link

FreeBSD [11] support? #168

Open AlmightyOatmeal opened 6 years ago

AlmightyOatmeal commented 6 years ago

Any plans to support FreeBSD 11 or FreeBSD in general?

Is there something about FreeBSD that makes vmprof not work?

$ sudo -H pip install --upgrade vmprof
Collecting vmprof
  Downloading vmprof-0.4.11.tar.gz (288kB)
    100% |████████████████████████████████| 296kB 1.4MB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-xI8k6f/vmprof/setup.py", line 69, in <module>
        raise NotImplementedError("platform '%s' is not supported!" % sys.platform)
    NotImplementedError: platform 'freebsd11' is not supported!

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-xI8k6f/vmprof/
$ uname -a
FreeBSD irony 11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: Tue Nov 14 06:12:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
planrich commented 6 years ago

no, there are just a few places that are platform dependent. other unix variants simply are not tested. It should be easy to modify the setup.py file to make it compile on other unix variants.

planrich commented 6 years ago

ok, this seems to work... can you give that a try (do not pull from pypi, but from this repo directly)? You need to install some packages on freebsd (such as libunwind and python).

jmgurney commented 2 years ago

Ok, just tried this on FreeBSD 14-current/aarch64 and got:

$ uname -a
FreeBSD generic 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n254105-d53927b0bae: Thu Mar 31 09:26:31 UTC 2022     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC arm64
$ pip install 'git+https://github.com/vmprof/vmprof-python.git#egg=vmprof'
[...]
Installing collected packages: pytz, certifi, urllib3, six, idna, colorama, charset-normalizer, requests, vmprof                                                                              
  Running setup.py install for vmprof ... error                                                
  error: subprocess-exited-with-error                                                          

  × Running setup.py install for vmprof did not run successfully.
  │ exit code: 1
  ╰─> [188 lines of output]
      running install
      running build
      running build_py
      checking build system type... aarch64-unknown-freebsd14.0
      checking host system type... aarch64-unknown-freebsd14.0
      checking target system type... aarch64-unknown-freebsd14.0
      checking for gcc... no
      checking for cc... cc
      checking for C compiler default output file name... a.out
      checking whether the C compiler works... yes
      checking whether we are cross compiling... no
      checking for suffix of executables...
      checking for suffix of object files... o
      checking whether we are using the GNU C compiler... yes
      checking whether cc accepts -g... yes
      checking for cc option to accept ISO C89... none needed
      checking how to run the C preprocessor... cc -E
      checking for grep that handles long lines and -e... /usr/bin/grep
      checking for egrep... /usr/bin/grep -E
      checking for ANSI C header files... yes
      checking for sys/types.h... yes
      checking for sys/stat.h... yes
      checking for stdlib.h... yes
      checking for string.h... yes
      checking for memory.h... yes
      checking for strings.h... yes
      checking for inttypes.h... yes
      checking for stdint.h... yes
      checking for unistd.h... yes
      checking minix/config.h usability... no
      checking minix/config.h presence... no
      checking for minix/config.h... no
      checking whether it is safe to define __EXTENSIONS__... yes
      checking for a BSD-compatible install... /usr/bin/install -c               
      checking whether build environment is sane... yes                                        
      /bin/sh: cannot open /tmp/pip-install-7tvqhllr/vmprof_80088ad083bd41fbaf7bcb1d22cb03d1/src/libbacktrace/missing: No such file or directory                                              
      configure: WARNING: `missing' script is too old or missing                               
      checking for a thread-safe mkdir -p... ./install-sh -c -d                                
      checking for gawk... no                                                                  
      checking for mawk... no                                                                                                                                                                 
      checking for nawk... nawk                                                                
      checking whether make sets $(MAKE)... yes                                                
      checking whether to enable maintainer-specific portions of Makefiles... no               
      checking whether we are using the GNU C compiler... (cached) yes
      checking whether cc accepts -g... (cached) yes
      checking for cc option to accept ISO C89... (cached) none needed
      checking for ranlib... ranlib
      checking for gawk... (cached) nawk
      checking how to print strings... printf
      checking for a sed that does not truncate output... /usr/bin/sed
      checking for fgrep... /usr/bin/grep -F                                                   
      checking for ld used by cc... /usr/bin/ld                                                
      checking if the linker (/usr/bin/ld) is GNU ld... yes
      checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
      checking the name lister (/usr/bin/nm) interface... BSD nm
      checking whether ln -s works... yes                                                      
      checking the maximum length of command line arguments... 393216
      checking whether the shell understands some XSI constructs... yes
      checking whether the shell understands "+="... no
      checking for /usr/bin/ld option to reload object files... -r
      checking for objdump... no           
      checking how to recognize dependent libraries... pass_all
      checking for ar... ar                                                                    
      checking for strip... strip                                                              
      checking for ranlib... (cached) ranlib
      checking command to parse /usr/bin/nm output from cc object... ok
      checking for dlfcn.h... yes    
      checking for objdir... .libs  
      checking if cc supports -fno-rtti -fno-exceptions... yes
      checking for cc option to produce PIC... -fPIC -DPIC
      checking if cc PIC flag -fPIC -DPIC works... yes
      checking if cc static flag -static works... yes
      checking if cc supports -c -o file.o... yes
      checking if cc supports -c -o file.o... (cached) yes
      checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
      checking whether -lc should be explicitly linked in... no
      checking dynamic linker characteristics... freebsd14.0 ld.so
      checking how to hardcode library paths into programs... immediate
      checking whether stripping libraries is possible... no     
      checking if libtool supports shared libraries... yes                       
      checking whether to build shared libraries... yes                                        
      checking whether to build static libraries... yes                                                                                                                                       
      checking unwind.h usability... yes                                                       
      checking unwind.h presence... yes                                                        
      checking for unwind.h... yes                                                             
      checking for _Unwind_Backtrace... yes                                                                                                                                                   
      checking for -funwind-tables option... yes                                               
      checking for -frandom-seed=string option... yes                                          
      checking whether cc supports -W... yes                                                   
      checking whether cc supports -Wall... yes                                                
      checking whether cc supports -Wwrite-strings... yes
      checking whether cc supports -Wstrict-prototypes... yes         
      checking whether cc supports -Wmissing-prototypes... yes
      checking whether cc supports -Wold-style-definition... yes
      checking whether cc supports -Wmissing-format-attribute... yes
      checking whether cc supports -Wcast-qual... yes                 
      checking for _Unwind_GetIPInfo... yes                                                    
      checking __sync extensions... yes                                                        
      checking __atomic extensions... yes                                                      
      checking output filetype... elf64                                                        
      looking for a compliant stdint.h in stdint.h, checking for uintmax_t... yes
      checking for uintptr_t... yes                                                            
      checking for int_least32_t... yes                                                        
      checking for int_fast32_t... yes                                                         
      checking for uint64_t... yes                                                             
      checking what to include in gstdint.h... stdint.h (already complete)
      checking sys/mman.h usability... yes 
      checking sys/mman.h presence... yes                                                      
      checking for sys/mman.h... yes                                                           
      checking for mmap... yes                                                                 
      checking link.h usability... yes      
      checking link.h presence... yes                                                          
      checking for link.h... yes     
      checking for dl_iterate_phdr... yes
      checking for fcntl... yes                                                                
      checking whether strnlen is declared... yes         
      checking for getexecname... no                                                           
      checking whether tests can run... yes                                                    
      configure: creating ./config.status                                                      
      config.status: creating Makefile                                                         
      config.status: creating backtrace-supported.h                                
      config.status: creating config.h                                                         
      config.status: config.h is unchanged                                                     
      config.status: executing libtool commands                                                
      sed: ./ltmain.sh: No such file or directory                
      sed: ./ltmain.sh: No such file or directory                                
      mv: rename libtoolT to libtool: No such file or directory                                
      cp: libtoolT: No such file or directory                                                                                                                                                 
      chmod: libtool: No such file or directory                                                
      config.status: executing gstdint.h commands                                              
      config.status: executing default commands                                                
      creating build                                                                                                                                                                          
      creating build/lib.freebsd-14.0-CURRENT-arm64-3.9                                        
      creating build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmshare                                
      copying vmshare/__init__.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmshare          
      copying vmshare/service.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmshare           
      copying vmshare/binary.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmshare
      creating build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof        
      copying vmprof/reader.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof
      copying vmprof/upload.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof
      copying vmprof/__main__.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof
      copying vmprof/__init__.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof
      copying vmprof/stats.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof               
      copying vmprof/cli.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof                 
      copying vmprof/profiler.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof            
      copying vmprof/show.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof                
      creating build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog                   
      copying jitlog/objects.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog             
      copying jitlog/upload.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog              
      copying jitlog/__main__.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog            
      copying jitlog/__init__.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog            
      copying jitlog/prettyprinter.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog
      copying jitlog/constants.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog
      copying jitlog/query.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog               
      copying jitlog/merge_point.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog         
      copying jitlog/parser.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog              
      copying jitlog/marks.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog
      creating build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof/test                            
      copying vmprof/test/__init__.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof/test
      copying vmprof/test/sqlite.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof/test
      copying vmprof/test/cpuburn.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof/test   
      copying vmprof/test/test_c_symboltable.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof/test
      copying vmprof/test/test_reader.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof/test
      copying vmprof/test/test_config.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof/test
      copying vmprof/test/test_stats.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof/test 
      copying vmprof/test/test_c_source.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof/test
      copying vmprof/test/test_run.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/vmprof/test
      creating build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog/test                            
      copying jitlog/test/test_query.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog/test 
      copying jitlog/test/__init__.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog/test  
      copying jitlog/test/test_jitlog.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog/test
      copying jitlog/test/test_encoding.py -> build/lib.freebsd-14.0-CURRENT-arm64-3.9/jitlog/test
      running build_ext                                                                        
      building '_vmprof' extension                                                             
      creating build/temp.freebsd-14.0-CURRENT-arm64-3.9                                       
      creating build/temp.freebsd-14.0-CURRENT-arm64-3.9/src                                   
      creating build/temp.freebsd-14.0-CURRENT-arm64-3.9/src/libbacktrace                      
      cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -I/tmp/l/p/include -I/usr/local/include/python3.
9 -c src/_vmprof.c -o build/temp.freebsd-14.0-CURRENT-arm64-3.9/src/_vmprof.o -Wno-unused -DVMPROF_BSD=1 -I/usr/local/include -DVMPROF_UNIX=1 -I src/ -I src/libbacktrace
      In file included from src/_vmprof.c:12:                                                  
      In file included from src/vmprof_common.h:19:                                            
      src/vmprof_getpc.h:147:27: error: no member named 'mc_rip' in 'struct __mcontext'        
        return signal_ucontext->PC_FROM_UCONTEXT;   // defined in config.h              
               ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~                                    
      src/vmprof_config.h:11:42: note: expanded from macro 'PC_FROM_UCONTEXT'                  
          #define PC_FROM_UCONTEXT uc_mcontext.mc_rip                                          
                                               ^                                               
      1 error generated.                                                                       
      error: command '/usr/bin/cc' failed with exit code 1                                     
      [end of output]                                                                          

  note: This error originates from a subprocess, and is likely not a problem with pip.         
error: legacy-install-failure                                                                                                                                                                 

× Encountered error while trying to install package.                                                                                                                                          
╰─> vmprof                                                                                                                                                                                    

note: This is an issue with the package mentioned above, not pip.                            
hint: See above for output from the failure.                                                   

My 11/amd64 box doesn't have native unwind.h on it, and don't want to install the libunwind package, so can't test there.

jmgurney commented 2 years ago

I'm willing to pair and/or provide access to a box to help fix this if that would help. or, as you can see, I can test out branches very easily if provided.