GVKun编程网logo

error adding symbols: DSO missing from command line

15

如果您对erroraddingsymbols:DSOmissingfromcommandline感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于erroraddingsymb

如果您对error adding symbols: DSO missing from command line感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于error adding symbols: DSO missing from command line的详细内容,并且为您提供关于48-Command line is too long. Shorten command line for Test or also for、6 Accessing and Managing Symbols with armlink、Android studio 运行main方法报错 Error running ''XXXX'': Command line、Android TelecomManager中的addIncomingCall没有做任何事情的有价值信息。

本文目录一览:

error adding symbols: DSO missing from command line

error adding symbols: DSO missing from command line

最近做做项目的时候,在编译代码的时候遇到很多棘手的问题,网上的资料也比较少。关于上诉问题,我就是来说说看。

DSO missing from command line 原因及解决办法,我也是看了这篇文章的介绍,才对这个错误有写认识。

大概就是说,如果库 B 依赖了库 A 来静态编译,那么库 B 就会有库 A 的链接信息,那我们就来说说错误的情况

$ g++ main.cpp -lA -lB -o main  

会输出

/usr/bin/ld: /usr/local/lib/libB.a(main.cpp.o): undefined reference to symbol ''_a_symbol_name''
/usr/local/lib/libA.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

当时上文博主说过,在 binutils<2.22 的时候没有问题,后面就有问题了。

那这个应该是编译问题,ld 自动递归地解析链接的 lib,当加载 A 库的时候,一切还正常,但是加载 B 库的时候,ld 会自动的去解析他的静态链接,所以就重复了,导致 error adding symbols。所以下面这个就没有问题了。

$ g++ main.cpp -lB -lA -o main  

这样就编译正常了,程序也能够正常运行。

关于链接库的顺序问题,我看了下链接库的顺序问题一文,正常的情况下,链动态接库时是从左至右开始链接,如果出现了顺序错误,gcc 自动帮我们重定位,我认为保险的方式是做好库的顺序。

那我这里稍微整理了下链接顺序。

  1. 高层静态链接库

  2. 底层依赖库

  3. 高层动态链接库

  4. 其他无关系链接库





….fuck,fuck! 重写两次了,第一次断电能理解,第二次莫名其妙的关了次电脑,来吧,我们都是文明人,这只是个小插曲,我们继续。。。



48-Command line is too long. Shorten command line for Test or also for

48-Command line is too long. Shorten command line for Test or also for

Command line is too long. Shorten command line for Test or also for Application default configuration?

报错内容:
Error running ''ServiceStarter'': Command line is too long. Shorten command line for ServiceStarter or also for Application default configuration.

解决办法:
修改项目下 .idea\workspace.xml,找到标签 <component name="PropertiesComponent"> , 在标签里 <property name="dynamic.classpath" value="true" />

6 Accessing and Managing Symbols with armlink

6.4 Image$$ execution region symbols

The linker generates Image$$ symbols for every execution region present in the image.

The following table shows the symbols that the linker generates for every execution region present in the image. All the symbols refer to execution addresses after the C library is initialized.

Table 6-1 Image$$ execution region symbols

Symbol Description
Image$$region_name$$Base Execution address of the region.
Image$$region_name$$Length Execution region length in bytes excluding ZI length.
Image$$region_name$$Limit Address of the byte beyond the end of the non-ZI part of the execution region.
Image$$region_name$$RO$$Base Execution address of the RO output section in this region.
Image$$region_name$$RO$$Length Length of the RO output section in bytes.
Image$$region_name$$RO$$Limit Address of the byte beyond the end of the RO output section in the execution region.
Image$$region_name$$RW$$Base Execution address of the RW output section in this region.
Image$$region_name$$RW$$Length Length of the RW output section in bytes.
Image$$region_name$$RW$$Limit Address of the byte beyond the end of the RW output section in the execution region.
Image$$region_name$$XO$$Base Execution address of the XO output section in this region.
Image$$region_name$$XO$$Length Length of the XO output section in bytes.
Image$$region_name$$XO$$Limit Address of the byte beyond the end of the XO output section in the execution region.
Image$$region_name$$ZI$$Base Execution address of the ZI output section in this region.
Image$$region_name$$ZI$$Length Length of the ZI output section in bytes.
Image$$region_name$$ZI$$Limit Address of the byte beyond the end of the ZI output section in the execution region.

6.5 Load$$ execution region symbols

The linker generates Load$$ symbols for every execution region present in the image.

Note

Load$$region_name symbols apply only to execution regions. Load$$LR$$load_region_name symbols apply only to load regions.
The following table shows the symbols that the linker generates for every Load$$ execution region present in the image. All the symbols refer to load addresses after the C library is initialized.

