Code Monkey home page Code Monkey logo

Comments (13)

oomek avatar oomek commented on June 12, 2024

It was a problem with symlinks, apparently. I've removed libmdk.so.0 and recreated symlinks as follows:

libmdk.so -> libmdk.so.0
libmdk.so.0 -> libmdk.so.0.10.0.dsym

Please tell me if this is correct.

update:
renaming libmdk.so.0.10.0.dsym to libmdk.so.0
and linking libmdk.so -> libmdk.so.0
also works

from mdk-sdk.

wang-bin avatar wang-bin commented on June 12, 2024

which sdk do you use? it should be mdk-sdk-linux for rpi4. and what's you os arch? armhf or arm64?

dsym is debug symbol file. usually you don't need it. I use lld as linker, maybe some linker flags are not compatible with gnu ld. Please wait a few days because now i have no device to test.

from mdk-sdk.

oomek avatar oomek commented on June 12, 2024

Tried both, same thing happens. I can test for you anytime you leave a note.

from mdk-sdk.

oomek avatar oomek commented on June 12, 2024

It seems only dsym is not throwing errors. I use G++ linker standard ld, tried versions from 6 to 8

from mdk-sdk.

oomek avatar oomek commented on June 12, 2024

Armhf

from mdk-sdk.

oomek avatar oomek commented on June 12, 2024

This is weird: on PI4 the above relinking method works, but only for raspberry-pi binaries, for linux libraries (armhf) I get this after ldconfig:
/usr/local/lib/libmdk.so.0: symbolic link to lib.mdk.so and a message that object file has no dynamic section.

from mdk-sdk.

oomek avatar oomek commented on June 12, 2024

I found that the same error appears when you press F3 on libmdk.so.0 in Midnight Commabder

from mdk-sdk.

wang-bin avatar wang-bin commented on June 12, 2024

Can you try lld? What about old mdk binaries?

/usr/local/lib/libmdk.so.0: symbolic link to lib.mdk.so and a message that object file has no dynamic section.
If it's a warning, you can ignore it.

from mdk-sdk.

wang-bin avatar wang-bin commented on June 12, 2024

I find the same issue on stack overflow, but no answer. You can try the follow script on rpi to generate a stub so file for ld

build_stub_so(){
  cc -shared $1 -o $2 -Wl,-soname,$3
}

build_stub_so_1(){
  # --no-weak
  local so=$1
  local STUB_C=/tmp/${so##*\/}.c
  local STUB_SO=${so##*\/}
  local SYMS=/tmp/${so##*\/}.txt
  nm -gD --defined-only $so >$SYMS
  funcs=($(cat $SYMS |grep " T " |grep -vE 'T _fini|T _init' |awk '{print $3}' |uniq))
  funcs=(${funcs[@]/%/()\{\}})
  echo ${funcs[@]/#/void } >$STUB_C
  wfuncs=($(cat $SYMS |grep " W " |awk '{print $3}' |uniq))
  [[ ${#wfuncs} > 0 ]] && {
    wfuncs=(${wfuncs[@]/%/()\{\}})
    echo ${wfuncs[@]/#/void __attribute__((weak))} >>$STUB_C
  }
 
  #vars=($(cat $SYMS |grep " B " |grep -vE 'B _bss|B __bss_|B _end|B __end' |awk '{print $3}' |uniq))
  [[ ${#vars} > 0 ]] && {
    echo ${vars[@]/#/;int } >> $STUB_C
    echo ';' >> $STUB_C
  }
  soname=`objdump -x $so |grep SONAME  |awk '{print $2}'`
  build_stub_so $STUB_C $STUB_SO $soname
  rm $STUB_C
  rm $SYMS
}

build_stub_so_1 $1

Save it as build_stub.sh, and run ./build_stub.sh path_to_so_file, then the generated so can be used by linker when build your programs. The original libmdk.so.0 is used at runtime.

from mdk-sdk.

oomek avatar oomek commented on June 12, 2024

Can you try lld? What about old mdk binaries?

/usr/local/lib/libmdk.so.0: symbolic link to lib.mdk.so and a message that object file has no dynamic section.
If it's a warning, you can ignore it.

Tried lld. The invalid offset flood is gone, but got this instead:

ld.lld: warning: lld uses extended branch encoding, no object with architecture supporting feature detected.
ld.lld: warning: lld may use movt/movw, no object with architecture supporting feature detected.

But it compiles as before.

Which version should I try next? I can see in old folder max 0.4.1 version

Edit: I'm gonna try your script in a moment.

from mdk-sdk.

wang-bin avatar wang-bin commented on June 12, 2024

Confirmed on my rpi4. Don't know the reason yet. The warnings can be ignored.

The script works perfectly. Remove the old libmdk.so, run

rm mdk-sdk/lib/armhf/libmdk.so
./build_stub.sh mdk-sdk/lib/armhf/libmdk.so.0
mv libmdk.so.0 mdk-sdk/lib/armhf/libmdk.so

from mdk-sdk.

wang-bin avatar wang-bin commented on June 12, 2024

ld.lld: warning: lld uses extended branch encoding, no object with architecture supporting feature detected.
ld.lld: warning: lld may use movt/movw, no object with architecture supporting feature detected.

lld-8 or later is fine. I guess it's an lld bug.

from mdk-sdk.

oomek avatar oomek commented on June 12, 2024

Sorry for late reply. Your script works great with standard linker. The final so file is rather small though, but that's to be expected I believe.

from mdk-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.