Project

General

Profile

Actions

Bug #20147

open

FreeBSD libyaml

Added by kaiquekandykoga (Kaíque Koga) about 1 year ago. Updated about 1 month ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:116009]

Description

I use ruby-install to manage multiple Ruby versions. Some time ago I had issues installing Ruby 3.2.2 https://github.com/postmodern/ruby-install/issues/463, and the same issue was open for ruby-build in https://github.com/rbenv/ruby-build/issues/2184. I am trying to install Ruby 3.3.0 using ruby-install, and the same behaviour is occurring. Please, take a look in the links I have provided for detailed information.

/usr/home/kandy/src/ruby-3.3.0/lib/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
uh-oh! RDoc had a problem:
cannot load such file -- psych

run with --debug for full backtrace
*** Error code 1

Stop.
make: stopped in /usr/home/kandy/src/ruby-3.3.0
!!! Compiling ruby 3.3.0 failed!

Thank you.

Updated by hsbt (Hiroshi SHIBATA) about 1 year ago

I could install Ruby 3.2.2 on FreeBSD 14.0 with ruby-build and the following configuration.

./configure "--prefix=$HOME/.rbenv/versions/3.1.3" --enable-shared --with-readline-dir=/usr/local --with-libffi-dir=/usr/local --with-libyaml-dir=/usr/local --with-openssl-dir=/usr/local --with-ext=openssl,psych,+ --disable-dtrace

I'm not sure why FreeBSD didn't detect headers from /usr/local implicitly.

Updated by kaiquekandykoga (Kaíque Koga) about 1 year ago

The day I reported this bug I was still able to compile Ruby using master. Today I have decided to try compiling again from master, before compiling I have fetched from upstream and the compilation was not working anymore. If I use the 7f9c174102d0e2369befc7b88f2c073becaa7560 that is the last commit from January 5 is compiling. I am trying to find what was the recent commit that broke the compilation, at least for me. I have upgraded my machine recently, and I am using FreeBSD 14.0-RELEASE-p4 at the present.

Updated by kaiquekandykoga (Kaíque Koga) about 1 year ago

The 76afbda5b566148b9e73939e0ff9b8464d59806c. The last commit from January 6 is not compiling. It seems that something was changed on January 6 that broke the compilation in my environment.

Updated by kaiquekandykoga (Kaíque Koga) about 1 year ago

Analyzing the changes made on January 6. From 9b78ef75522b1f6aa20fc81ddf06e5fb40db152d I am not able to compile. Even though the previous commits I can compile, the message of yaml.h not being found keep showing up.

Updated by kaiquekandykoga (Kaíque Koga) about 1 month ago

I am doing some research around UNIX programming, and I have decided to understand a bit further about how include directive looks for paths.

I am currently using FreeBSD 14.0-RELEASE.

kandy@freebsd:~ $ freebsd-version
14.0-RELEASE

I have gcc and clang.

kandy@freebsd:~ $ gcc --version
gcc (FreeBSD Ports Collection) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
kandy@freebsd:~ $ clang --version
FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152)
Target: x86_64-unknown-freebsd14.0
Thread model: posix
InstalledDir: /usr/bin

How am I verifying the include directive?

Create main.c with something like

kandy@freebsd:~ $ cat main.c
int main()
{
        return 0;
}

With gcc

kandy@freebsd:~ $ gcc -v main.c
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/lto-wrapper
Target: x86_64-portbld-freebsd14.1
Configured with: /wrkdirs/usr/ports/lang/gcc13/work/gcc-13.3.0/configure --enable-multilib --with-build-config=bootstrap-debug --disable-nls --enable-gnu-indirect-function --enable-host-shared --enable-plugin --libdir=/usr/local/lib/gcc13 --libexecdir=/usr/local/libexec/gcc13 --program-suffix=13 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc13/include/c++/ --with-gxx-libcxx-include-dir=/usr/include/c++/v1 --with-ld=/usr/local/bin/ld --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --without-zstd --enable-languages=c,c++,objc,fortran,jit --prefix=/usr/local --localstatedir=/var --mandir=/usr/local/share/man --infodir=/usr/local/share/info/gcc13 --build=x86_64-portbld-freebsd14.1
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.3.0 (FreeBSD Ports Collection)
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
 /usr/local/libexec/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/cc1 -quiet -v main.c -quiet -dumpdir a- -dumpbase main.c -dumpbase-ext .c -mtune=generic -march=x86-64 -version -o /tmp//ccKZaZAx.s
GNU C17 (FreeBSD Ports Collection) version 13.3.0 (x86_64-portbld-freebsd14.1)
        compiled by GNU C version 13.3.0, GMP version 6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/include-fixed"
ignoring nonexistent directory "/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/../../../../../x86_64-portbld-freebsd14.1/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/include
 /usr/local/include
 /usr/include
End of search list.
Compiler executable checksum: 3c47ef89548a28bf388bdc1461d3116e
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
 /usr/local/bin/as -v -o /tmp//ccrwI8Gg.o /tmp//ccKZaZAx.s
