'compile linux kernel on mac os x: clang error
I Wanna compile the linux kernel 2.6 on my mac osx 10.10, so I followed the steps: Linux kernel development and debugging using Eclipse CDT.
But I came across the problem at the step: make menuconfig O=/mnt/build/linux-2.6. And the error is below, what should I do?
GEN /mnt/build/linux-2.6/Makefile
HOSTLD scripts/kconfig/mconf
Undefined symbols for architecture x86_64:
"_COLS", referenced from:
_dialog_checklist in checklist.o
_dialog_clear in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
"_LINES", referenced from:
_dialog_checklist in checklist.o
_dialog_clear in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
"_acs_map", referenced from:
_dialog_checklist in checklist.o
_print_arrows in checklist.o
_dialog_clear in util.o
_draw_box in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_dialog_yesno in yesno.o
...
"_cbreak", referenced from:
_reset_dialog in util.o
"_delwin", referenced from:
_dialog_checklist in checklist.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
"_doupdate", referenced from:
_dialog_checklist in checklist.o
"_endwin", referenced from:
_end_dialog in util.o
"_flash", referenced from:
_dialog_inputbox in inputbox.o
"_getcurx", referenced from:
_print_autowrap in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_print_line in textbox.o
_print_arrows in menubox.o
"_getcury", referenced from:
_print_autowrap in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_print_line in textbox.o
_print_arrows in menubox.o
"_getmaxx", referenced from:
_dialog_checklist in checklist.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_refresh_text_box in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
"_getmaxy", referenced from:
_dialog_checklist in checklist.o
_attr_clear in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_refresh_text_box in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
...
"_has_colors", referenced from:
_init_dialog in util.o
_draw_shadow in util.o
"_init_pair", referenced from:
_init_dialog in util.o
"_initscr", referenced from:
_reset_dialog in util.o
"_keypad", referenced from:
_dialog_checklist in checklist.o
_reset_dialog in util.o
_on_key_esc in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
...
"_newwin", referenced from:
_dialog_checklist in checklist.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
"_nodelay", referenced from:
_on_key_esc in util.o
"_noecho", referenced from:
_reset_dialog in util.o
"_scrollok", referenced from:
_dialog_checklist in checklist.o
_dialog_textbox in textbox.o
_dialog_menu in menubox.o
"_start_color", referenced from:
_init_dialog in util.o
"_stdscr", referenced from:
_dialog_checklist in checklist.o
_dialog_clear in util.o
_reset_dialog in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
...
"_subwin", referenced from:
_dialog_checklist in checklist.o
_dialog_textbox in textbox.o
_dialog_menu in menubox.o
"_ungetch", referenced from:
_on_key_esc in util.o
"_waddch", referenced from:
_dialog_checklist in checklist.o
_print_item in checklist.o
_print_arrows in checklist.o
_attr_clear in util.o
_dialog_clear in util.o
_print_title in util.o
_print_button in util.o
...
"_waddnstr", referenced from:
_print_item in checklist.o
_print_arrows in checklist.o
_dialog_clear in util.o
_print_title in util.o
_print_autowrap in util.o
_print_button in util.o
_dialog_inputbox in inputbox.o
...
"_wattrset", referenced from:
_dialog_checklist in checklist.o
_print_item in checklist.o
_print_arrows in checklist.o
_attr_clear in util.o
_dialog_clear in util.o
_print_title in util.o
_print_button in util.o
...
"_wbkgdset", referenced from:
_dialog_textbox in textbox.o
_refresh_text_box in textbox.o
_dialog_menu in menubox.o
"_wclrtoeol", referenced from:
_print_line in textbox.o
_do_print_item in menubox.o
"_wgetch", referenced from:
_dialog_checklist in checklist.o
_on_key_esc in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
"_winch", referenced from:
_draw_shadow in util.o
"_wmove", referenced from:
_dialog_checklist in checklist.o
_print_item in checklist.o
_print_arrows in checklist.o
_attr_clear in util.o
_dialog_clear in util.o
_print_title in util.o
_print_autowrap in util.o
...
"_wnoutrefresh", referenced from:
_dialog_checklist in checklist.o
_dialog_clear in util.o
_draw_shadow in util.o
_dialog_textbox in textbox.o
_refresh_text_box in textbox.o
_dialog_menu in menubox.o
"_wprintw", referenced from:
_print_item in checklist.o
_dialog_textbox in textbox.o
_refresh_text_box in textbox.o
"_wrefresh", referenced from:
_dialog_checklist in checklist.o
_print_item in checklist.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_refresh_text_box in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
...
"_wscrl", referenced from:
_dialog_checklist in checklist.o
_dialog_textbox in textbox.o
_dialog_menu in menubox.o
"_wtouchln", referenced from:
_attr_clear in util.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [scripts/kconfig/mconf] Error 1
make[1]: *** [menuconfig] Error 2
make: *** [sub-make] Error 2
Solution 1:[1]
You can compile the Linux Kernel os OSX, but you first have to install ncurses. You can try to use brew to install it, but I like installing from source, so I found this:
$ curl -O ftp://ftp.gnu.org/gnu/ncurses/ncurses-5.9.tar.gz
$ tar -xzvf ncurses-5.9.tar.gz
$ cd ./ncurses-5.9
$ ./configure --prefix=/usr/local \
--without-cxx --without-cxx-binding --without-ada --without-progs --without-curses-h \
--with-shared --without-debug \
--enable-widec --enable-const --enable-ext-colors --enable-sigwinch --enable-wgetch-events \
&& make
$ sudo make install
You will probably also need --enable-pc-files , otherwise pkg-config won't see it (assuming you have pkg-config installed). Once that's done, you still have a problem: pkg-config reports the install location as something like "/usr/local/include/ncursesw" (which is where it is, so pkg-config is correct), but the internal include files all have
<ncursesw/xxx.h>
in them (at least ncurses.h and the unctrl.h file). This poses a catch-22 because linux uses some scripts that want to provide the pkg-config info, which is great, but then when the script (specifically /your-path-to-src/scripts/kconfig/lxdialog/check-lxdialog.sh) wants to compile a test program, it fails because pkg-config doesn't report "/usr/local/include" and "ncursesw/ncurses.h" appropriately back to the lxdialog/check-lxdialog.sh script. This causes a failure on macos. To fix this, I changed the ncurses includes to read:
<xxx.h>
I know this question is a little old, but I wanted to post SOMETHING as it took me a while to ferret this out.
Solution 2:[2]
To run make menuconfig on OSX, install below packages
brew install pkg-config ncurses
And add below line in your shell path.
export PKG_CONFIG_PATH="/usr/local/opt/ncurses/lib/pkgconfig"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | roboknight |
| Solution 2 | Mohit Singla |
