lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Inchoate support for GNU/Linux builds with lmi makefiles


From: Greg Chicares
Subject: Re: [lmi] Inchoate support for GNU/Linux builds with lmi makefiles
Date: Thu, 15 Nov 2018 23:52:44 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0

On 2017-04-12 00:07, Greg Chicares wrote:
[ https://lists.nongnu.org/archive/html/lmi/2017-04/msg00015.html ]
> 
> /home/greg[0]$schroot --chroot=cross-lmi
> /home/greg[0]$unset LMI_HOST
> /home/greg[0]$cd /opt/lmi/src/lmi
> /opt/lmi/src/lmi[0]$make $coefficiency build_type=native CXXFLAGS='-O2 -ggdb 
> -m64 -Wno-pedantic' CFLAGS='-m64' LDFLAGS='-m64' unit_tests 
> unit_test_targets=bourn_cast_test

This updated command:

make $coefficiency build_type=native CXXFLAGS='-O2 -ggdb -m64 -fno-pie 
-Wno-pedantic -Wno-useless-cast' CFLAGS='-m64 -fno-pie' LDFLAGS='-m64 -no-pie' 
unit_tests cli_tests >../log 2>&1

adds '-Wno-useless-cast' to ignore a pervasive boost-1.33.1 problem,
and '-fno-pie' and '-no-pie' to prevent numerous diagnostics like:

relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a 
shared object; recompile with -fPIC

but perhaps $LDFLAGS needs to vary between $EXEEXT and $SHREXT,
because for '.so' targets I still get:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/crt1.o: 
in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

I also get:

/usr/bin/ld: skipping incompatible /opt/lmi/local/lib/liblzma.a when searching 
for -llzma

which is apparently just a nuisance stemming from
  $(shell xml2-config --libs)
in 'posix_fhs.make': it finds the 32-bit msw xml2-config instead of the
debian native one in /usr/bin/ , which was built without lzma support;
this happens even though I've installed a native liblzma-dev in my chroot.

Another related message from the past said:

  https://lists.nongnu.org/archive/html/lmi/2017-05/msg00034.html
| I put host-specific
| stuff in a directory called ${uname}-${uname -m} and I add a "-compiler"
| suffix when more than one ABI is used. So I can have directories like
| Linux-x86_64-clang, Linux-x86_64-gcc6 and even Linux-x86_64-suncc

which I reference here because it will be useful once I get this
thing to build.

And yet another related message from the past said:

  https://lists.nongnu.org/archive/html/lmi/2017-05/msg00018.html
| make $coefficiency build_type=native CXXFLAGS='-O2 -ggdb -m64 -fpic 
| -Wno-pedantic' CFLAGS='-m64 -fpic' LDFLAGS='-m64' cli_tests
|
| and everything built, but to run the tests I needed to do this:
|
| LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/opt/lmi/src/build/lmi/Linux/gcc/native'

but, if I obliterate the build directory:

rm -rf ../build/lmi/Linux/gcc/native

and set $LD_LIBRARY_PATH :

echo $LD_LIBRARY_PATH

LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/opt/lmi/src/build/lmi/Linux/gcc/native'
echo $LD_LIBRARY_PATH
$LD_LIBRARY_PATH:/opt/lmi/src/build/lmi/Linux/gcc/native

and use '-fpic' as in that command instead of '-[f]no-pie' as above:

make $coefficiency build_type=native CXXFLAGS='-O2 -ggdb -m64 -fpic 
-Wno-pedantic -Wno-useless-cast' CFLAGS='-m64 -fpic' LDFLAGS='-m64' cli_tests 
>../log 2>&1

it still doesn't find those shared objects:

./antediluvian_cli: error while loading shared libraries: libantediluvian.so: 
cannot open shared object file: No such file or directory
make[2]: *** [/opt/lmi/src/lmi/workhorse.make:1324: cli_selftest] Error 127
Test sample.cns:
./lmi_cli_shared: error while loading shared libraries: liblmi.so: cannot open 
shared object file: No such file or directory

Hmmm...well, the command to set the library path:
  LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/opt/lmi/src/build/lmi/Linux/gcc/native'
seems questionable, so let's set it directly:

LD_LIBRARY_PATH="/opt/lmi/src/build/lmi/Linux/gcc/native"

and see what '.so' files are there:

ls $LD_LIBRARY_PATH/*.so
/opt/lmi/src/build/lmi/Linux/gcc/native/libantediluvian.so
/opt/lmi/src/build/lmi/Linux/gcc/native/liblmi.so

file $LD_LIBRARY_PATH/*.so 
/opt/lmi/src/build/lmi/Linux/gcc/native/libantediluvian.so: ELF 64-bit LSB pie 
executable, x86-64, version 1 (GNU/Linux), dynamically linked, 
BuildID[sha1]=d85637cfbae16dcb072b77d979d781d7420b3ff2, with debug_info, not 
stripped
/opt/lmi/src/build/lmi/Linux/gcc/native/liblmi.so:          ELF 64-bit LSB pie 
executable, x86-64, version 1 (GNU/Linux), dynamically linked, 
BuildID[sha1]=16f80742cbc0eac4fd2e7362e09159a57cf0633a, with debug_info, not 
stripped

but still I get (e.g.):

./lmi_cli_shared: error while loading shared libraries: liblmi.so: cannot open 
shared object file: No such file or directory

Vadim, do you see anything obviously wrong in my approach? I don't
really understand '-fpic' and '-f[no-]pie', so I'm trying to stumble
forward with what I can glean from this:

https://stackoverflow.com/questions/43367427/32-bit-absolute-addresses-no-longer-allowed-in-x86-64-linux/46493456#46493456



reply via email to

[Prev in Thread] Current Thread [Next in Thread]