GNU assembler version 2.43.1 (x86_64-portbld-freebsd14.1) using BFD version (GNU Binutils) 2.43.1
COMPILER_PATH=/usr/local/libexec/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/:/usr/local/libexec/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/:/usr/local/libexec/gcc13/gcc/x86_64-portbld-freebsd14.1/:/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/:/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.1/:/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/../../../../../x86_64-portbld-freebsd14.1/bin/
LIBRARY_PATH=/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/:/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/../../../../../x86_64-portbld-freebsd14.1/lib/:/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a.'
 /usr/local/libexec/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/collect2 -plugin /usr/local/libexec/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/liblto_plugin.so -plugin-opt=/usr/local/libexec/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp//ccqbVNSp.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64_fbsd -V -dynamic-linker /libexec/ld-elf.so.1 /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/crtbegin.o -L/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0 -L/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/../../../../../x86_64-portbld-freebsd14.1/lib -L/usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/../../.. /tmp//ccrwI8Gg.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.1/13.3.0/crtend.o /usr/lib/crtn.o
GNU ld (GNU Binutils) 2.43.1
  Supported emulations:
   aix5ppc
   aix5rs6
   aixppc
   aixrs6
   alpha
   alphavms
   arcelf
   arclinux
   arclinux_nps
   arcv2elf
   arcv2elfx
   arm_wince_pe
   armelf
   armelf_fbsd
   armelf_fuchsia
   armelf_haiku
   armelf_linux
   armelf_linux_eabi
   armelf_linux_fdpiceabi
   armelf_nacl
   armelf_nbsd
   armelf_phoenix
   armelf_vxworks
   armelfb
   armelfb_fbsd
   armelfb_fuchsia
   armelfb_linux
   armelfb_linux_eabi
   armelfb_linux_fdpiceabi
   armelfb_nacl
   armelfb_nbsd
   armnto
   armpe
   avr1
   avr2
   avr25
   avr3
   avr31
   avr35
   avr4
   avr5
   avr51
   avr6
   avrtiny
   avrxmega1
   avrxmega2
   avrxmega2_flmap
   avrxmega3
   avrxmega4
   avrxmega4_flmap
   avrxmega5
   avrxmega6
   avrxmega7
   crisaout
   criself
   crislinux
   cskyelf
   cskyelf_linux
   d10velf
   d30v_e
   d30v_o
   d30velf
   elf32_dlx
   elf32_sparc
   elf32_sparc_sol2
   elf32_sparc_vxworks
   elf32_spu
   elf32_tic6x_be
   elf32_tic6x_elf_be
   elf32_tic6x_elf_le
   elf32_tic6x_le
   elf32_tic6x_linux_be
   elf32_tic6x_linux_le
   elf32am33lin
   elf32bfin
   elf32bfinfd
   elf32cr16
   elf32crx
   elf32epiphany
   elf32epiphany_4x4
   elf32fr30
   elf32frv
   elf32frvfd
   elf32ft32
   elf32ip2k
   elf32iq10
   elf32iq2000
   elf32lm32
   elf32lm32fd
   elf32lppc
   elf32lppclinux
   elf32lppcnto
   elf32lppcsim
   elf32m32c
   elf32mb_linux
   elf32mbel_linux
   elf32mcore
   elf32mep
   elf32metag
   elf32microblaze
   elf32microblazeel
   elf32moxie
   elf32mt
   elf32or1k
   elf32or1k_linux
   elf32ppc
   elf32ppc_fbsd
   elf32ppchaiku
   elf32ppclinux
   elf32ppcnto
   elf32ppcsim
   elf32ppcvxworks
   elf32ppcwindiss
   elf32rl78
   elf32rx
   elf32rx_linux
   elf32tilegx
   elf32tilegx_be
   elf32tilepro
   elf32vax
   elf32visium
   elf32xstormy16
   elf32xtensa
   elf32z80
   elf_i386
   elf_i386_be
   elf_i386_fbsd
   elf_i386_haiku
   elf_i386_ldso
   elf_i386_sol2
   elf_i386_vxworks
   elf_iamcu
   elf_s390
   h8300elf
   h8300elf_linux
   h8300helf
   h8300helf_linux
   h8300hnelf
   h8300self
   h8300self_linux
   h8300snelf
   h8300sxelf
   h8300sxelf_linux
   h8300sxnelf
   hppaelf
   hppalinux
   hppanbsd
   hppaobsd
   i386aout
   i386beos
   i386bsd
   i386go32
   i386lynx
   i386moss
   i386msdos
   i386nto
   i386pe
   i386pe_posix
   m32relf
   m32relf_linux
   m32rlelf
   m32rlelf_linux
   m68hc11elf
   m68hc11elfb
   m68hc12elf
   m68hc12elfb
   m68kelf
   m68kelfnbsd
   m9s12zelf
   mcorepe
   mn10200
   mn10300
   moxiebox
   msp430X
   msp430elf
   nds32belf
   nds32belf16m
   nds32belf_linux
   nds32elf
   nds32elf16m
   nds32elf_linux
   nios2elf
   nios2linux
   ns32knbsd
   pc532macha
   pdp11
   pjelf
   pjlelf
   ppcmacos
   pruelf
   score3_elf
   score7_elf
   sh
   shelf
   shelf_fd
   shelf_linux
   shelf_nbsd
   shelf_nto
   shelf_uclinux
   shelf_vxworks
   shl
   shlelf
   shlelf_fd
   shlelf_linux
   shlelf_nbsd
   shlelf_nto
   shlelf_vxworks
   shpe
   tic30coff
   tic3xcoff
   tic3xcoff_onchip
   tic4xcoff
   tic54xcoff
   v850
   v850_rh850
   vanilla
   vaxnbsd
   xgateelf
   z80
   z8001
   z8002
   aarch64cloudabi
   aarch64cloudabib
   aarch64elf
   aarch64elf32
   aarch64elf32b
   aarch64elfb
   aarch64fbsd
   aarch64fbsdb
   aarch64haiku
   aarch64linux
   aarch64linux32
   aarch64linux32b
   aarch64linuxb
   aarch64nto
   aarch64pe
   arm64pe
   elf32_x86_64
   elf32b4300
   elf32bmip
   elf32bmipn32
   elf32briscv
   elf32briscv_ilp32
   elf32briscv_ilp32f
   elf32bsmip
   elf32btsmip
   elf32btsmip_fbsd
   elf32btsmipn32
   elf32btsmipn32_fbsd
   elf32ebmip
   elf32ebmipvxworks
   elf32elmip
   elf32elmipvxworks
   elf32kvx
   elf32l4300
   elf32lmip
   elf32loongarch
   elf32lr5900
   elf32lr5900n32
   elf32lriscv
   elf32lriscv_ilp32
   elf32lriscv_ilp32f
   elf32lsmip
   elf32ltsmip
   elf32ltsmip_fbsd
   elf32ltsmipn32
   elf32ltsmipn32_fbsd
   elf32mipswindiss
   elf64_aix
   elf64_ia64
   elf64_ia64_fbsd
   elf64_ia64_vms
   elf64_s390
   elf64_sparc
   elf64_sparc_fbsd
   elf64_sparc_sol2
   elf64alpha
   elf64alpha_fbsd
   elf64alpha_nbsd
   elf64bmip
   elf64bpf
   elf64briscv
   elf64briscv_lp64
   elf64briscv_lp64f
   elf64btsmip
   elf64btsmip_fbsd
   elf64hppa
   elf64kvx
   elf64kvx_linux
   elf64loongarch
   elf64lppc
   elf64lppc_fbsd
   elf64lriscv
   elf64lriscv_lp64
   elf64lriscv_lp64f
   elf64ltsmip
   elf64ltsmip_fbsd
   elf64mmix
   elf64ppc
   elf64ppc_fbsd
   elf64rdos
   elf64tilegx
   elf64tilegx_be
   elf_mipsel_haiku
   elf_x86_64
   elf_x86_64_cloudabi
   elf_x86_64_fbsd
   elf_x86_64_haiku
   elf_x86_64_sol2
   hppa64linux
   i386pep
   mmo
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a.'