Table 6-2 Load$$ execution region symbols

Symbol Description
Load$$region_name$$Base Load address of the region.
Load$$region_name$$Length Region length in bytes.
Load$$region_name$$Limit Address of the byte beyond the end of the execution region.
Load$$region_name$$RO$$Base Address of the RO output section in this execution region.
Load$$region_name$$RO$$Length Length of the RO output section in bytes.
Load$$region_name$$RO$$Limit Address of the byte beyond the end of the RO output section in the execution region.
Load$$region_name$$RW$$Base Address of the RW output section in this execution region.
Load$$region_name$$RW$$Length Length of the RW output section in bytes.
Load$$region_name$$RW$$Limit Address of the byte beyond the end of the RW output section in the execution region.
Load$$region_name$$XO$$Base Address of the XO output section in this execution region.
Load$$region_name$$XO$$Length Length of the XO output section in bytes.
Load$$region_name$$XO$$Limit Address of the byte beyond the end of the XO output section in the execution region.
Load$$region_name$$ZI$$Base Load address of the ZI output section in this execution region.
Load$$region_name$$ZI$$Length
Load length of the ZI output section in bytes.
The Load Length of ZI is zero unless region_name has the ZEROPAD scatter-loading keyword set. If ZEROPAD is set then:
Load Length = Image$$region_name$$ZI$$Length
Load$$region_name$$ZI$$Limit Load address of the byte beyond the end of the ZI output section in the execution region.
All symbols in this table refer to load addresses before the C library is initialized. Be aware of the following:
  • The symbols are absolute because section-relative symbols can only have execution addresses.
  • The symbols take into account RW compression.
  • References to linker-defined symbols from RW compressed execution regions must be to symbols that are resolvable before RW compression is applied.
  • If the linker detects a relocation from an RW-compressed region to a linker-defined symbol that depends on RW compression, then the linker disables compression for that region.
  • Any Zero Initialized data that is written to the file is taken into account by the Limit and Length values. Zero Initialized data is written into the file when the ZEROPAD scatter-loading keyword is used.

6.6 Load$$LR$$ load region symbols

The linker generates Load$$LR$$ symbols for every load region present in the image.

A Load$$LR$$ load region can contain many execution regions, so there are no separate $$RO and $$RW components.

Note

Load$$LR$$load_region_name symbols apply only to load regions. Load$$region_name symbols apply only to execution regions.
The following table shows the symbols that the linker generates for every Load$$LR$$ load region present in the image.

Table 6-3 Load$$LR$$ load region symbols

Symbol Description
Load$$LR$$load_region_name$$Base Address of the load region.
Load$$LR$$load_region_name$$Length Length of the load region.
Load$$LR$$load_region_name$$Limit Address of the byte beyond the end of the load region.

6.7 Region name values when not scatter-loading

When scatter-loading is not used when linking, the linker uses default region name values.

If you are not using scatter-loading, the linker uses region name values of:
  • ER_XO, for an execute-only execution region, if present.
  • ER_RO, for the read-only execution region.
  • ER_RW, for the read-write execution region.
  • ER_ZI, for the zero-initialized execution region.
You can insert these names into the following symbols to obtain the required address:
  • Image$$ execution region symbols.
  • Load$$ execution region symbols.
For example, Load$$ER_RO$$Base.

Note

  • The ZI output sections of an image are not created statically, but are automatically created dynamically at runtime. Therefore, there is no load address symbol for ZI output sections.
  • It is recommended that you use region-related symbols in preference to section-related symbols.

6.9 Methods of importing linker-defined symbols in C and C++

You can import linker-defined symbols into your C or C++ source code either by value or by reference.

Import by value
 
extern unsigned int symbol_name;
Import by reference
extern void *symbol_name;
If you declare a symbol as an int, then you must use the address-of operator ( &) to obtain the correct value as shown in these examples:
Importing a linker-defined symbol
extern unsigned int Image$$ZI$$Limit;
config.heap_base = (unsigned int) &Image$$ZI$$Limit;
Importing symbols that define a ZI output section
extern unsigned int Image$$ZI$$Length;
extern char Image$$ZI$$Base[];
memset(Image$$ZI$$Base,0,(unsigned int)&Image$$Length);

6.11 Section-related symbols

Section-related symbols are symbols generated by the linker when it creates an image without scatter-loading.

The linker generates the following types of section-related symbols:
  • Image symbols, if you do not use scatter-loading to create a simple image. A simple image has up to four output sections (XO, RO, RW, and ZI) that produce the corresponding execution regions.
  • Input section symbols, for every input section present in the image.
