Skip to content

Instantly share code, notes, and snippets.

@cognifloyd
Last active December 5, 2020 03:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cognifloyd/f4ff46e3dcfd48ca9827c32e04a8fe90 to your computer and use it in GitHub Desktop.
Save cognifloyd/f4ff46e3dcfd48ca9827c32e04a8fe90 to your computer and use it in GitHub Desktop.
Gentoo Prefix Bootstrap for Mac OS X Catalina
Please see https://github.com/cognifloyd/prefix/blob/wip_darwin/scripts/bootstrap-prefix.sh
@cognifloyd
Copy link
Author

OK. This passes stage1, but fails right away with stage2. (as of revision 7)

@cognifloyd
Copy link
Author

rev8 starts phase2 successfully (need to manually revbump gentoo-functions.sh ebuild as indicated in a comment until portage tree snapshot gets updated).
It successfully installs gentoo-functions, elt-patches, and ncurses, but dies with missing symbols on readline.

libtool: link: clang -m64 -dynamiclib  -o .libs/libreadline.8.0.0.dylib  .libs/readline.o .libs/vi_mode.o .libs/funmap.o .libs/keymaps.o .libs/parens.o .libs/search.o .libs/rltty.o .libs/complete.o .libs/bind.o .libs/isearch.o .libs/display.o .libs/signals.o .libs/util.o .libs/kill.o .libs/undo.o .libs/macro.o .libs/input.o .libs/callback.o .libs/terminal.o .libs/text.o .libs/nls.o .libs/misc.o .libs/history.o .libs/histexpand.o .libs/histfile.o .libs/histsearch.o .libs/shell.o .libs/mbutil.o .libs/tilde.o .libs/colors.o .libs/parse-colors.o .libs/xmalloc.o .libs/xfree.o .libs/compat.o   -L/shlib -L/Users/cognifloyd/Gentoo/tmp/usr/lib -L. -lncurses  -m64 -Wl,-search_paths_first -march=native -O2   -install_name  /Users/cognifloyd/Gentoo/tmp/usr/lib/libreadline.8.dylib -compatibility_version 9 -current_version 9.0 -Wl,-single_module
ld: warning: directory not found for option '-L/shlib'
libtool: link: ( cd ".libs" && rm -f "libhistory.la" && ln -s "../libhistory.la" "libhistory.la" )
Undefined symbols for architecture x86_64:
  "_BC", referenced from:
      __rl_init_terminal_io in terminal.o
  "_PC", referenced from:
      __rl_init_terminal_io in terminal.o
  "_UP", referenced from:
      __rl_init_terminal_io in terminal.o
  "_tgetent", referenced from:
      __rl_init_terminal_io in terminal.o
  "_tgetflag", referenced from:
      __rl_init_terminal_io in terminal.o
  "_tgetnum", referenced from:
      __rl_get_screen_size in terminal.o
  "_tgetstr", referenced from:
      __rl_init_terminal_io in terminal.o
  "_tgoto", referenced from:
      _update_line in display.o
  "_tputs", referenced from:
      _rl_redisplay in display.o
      _update_line in display.o
      __rl_clear_to_eol in display.o
      __rl_move_vert in display.o
      __rl_move_cursor_relative in display.o
      _rl_clear_visible_line in display.o
      __rl_clear_screen in display.o
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@cognifloyd
Copy link
Author

cognifloyd commented Nov 27, 2020

rev10 gets mostly through stage2. It finishes all the llvm deps, but does not build llvm yet.

Take note of cognifloyd_update_tree as this changes a couple of things in the portage tree to get this far.

Three things in bash-5.1_rc3.ebuild:

  • add return 0 to the top of is_release function so it reuses the readline we just built.
  • add { and } to the sed regex where it is looking for $(RL_...) it also needs to handle ${RL_...}
  • comment out this line: [[ "${PV}" == *_rc* ]] || \ just before KEYWORDS= which serves to make it available on x64-macos despite being a rc.

Significant version bump for binutils-apple including a new ebuild and updated patches. I'm posting these changes at https://bugs.gentoo.org/693444

adjust cmake ebuild and a cmake patch:

  • cmake-3.13.4-prefix-dirs.patch adds the MacOS.sdk Frameworks path. Adjust the Darwin.cmake section to look like this:
 # Older OS X linkers do not report their framework search path
@@ -132,6 +132,9 @@ endif()
 
 # set up the default search directories for frameworks
 set(CMAKE_SYSTEM_FRAMEWORK_PATH
+  @GENTOO_PORTAGE_EPREFIX@MacOSX.sdk/System/Library/Frameworks
+  @GENTOO_PORTAGE_EPREFIX@Frameworks
+  @GENTOO_PORTAGE_EPREFIX@usr/lib
   ~/Library/Frameworks
   )
 if(_CMAKE_OSX_SYSROOT_PATH)
@@ -178,13 +181,15 @@ if(CMAKE_OSX_SYSROOT)
   endif()
  • add this to cmake_src_bootstrap in cmake-3.13.5.ebuild (I put it right after the sed ... bootstrap lines):
	local sdk_frameworks="${EPREFIX}/MacOSX.sdk/System/Library/Frameworks"
	if [[ -d "${sdk_frameworks}" ]]; then
		# ensure frameworks are found for darwin prefix
		append-cflags $(test-flags-CC "-F${sdk_frameworks}")
		append-cxxflags $(test-flags-CXX "-F${sdk_frameworks}")
	fi

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