With clang

kandy@freebsd:~ $ clang -v main.c
FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152)
Target: x86_64-unknown-freebsd14.0
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/clang" -cc1 -triple x86_64-unknown-freebsd14.0 -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.c -mrelocation-model static -mframe-pointer=all -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/kandy -resource-dir /usr/lib/clang/16 -internal-isystem /usr/lib/clang/16/include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/home/kandy -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/main-cfa8b8.o -x c main.c
clang -cc1 version 16.0.6 based upon LLVM 16.0.6 default target x86_64-unknown-freebsd14.0
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/clang/16/include
 /usr/include
End of search list.
 "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o a.out /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib /tmp/main-cfa8b8.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o

It seems that the include directive in gcc looks for /usr/local/include, however the include directive in clang does not look for /usr/local/include.
In FreeBSD, the clang is what comes with the base system.

kandy@freebsd:~ $ cc --version
FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152)
Target: x86_64-unknown-freebsd14.0
Thread model: posix
InstalledDir: /usr/bin

Updated by Dan0042 (Daniel DeLorme) about 1 month ago

kaiquekandykoga (Kaíque Koga) wrote in #note-5:

It seems that the include directive in gcc looks for /usr/local/include, however the include directive in clang does not look for /usr/local/include.

That sounds about right. When compiling Ruby on FreeBSD, I have this at the beginning of my script to make everything flow smoothly:

v=" -I/usr/local/include"; [[ $CPPFLAGS = *"$v"* ]] || export CPPFLAGS+="$v"
v=" -L/usr/local/lib";     [[ $LIBS     = *"$v"* ]] || export LIBS+="$v"

As a result, RbConfig::CONFIG contains the /usr/local directories and that makes gem install also flow smoothly (iirc)

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0