The linker sorts sections within an execution region first by attribute RO, RW, or ZI, then by name. So, for example, all .text sections are placed in one contiguous block. A contiguous block of sections with the same attribute and name is known as a consolidated section.

 

6.21 Steering file command summary

A summary of the commands you can use in a streering file.

The steering file commands are:

Table 6-6 Steering file command summary

Command Description
EXPORT Specifies that a symbol can be accessed by other shared objects or executables.
HIDE Makes defined global symbols in the symbol table anonymous.
IMPORT Specifies that a symbol is defined in a shared object at runtime.
RENAME Renames defined and undefined global symbol names.
REQUIRE Creates a DT_NEEDED tag in the dynamic array. DT_NEEDED tags specify dependencies to other shared objects used by the application, for example, a shared library.
RESOLVE Matches specific undefined references to a defined global symbol.
SHOW Makes global symbols visible. This command is useful if you want to make a specific symbol visible that is hidden using a HIDE command with a wildcard.

Note

The steering file commands control only global symbols. Local symbols are not affected by any of these commands.
 
 
 
 

Android studio 运行main方法报错 Error running ''XXXX'': Command line

Android studio 运行main方法报错 Error running ''XXXX'': Command line

Android studio 北极狐版本,里面建立测试类,运行main方法报错解决步骤:

解决方案:

在项目所在目录下找到.idea/gradle.xml文件,找到GradleProjectSettings标签,在下面添加:

<component name="GradleSettings">
  <option name="linkedExternalProjectsSettings">
    <GradleProjectSettings>
      <option name="delegatedBuild" value="false" /><!--添加这一句--> 
    </GradleProjectSettings>
  </option>
</component>

这时候运行还是报错:

Error running ''XXXX'': Command line is too long. Shorten command line for XXXXX or also for Application default configuration?

解决方案:

在项目所在目录下找到.idea/workspace.xml文件,找到PropertiesComponent标签,在下面添加:

<component name="PropertiesComponent">
  <property name="dynamic.classpath" value="true" /><!--添加这一句-->  
</component>

结束!

 

 

Android TelecomManager中的addIncomingCall没有做任何事情

Android TelecomManager中的addIncomingCall没有做任何事情

我正在尝试使用原生 Android来电UI.我有一个connectionService,我已成功注册了一个电话帐户.但是在我调用方法addNewIncomingCall之后什么也没发生.我缺少什么想法?

表现…

<service
    android:name=".MyConnectionService"
    android:label="example"
          android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE">
    <intent-filter>
        <action android:name="android.telecom.ConnectionService"/>
    </intent-filter>
</service>

活动…

TelecomManager tm = (TelecomManager) getSystemService(Context.TELECOM_SERVICE);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {

    PhoneAccountHandle phoneAccountHandle = new PhoneAccountHandle(
            new ComponentName(this.getApplicationContext(),MyConnectionService.class),"example");

    PhoneAccount phoneAccount = PhoneAccount.builder(phoneAccountHandle,"example").setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER).build();
    tm.registerPhoneAccount(phoneAccount);
    Bundle extras = new Bundle();
    Uri uri = Uri.fromParts(PhoneAccount.SCHEME_TEL,mNumber.getText().toString(),null);
    extras.putParcelable(TelecomManager.EXTRA_INCOMING_CALL_ADDRESS,uri);
    extras.putParcelable(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE,phoneAccountHandle);
    tm.addNewIncomingCall(phoneAccountHandle,extras);

}

MyConnectionService,我希望至少能看到onCreateIncomingConnection生成的Log中的内容

@RequiresApi(api = Build.VERSION_CODES.M)
 public class MyConnectionService extends ConnectionService {

 private static String TAG = "MyConnectionService";


public MyConnectionService() {
}


@Override
public Connection onCreateIncomingConnection(PhoneAccountHandle      connectionManagerPhoneAccount,ConnectionRequest request) {
Log.i(TAG,"onCreateIncomingConnection");
return    super.onCreateIncomingConnection(connectionManagerPhoneAccount,request);
}
}

解决方法

我将MyConnectionService重命名为MyService – 开始工作.奇怪的!

今天关于error adding symbols: DSO missing from command line的分享就到这里,希望大家有所收获,若想了解更多关于48-Command line is too long. Shorten command line for Test or also for、6 Accessing and Managing Symbols with armlink、Android studio 运行main方法报错 Error running ''XXXX'': Command line、Android TelecomManager中的addIncomingCall没有做任何事情等相关知识,可以在本站进行查询。

本文标签: