Ticket #2915 (new defect)

Opened 6 years ago

Last modified 15 months ago

Cross-compilation: linking fail

Reported by: laborer Owned by:
Priority: major Milestone: Future Releases
Component: cross-compilation Version: 4.8.1.6
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

I got this error:

make[3]: Entering directory `/tmp/build/mc-4.8.1.6/src/filemanager'
  CC     libmcfilemanager_la-achown.lo
  CC     libmcfilemanager_la-boxes.lo
  CC     libmcfilemanager_la-chmod.lo
  CC     libmcfilemanager_la-chown.lo
  CC     libmcfilemanager_la-cmd.lo
  CC     libmcfilemanager_la-command.lo
  CC     libmcfilemanager_la-dir.lo
  CC     libmcfilemanager_la-ext.lo
  CC     libmcfilemanager_la-file.lo
  CC     libmcfilemanager_la-filegui.lo
  CC     libmcfilemanager_la-filenot.lo
  CC     libmcfilemanager_la-fileopctx.lo
  CC     libmcfilemanager_la-find.lo
  CC     libmcfilemanager_la-hotlist.lo
  CC     libmcfilemanager_la-info.lo
  CC     libmcfilemanager_la-layout.lo
  CC     libmcfilemanager_la-listmode.lo
  CC     libmcfilemanager_la-midnight.lo
  CC     libmcfilemanager_la-option.lo
  CC     libmcfilemanager_la-panelize.lo
  CC     libmcfilemanager_la-panel.lo
  CC     libmcfilemanager_la-tree.lo
  CC     libmcfilemanager_la-treestore.lo
  CC     libmcfilemanager_la-usermenu.lo
  CC     libmcfilemanager_la-mountlist.lo
mountlist.c: In function 'get_fs_usage':
mountlist.c:1444: error: 'fsd' undeclared (first use in this function)
mountlist.c:1444: error: (Each undeclared identifier is reported only once
mountlist.c:1444: error: for each function it appears in.)
mountlist.c:1301: warning: unused parameter 'file'

I am trying to crosscompile mc for arm x11-less linux. That system has glibc 2.10 and linux 2.6.22
I think that is important, because it seems that something goes wrong with preprocessor's defines.

PS
What a shame that current stable (for a long time) version can't be compiled. So far I use mc-4.7.5.6 and try to upgrade from previous stable to current.

Attachments

config.h (25.6 KB) - added by laborer 6 years ago.
Makefile (30.4 KB) - added by laborer 6 years ago.
mc-test.tar.bz2 (1.9 KB) - added by laborer 6 years ago.
How I build mc

Change History

comment:1 follow-up: ↓ 3 Changed 6 years ago by laborer

Here is piece from build log:

  Source code location:       .
Configuration:
  Compiler:                   arm-xscale-linux-gnueabi-gcc -L/tmp/build/ncurses-5.9/build/lib -std=gnu99
  Compiler flags:              -Wcomment -Wdeclaration-after-statement -Wfloat-equal -Wformat -Wformat-security -Wimplicit -Wignored-qualifiers -Wmissing-braces -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs -Wno-long-long -Wno-unreachable-code -Wparentheses -Wpointer-sign -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtype-limits -Wuninitialized -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings  -march=iwmmxt -mtune=iwmmxt -fno-non-call-exceptions -fno-unwind-tables -msoft-float -fno-exceptions -combine -O2
  File system:                Midnight Commander Virtual Filesystem
                              cpio, tar, sfs, extfs, ftp, fish
  Screen library:             Ncurses library
  Mouse support:              xterm only
  X11 events support:         no
  With subshell support:      yes
  With background operations: yes
  Internal editor:            yes
  Diff viewer:                yes
  Support for charset:        yes
  Search type:                glib-regexp

comment:2 in reply to: ↑ description ; follow-up: ↓ 4 Changed 6 years ago by andrew_b

Replying to laborer:

What a shame that current stable (for a long time) version can't be compiled.

What a shame that developers cannot compile mc for any platforms that are existing in the Universe!

So far I use mc-4.7.5.6 and try to upgrade from previous stable to current.

Try to compile 4.8.1-stable branch from repo. After #2906, compilation should be successful.

comment:3 in reply to: ↑ 1 Changed 6 years ago by andrew_b

Replying to laborer:

Here is piece from build log:

It is not interesting at all. config.h is interesting instead.

Changed 6 years ago by laborer

comment:4 in reply to: ↑ 2 Changed 6 years ago by laborer

Replying to andrew_b:

Try to compile 4.8.1-stable branch from repo. After #2906, compilation should be successful.

Ok. I will try.

Replying to andrew_b:

It is not interesting at all. config.h is interesting instead.

But nevertheless, here you are (see attached file).

Changed 6 years ago by laborer

comment:5 Changed 6 years ago by laborer

So, compilation was successful. But I got linking error.
For some reason glib was not picked up.

make[2]: Entering directory `/tmp/build/mc-4.8.1.6/src'
  CCLD   mc
