Skip to content

"libtdclient.a: error adding symbols: file format not recognized" and "ld returned 1 exit status" #1244

@Mazuh

Description

@Mazuh

after #1241 (so there might be a few more evidences there, like the printed commands I used), I tried to run a few simple codes.

main.cpp:

#include <iostream>
#include <td/telegram/Client.h>
#include <td/telegram/td_api.h>
#include <td/telegram/td_api.hpp>

namespace td_api = td::td_api;

int main()
{
    td::Client::execute({0, td_api::make_object<td_api::setLogVerbosityLevel>(1)}); // if I remove this, everything works
    std::cout << "Hello World!" << std::endl;
    return 0;
}

(I tried to copy and paste the cpp example but the result is the same, any attempt to call the actual functions are bad, only the includes are working.)

and cmakelists.txt:

cmake_minimum_required(VERSION 3.10 FATAL_ERROR)

project("mysampleproject")

find_package(Td PATHS "../td/tdlib/" REQUIRED NO_DEFAULT_PATH)

add_executable("${PROJECT_NAME}" "src/main.cpp")

set_property(TARGET "${PROJECT_NAME}" PROPERTY CXX_STANDARD 14)

target_link_libraries("${PROJECT_NAME}" PRIVATE Td::TdStatic)
target_link_libraries("${PROJECT_NAME}" PRIVATE Td::TdJson)

then I get this error:

...
libtdclient.a: error adding symbols: file format not recognized

if I try to rebuild everything without Link Time Optimization:

...
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/mysampleproject.dir/build.make:96: mysampleproject] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/mysampleproject.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

I tried to compile using both master branch and v.1.6.0 tagged head, and erased build/ and tdlib/ before retrying.


does someone have any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions