Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build in WSL ubuntu (cross compile) #293

Open
spoiledsport opened this issue Jan 14, 2017 · 8 comments
Open

Unable to build in WSL ubuntu (cross compile) #293

spoiledsport opened this issue Jan 14, 2017 · 8 comments

Comments

@spoiledsport
Copy link

I am unable to cross compile in Windows 10 WSL. Any idea what the problem could be? This is the last part of the build log. I am running the command
make CROSS_COMPILE=i686-w64-mingw32- -C tools/lkl

CC /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/iomem.o
CC /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/net.o
CC /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/jmp_buf.o
CC /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/nt-host.o
CC /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/utils.o
CC /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/virtio_blk.o
CC /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/virtio.o
CC /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/dbg.o
CC /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/dbg_handler.o
LD /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl-in.o
AR /home/edisonmcastro/src/lkl-linux/tools/lkl/liblkl.a
LINK /home/edisonmcastro/src/lkl-linux/tools/lkl/liblkl.dll
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function timekeeping_init': /home/edisonmcastro/src/lkl-linux/kernel/time/timekeeping.c:1496: undefined reference to clocksource_default_clock'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function clocksource_done_booting': /home/edisonmcastro/src/lkl-linux/kernel/time/clocksource.c:661: undefined reference to clocksource_default_clock'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function alloc_large_system_hash': /home/edisonmcastro/src/lkl-linux/mm/page_alloc.c:6964: undefined reference to __div64_32'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function cubictcp_register': /home/edisonmcastro/src/lkl-linux/net/ipv4/tcp_cubic.c:510: undefined reference to __div64_32'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function sys32_fadvise64_64': /home/edisonmcastro/src/lkl-linux/arch/lkl/kernel/syscalls_32.c:123: undefined reference to sys_fadvise64_64'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function lkl_idle_tail_schedule': /home/edisonmcastro/src/lkl-linux/arch/lkl/kernel/cpu.c:283: undefined reference to arch_cpu_idle_exit'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function mm_release': /home/edisonmcastro/src/lkl-linux/kernel/fork.c:1100: undefined reference to sys_futex'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function task_rcu_dereference': /home/edisonmcastro/src/lkl-linux/kernel/exit.c:233: undefined reference to probe_kernel_read'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function print_worker_info': /home/edisonmcastro/src/lkl-linux/kernel/workqueue.c:4270: undefined reference to probe_kernel_read'
/home/edisonmcastro/src/lkl-linux/kernel/workqueue.c:4271: undefined reference to probe_kernel_read' /home/edisonmcastro/src/lkl-linux/kernel/workqueue.c:4272: undefined reference to probe_kernel_read'
/home/edisonmcastro/src/lkl-linux/kernel/workqueue.c:4273: undefined reference to probe_kernel_read' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:/home/edisonmcastro/src/lkl-linux/kernel/workqueue.c:4276: more undefined references to probe_kernel_read' follow
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function register_die_notifier': /home/edisonmcastro/src/lkl-linux/kernel/notifier.c:555: undefined reference to vmalloc_sync_all'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function div_u64_rem': /home/edisonmcastro/src/lkl-linux/./include/linux/math64.h:66: undefined reference to __div64_32'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function cpu_idle_loop': /home/edisonmcastro/src/lkl-linux/kernel/sched/idle.c:249: undefined reference to arch_cpu_idle_exit'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function _ktime_divns': /home/edisonmcastro/src/lkl-linux/kernel/time/hrtimer.c:299: undefined reference to __div64_32'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function scale64_check_overflow': /home/edisonmcastro/src/lkl-linux/kernel/time/timekeeping.c:934: undefined reference to __div64_32'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function tk_setup_internals': /home/edisonmcastro/src/lkl-linux/kernel/time/timekeeping.c:253: undefined reference to __div64_32'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function mul_u64_u32_div': /home/edisonmcastro/src/lkl-linux/./include/linux/math64.h:236: undefined reference to __div64_32'
/home/edisonmcastro/src/lkl-linux/./include/linux/math64.h:239: undefined reference to __div64_32' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:/home/edisonmcastro/src/lkl-linux/kernel/time/timekeeping.c:1658: more undefined references to __div64_32' follow
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function panic': /home/edisonmcastro/src/lkl-linux/kernel/panic.c:169: undefined reference to bust_spinlocks'
/home/edisonmcastro/src/lkl-linux/kernel/panic.c:231: undefined reference to bust_spinlocks' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function _setup_per_zone_wmarks':
/home/edisonmcastro/src/lkl-linux/mm/page_alloc.c:6623: undefined reference to __div64_32' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function _wb_calc_thresh':
/home/edisonmcastro/src/lkl-linux/mm/page-writeback.c:781: undefined reference to __div64_32' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function wb_update_dirty_ratelimit':
/home/edisonmcastro/src/lkl-linux/./include/linux/math64.h:66: undefined reference to __div64_32' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function wb_update_write_bandwidth':
/home/edisonmcastro/src/lkl-linux/mm/page-writeback.c:1106: undefined reference to __div64_32' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o: In function div_u64_rem':
/home/edisonmcastro/src/lkl-linux/./include/linux/math64.h:66: undefined reference to __div64_32' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:/home/edisonmcastro/src/lkl-linux/./include/linux/math64.h:66: more undefined references to __div64_32' follow
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2620): undefined reference to sys_io_setup' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2624): undefined reference to sys_io_destroy'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2628): undefined reference to sys_io_submit' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x262c): undefined reference to sys_io_cancel'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2630): undefined reference to sys_io_getevents' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2668): undefined reference to sys_lookup_dcookie'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2688): undefined reference to sys_inotify_init1' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x268c): undefined reference to sys_inotify_add_watch'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2690): undefined reference to sys_inotify_rm_watch' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x26a0): undefined reference to sys_flock'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2710): undefined reference to sys_quotactl' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2748): undefined reference to sys_signalfd4'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2774): undefined reference to sys_timerfd_create' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2778): undefined reference to sys_timerfd_settime'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x277c): undefined reference to sys_timerfd_gettime' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2784): undefined reference to sys_acct'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x27a8): undefined reference to sys_futex' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x27ac): undefined reference to sys_set_robust_list'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x27b0): undefined reference to sys_get_robust_list' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x27c0): undefined reference to sys_kexec_load'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x27c4): undefined reference to sys_init_module' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x27c8): undefined reference to sys_delete_module'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x28f0): undefined reference to sys_mq_open' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x28f4): undefined reference to sys_mq_unlink'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x28f8): undefined reference to sys_mq_timedsend' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x28fc): undefined reference to sys_mq_timedreceive'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2900): undefined reference to sys_mq_notify' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2904): undefined reference to sys_mq_getsetattr'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2908): undefined reference to sys_msgget' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x290c): undefined reference to sys_msgctl'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2910): undefined reference to sys_msgrcv' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2914): undefined reference to sys_msgsnd'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2918): undefined reference to sys_semget' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x291c): undefined reference to sys_semctl'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2920): undefined reference to sys_semtimedop' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2924): undefined reference to sys_semop'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2928): undefined reference to sys_shmget' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x292c): undefined reference to sys_shmctl'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2930): undefined reference to sys_shmat' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2934): undefined reference to sys_shmdt'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2984): undefined reference to sys_add_key' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2988): undefined reference to sys_request_key'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x298c): undefined reference to sys_keyctl' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29a0): undefined reference to sys_swapon'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29a4): undefined reference to sys_swapoff' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29a8): undefined reference to sys_mprotect'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29ac): undefined reference to sys_msync' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29b0): undefined reference to sys_mlock'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29b4): undefined reference to sys_munlock' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29b8): undefined reference to sys_mlockall'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29bc): undefined reference to sys_munlockall' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29c0): undefined reference to sys_mincore'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29c4): undefined reference to sys_madvise' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29c8): undefined reference to sys_remap_file_pages'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29cc): undefined reference to sys_mbind' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29d0): undefined reference to sys_get_mempolicy'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29d4): undefined reference to sys_set_mempolicy' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29d8): undefined reference to sys_migrate_pages'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29dc): undefined reference to sys_move_pages' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x29e4): undefined reference to sys_perf_event_open'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2a38): undefined reference to sys_fanotify_init' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2a3c): undefined reference to sys_fanotify_mark'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2a58): undefined reference to sys_process_vm_readv' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2a5c): undefined reference to sys_process_vm_writev'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2a60): undefined reference to sys_kcmp' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2a64): undefined reference to sys_finit_module'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2a74): undefined reference to sys_seccomp' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2a7c): undefined reference to sys_memfd_create'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2a80): undefined reference to sys_bpf' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2a88): undefined reference to sys_userfaultfd'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2a90): undefined reference to sys_mlock2' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2aa0): undefined reference to sys_pkey_mprotect'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2aa4): undefined reference to sys_pkey_alloc' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x2aa8): undefined reference to sys_pkey_free'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x366c): undefined reference to sys_inotify_init' /home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x3674): undefined reference to sys_signalfd'
/home/edisonmcastro/src/lkl-linux/tools/lkl/lib/lkl.o:syscalls.c:(.data+0x36f4): undefined reference to sys_uselib' collect2: error: ld returned 1 exit status make: *** [/home/edisonmcastro/src/lkl-linux/tools/lkl/liblkl.dll] Error 1 make: Leaving directory /home/edisonmcastro/src/lkl-linux/tools/lkl'