args.o: In function `parse_mc_e_argument':
args.c:(.text+0x14): undefined reference to `g_strdup'
args.o: In function `parse_mc_v_argument':
args.c:(.text+0x44): undefined reference to `g_strdup'
args.o: In function `mc_setup_by_args':
args.c:(.text+0x128): undefined reference to `g_strdup'
args.c:(.text+0x1b8): undefined reference to `g_strdup'
args.c:(.text+0x1fc): undefined reference to `g_strdup'
args.c:(.text+0x250): undefined reference to `g_strndup'

and so on.
I pass GLIB_LIBS,GLIB_CFLAGS,GMODULE_CFLAGS,GMODULE_LIBS variables as parameters of configure script. They are present in Makefile. I see them. But they are not used! May be something important in linking mechanism changed since 4.7.5.6? Could you have a look at my Makefile please?

comment:6 Changed 6 years ago by slavazanko

CCLD mc

Please, provide to us output of the command 'make V=1'

comment:7 Changed 6 years ago by laborer

Here

make[3]: Entering directory `/tmp/build/mc-4.8.1.6/src'
/bin/bash ../libtool  --tag=CC   --mode=link arm-xscale-linux-gnueabi-gcc -L/tmp/build/ncurses-5.9/build/lib -std=gnu99 -I/tmp/build/glib-2.34.0/build/include/glib-2.0 -I..  -Wcomment -Wdeclaration-after-statement -Wfloat-equal -Wformat -Wformat-security -Wimplicit -Wignored-qualifiers -Wmissing-braces -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs -Wno-long-long -Wno-unreachable-code -Wparentheses -Wpointer-sign -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtype-limits -Wuninitialized -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings  -march=iwmmxt -mtune=iwmmxt -fno-non-call-exceptions -fno-unwind-tables -msoft-float -fno-exceptions -combine -O2  -s -o mc cons.handler.o args.o clipboard.o events_init.o execute.o help.o keybind-defaults.o learn.o main.o setup.o subshell.o textconf.o util.o selcodepage.o background.o vfs/libmc-vfs.la viewer/libmcviewer.la filemanager/libmcfilemanager.la diffviewer/libdiffviewer.la editor/libedit.la ../lib/libmc.la  
libtool: link: arm-xscale-linux-gnueabi-gcc -std=gnu99 -I/tmp/build/glib-2.34.0/build/include/glib-2.0 -I.. -Wcomment -Wdeclaration-after-statement -Wfloat-equal -Wformat -Wformat-security -Wimplicit -Wignored-qualifiers -Wmissing-braces -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs -Wno-long-long -Wno-unreachable-code -Wparentheses -Wpointer-sign -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtype-limits -Wuninitialized -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -march=iwmmxt -mtune=iwmmxt -fno-non-call-exceptions -fno-unwind-tables -msoft-float -fno-exceptions -combine -O2 -s -o mc cons.handler.o args.o clipboard.o events_init.o execute.o help.o keybind-defaults.o learn.o main.o setup.o subshell.o textconf.o util.o selcodepage.o background.o  -L/tmp/build/ncurses-5.9/build/lib vfs/.libs/libmc-vfs.a viewer/.libs/libmcviewer.a filemanager/.libs/libmcfilemanager.a diffviewer/.libs/libdiffviewer.a editor/.libs/libedit.a ../lib/.libs/libmc.a -lncurses
args.o: In function `parse_mc_e_argument':
args.c:(.text+0x14): undefined reference to `g_strdup'
args.o: In function `parse_mc_v_argument':
args.c:(.text+0x44): undefined reference to `g_strdup'
args.o: In function `mc_setup_by_args':

comment:8 Changed 6 years ago by slavazanko

-L/tmp/build/ncurses-5.9/build/lib
vfs/.libs/libmc-vfs.a
viewer/.libs/libmcviewer.a
filemanager/.libs/libmcfilemanager.a
diffviewer/.libs/libdiffviewer.a
editor/.libs/libedit.a
../lib/.libs/libmc.a -lncurses

Hm.. I don't see glib in list of libraries. Which cross-platform framework you use? buildroot? crosstool-ng? How you compile GLib library? Where library is placed? Provide more info about your cross-build environment, please. I'll try to reproduce.

Changed 6 years ago by laborer

How I build mc

comment:9 Changed 6 years ago by laborer

slavazanko,
I don't use buildroot or any other similiar framework. Buildroot was too buggy when I started. The other frameworks might be better but sometimes did not upgrade packages for a long time (for instance mc). So, I decided to build rootfs on my own. This means that I wrote several build scripts. I can control patches, compiler options, configure parameters and so on.
For compilation I use
arm-xscale-linux-gnueabi-gcc (crosstool-NG 1.12.0) 4.3.6
I think you can use any available arm crosscompiler.
For reproducing bug I have extracted from my build system some mc build related stuff.
So, there are 7 scripts: build.sh get.sh make_glib.sh make_libffi.sh make_mc.sh make_ncurses.sh make_zlib.sh

For starting build process just run ./build.sh from extracted archive. All required settings (version of each package, paths, common compilation options) are present in this file. I guess my code will tell you more than my words. Besides, keep in mind that there is no mc git support. You should clone required branch and pack it as release archive with name mc-4.8.1.6.tar.bz2

comment:10 Changed 6 years ago by andrew_b

  • Summary changed from Compilation error in mountlist.c to Cross-compilation: linking fail

comment:11 Changed 3 years ago by andrew_b

  • Milestone changed from 4.8 to Future Releases

comment:12 Changed 15 months ago by andrew_b

  • Component changed from mc-core to cross-compilation
Note: See TracTickets for help on using tickets.