@petrosagg
Copy link

petrosagg commented Jan 14, 2017

This is because you need patched binutils. See issue #289

EDIT: Issue #289 is about building on windows so unrelated, but you still need patched binutils. You can find pre-compiled binaries in tools/lkl/bin/ https://github.com/lkl/linux/tree/master/tools/lkl/bin . It should work if you add them in your $PATH

@spoiledsport
Copy link
Author

Even using those binaries, the build failed. I also have the same problem using Ubuntu 16.4 image running under Hyper-V on Windows 10. Anything else that I should be doing? Any commands I should run to verify that I am using the right version of binutils? I am also going to try to build under Windows with MSYS2 and see what happens.

Please let me know what you guys think

@Rondom
Copy link

Rondom commented Jan 16, 2017

You can find pre-compiled binaries in tools/lkl/bin/ https://github.com/lkl/linux/tree/master/tools/lkl/bin . It should work if you add them in your $PATH

@petrosagg Unfortunately no. If I remember it correctly, it does not work if you put them into the path. GCC will call the LD that is in the same directory as itself. It will not look in the path. I learned this the hard way myself :-(

(It has been some time, so please double-check and confirm that what I write above is correct)

@spoiledsport
Copy link
Author

Can you share you binary (64 or 32 bit) for windows if you have it, please? I also tried building in MSYS2 and I am not able to either. With the 64 bit shell, I am getting

$ make -C tools/lkl
make: Entering directory '/e/Dev/GitHub/lkl/linux/tools/lkl'
Makefile:78: *** Unrecognized platform: pe-x86-64. Stop.
make: Leaving directory '/e/Dev/GitHub/lkl/linux/tools/lkl'

With the 32 bit shell

$ make -C tools/lkl
make: Entering directory '/e/Dev/GitHub/lkl/linux/tools/lkl'
HOSTCC scripts/basic/fixdep
scripts/basic/fixdep.c:107:22: fatal error: sys/mman.h: No such file or directory
#include <sys/mman.h>
^
compilation terminated.
make[2]: *** [scripts/Makefile.host:107: scripts/basic/fixdep] Error 1
make[1]: *** [Makefile:448: scripts_basic] Error 2
make: *** [Makefile:133: /e/Dev/GitHub/lkl/linux/tools/lkl/lib/lkl.o] Error 2
make: Leaving directory '/e/Dev/GitHub/lkl/linux/tools/lkl'

@petrosagg
Copy link

@spoiledsport I tested on my machine and the build is definitely using the ld from tools/lkl/bin, I deleted the system wide one and it ran fine. I'm building using make -j4 CROSS_COMPILE=i686-w64-mingw32- -C tools/lkl on Arch linux.

If you didn't build binutils for MSYS2 from source or didn't put tools/lkl/bin in your path (using absolute paths) and used CROSS_COMPILE=i686-w64-mingw32- then you're probably using the wrong binaries.

I'm attaching the built dll for windows lkl-pe-i386.zip. It's .xz compressed in a zip because Github only allows zip files up to 10MB.

@petrosagg
Copy link

Regarding the Ming32 shell, I also never managed to make it work and was getting the same error.

@spoiledsport
Copy link
Author

Thanks for helping on this one. I was able to get my compile to work by removing the files in /usr/bin. I am able to build the dll
:-)

You have been very helpful. Is this dll 32 bit then? If there any way to create a 64 bit?

Once again, thanks for all your help. I really appreciate your sticking with me on this one.

@Rondom
Copy link

Rondom commented Jan 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants