Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
79 user(s) are online (62 user(s) are browsing Forums)

Members: 0
Guests: 79

more...

Headlines






Cmake and adtools
Just can't stay away
Joined:
2009/10/7 1:11
From Copenhagen
Posts: 1297
When configuring a minimal cmake project using an AmigaOS toolchain file, you get this:

Quote:

-- The CXX compiler identification is GNU 11.1.0
System is unknown to cmake, create:
Platform/AmigaOS to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Check for working C compiler: /opt/adtools/bin/ppc-amigaos-gcc
System is unknown to cmake, create: Platform/AmigaOS to use this system, please post your config file on discourse.cmake.org so it can be added to cmake CMake
Error: Generator: execution of make failed. Make command was: cmTC_7bd00/fast &&
-- Check for working C compiler: /opt/adtools/bin/ppc-amigaos-gcc
-- broken CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

"/opt/adtools/bin/ppc-amigaos-gcc"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /home/alfkil/cmake-mini/build/CMakeFiles/CMakeTmp

Run Build Command(s): cmTC_7bd00/fast && No such file or directory Generator: execution of make failed. Make command was: cmTC_7bd00/fast &&

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)

-- Configuring incomplete, errors occurred!
See also "/home/alfkil/cmake-mini/build/CMakeFiles/CMakeOutput.log".
See also "/home/alfkil/cmake-mini/build/CMakeFiles/CMakeError.log". a



Toolchain file:

Quote:

# this one is important
SET(CMAKE_SYSTEM_NAME AmigaOS)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)

# specify the cross compiler
SET(CMAKE_C_COMPILER ppc-amigaos-gcc)
SET(CMAKE_CXX_COMPILER ppc-amigaos-g++)
SET(CMAKE_MAKE_PROGRAM make)
SET(CMAKE_ASM_COMPILER ppc-amigaos-as)

#compiler flags
#SET(GCC_COVERAGE_COMPILE_FLAGS "-mcrt=newlib") #SET(GCC_COVERAGE_LINK_FLAGS "-mcrt=newlib")

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")

# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /opt/adtools)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# for libraries and headers in the target directories SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -athread=native")


Setup has been tested with adtools build of gcc 8 and 11. Both fail.

Is there any knowhow on how to make cmake work together with the Amiga compiler? Or maybe an idea for a patch...

According to a related google search the issue might be with escape characters and how they are handled by the compiler. Relating to my experiential memory of building cmake natively on AmigaOS, i'd say it's a likely explanation.


Edited by alfkil on 2021/8/26 15:41:23
   Report Go to top

Re: Cmake and adtools
Just popping in
Joined:
2017/1/3 6:03
From Atlanta GA
Posts: 81
@Afkil,

I have successfully cross compiled my working branch of LLVM with CMAKE.

Change this
SET(CMAKE_SYSTEM_NAME AmigaOS)

to this
SET(CMAKE_SYSTEM_NAME Generic)

I handled the flags this way.

SET(CMAKE_CXX_FLAGS_INIT, "-mcrt=clib2 -athread=native")
SET(CMAKE_C_FLAGS_INIT, "-mcrt=clib2")

I did not require setting as they all got picked up or set by CMAKE interrogating ppc-amigaos-gcc

SET(CMAKE_MAKE_PROGRAM make)
SET(CMAKE_ASM_COMPILER ppc-amigaos-as)

Originally I started with a toolchain file but was able to get it all working with just defines on configuration of the variables.

For C++ I am using the latest build due to need of fixes for std library. Your mileage may vary depending on what you are trying to build.

Here is invocation of CMAKE for LLVM

Quote:
cmake -DCMAKE_SYSTEM_NAME="Generic" \
-DCMAKE_SYSTEM_PROCESSOR="PowerPC" \
-DLLVM_HOST_TRIPLE="ppc-amigaos-unknown" \
-DCMAKE_C_COMPILER="/opt/adtools/bin/ppc-amigaos-gcc" \
-DCMAKE_CXX_COMPILER="/opt/adtools/bin/ppc-amigaos-g++" \
-DCROSS_TOOLCHAIN_FLAGS_NATIVE:STRING="-DCMAKE_C_COMPILER=gcc;-DCMAKE_CXX_COMPILER=g++" \
-DCMAKE_CXX_FLAGS_INIT="-mcrt=clib2 -athread=native" -DCMAKE_C_FLAGS_INIT="-mcrt=clib2" -DUNIX=1 \
-DCMAKE_INSTALL_PREFIX="/opt/adtools/llvm" \
-DLLVM_DEFAULT_TARGET_TRIPLE="ppc-amigaos-unknown" \
-DLLVM_TARGET_ARCH="PowerPC" \
-DLLVM_TARGETS_TO_BUILD="PowerPC" \
-DLLVM_ENABLE_THREADS=OFF \
-DLLVM_BUILD_EXAMPLES=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DCMAKE_BUILD_TYPE="Release" \
/home/dstastny/projects/repos/llvm-project/llvm-project/llvm



Regards
Doug



   Report Go to top

Re: Cmake and adtools
Just can't stay away
Joined:
2009/10/7 1:11
From Copenhagen
Posts: 1297
@DStastny

Quote:
cmake -DCMAKE_SYSTEM_NAME="Generic"\
-DCMAKE_SYSTEM_PROCESSOR="PowerPC" \
-DCMAKE_C_COMPILER="ppc-amigaos-gcc" \
-DCMAKE_CXX_COMPILER="ppc-amigaos-g++" \
-DCMAKE_ASM_COMPILER="ppc-amigaos-as" \
-DCMAKE_MAKE_PROGRAM="make" \
-DCMMAKE_CXX_FLAGS_INIT="-mcrt=clib2 -athread=native" \
-DCMAKE_C_FLAGS_INIT="-mcrt=clib2" \
-DUNIX=1 \
-DCMAKE_INSTALL_PREFIX="/qt5-amiga" \
-DQT_HOST_PATH="/usr/lib/x86_64-linux-gnu" ..


Thanks! I had a little progress. The minimal cmake now configures correctly. Problem now : I need -G Ninja, which makes the configuration fail with this output:

Quote:

-- The CXX compiler identification is GNU 11.1.0
-- The C compiler identification is GNU 11.1.0
-- The ASM compiler identification is GNU
-- Found assembler: /opt/adtools/bin/ppc-amigaos-as
-- Check for working CXX compiler: /opt/adtools/bin/ppc-amigaos-g++
CMake Error:
The detected version of Ninja (GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.) is less than the
version of Ninja required by CMake (1.3).

CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCXXCompiler.cmake:37 (try_compile):
Failed to generate test project build system.
Call Stack (most recent call first):
CMakeLists.txt:39 (project)


-- Configuring incomplete, errors occurred! See also "/home/alfkil/qt6-build/CMakeFiles/CMakeOutput.log".

   Report Go to top

Re: Cmake and adtools
Just popping in
Joined:
2017/1/3 6:03
From Atlanta GA
Posts: 81
@alfkil

Quote:
Thanks! I had a little progress. The minimal cmake now configures correctly. Problem now : I need -G Ninja, which makes the configuration fail with this output:


You should not need Ninja it should build a regular Unix makefile too.

I think its -G Unix

Now Ninja will definitely make it build faster...

But I would try to remove the option and get working first.

Regards
Doug

   Report Go to top

Re: Cmake and adtools
Just can't stay away
Joined:
2009/10/7 1:11
From Copenhagen
Posts: 1297
@DStastny

Quote:

cmake \
-DCMAKE_FIND_ROOT_PATH="/opt/adtools" \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-DCMAKE_SYSTEM_NAME="Generic" \
-DCMAKE_SYSTEM_PROCESSOR="PowerPC" \
-DCMAKE_C_COMPILER="ppc-amigaos-gcc" \
-DCMAKE_CXX_COMPILER="ppc-amigaos-g++" \
-DCMAKE_ASM_COMPILER="ppc-amigaos-as" \
-DCMAKE_MAKE_PROGRAM="make" \
-DCMAKE_CXX_FLAGS_INIT="-mcrt=newlib -athread=native" \
-DCMAKE_C_FLAGS_INIT="-mcrt=newlib" \
-DUNIX=1 -DAMIGA=1 \
-DCMAKE_INSTALL_PREFIX="/qt5-amiga" \
-DQT_HOST_PATH="/usr/local/Qt-6.2.0" \
-DQT_QMAKE_TARGET_MKSPEC=amiga-g++ \
-DQT_FEATURE_dlopen=OFF \
-DQT_FEATURE_thread=OFF \
-DQT_FEATURE_network=OFF \
-DQT_FEATURE_glib=OFF \
../amiga-qt6


Qt6 now configures completely except for OpenGLES2. Thanks! I will need to play around with that part a bit before progressing. I'd like to learn how GLES2 feels on Amiga before going on to implement stuff, that uses it. But nice to know, that configuring Qt6 is now as 'easy' as this :).


Edited by alfkil on 2021/8/26 18:28:37
Edited by alfkil on 2021/8/29 15:44:51
Edited by alfkil on 2021/8/29 15:59:19
Edited by alfkil on 2021/8/29 16:11:23
Edited by alfkil on 2021/8/29 17:16:28
Edited by alfkil on 2021/8/29 17:17:54
Edited by alfkil on 2021/8/30 12:14:07
Edited by alfkil on 2021/8/30 15:54:56
Edited by alfkil on 2021/9/2 19:59:59
Edited by alfkil on 2021/9/2 20:06:18
Edited by alfkil on 2021/10/15 17:39:19
   Report Go to top

Re: Cmake and adtools
Just popping in
Joined:
2017/1/3 6:03
From Atlanta GA
Posts: 81
@alfkil

That is awesome. I wont lie I spent many days working on LLVM build as it was my first time working with CMAKE. It can be finicky but it is super powerful and I like it better than the old config scripts. I was able to build LLVM without having to work on anything more than code issues not flaying about with the build system.

Look forward to playing with QT6

Regards
Doug



   Report Go to top

Re: Cmake and adtools
Just popping in
Joined:
2018/12/28 7:02
From Oulu, Finland
Posts: 42
@alfkil

Wow can't wait for Qt update :) I did play around with old 4.7 version, but Qt has progressed so much since that.

Keep up the work!

   Report Go to top

Re: Cmake and adtools
Just can't stay away
Joined:
2009/10/7 1:11
From Copenhagen
Posts: 1297
@Tohe

It's going to be a little while before we have a fully functional version.

At this point, here is one for the team. I get

Quote:
required dynamic symbol _ZTIN10_cxxabiv155_forcedunwindE missing


from the dynamic linker. I am using gcc 11 from sba1/adtools. Any guesses?

   Report Go to top

Re: Cmake and adtools
Just popping in
Joined:
7/23 21:46
From Älvsbyn, Sweden
Posts: 30
@alfkil

1) it doesn't seem to be Amigaos core releated
2) it doesn't seem to be windows related...
3) it might be apple related since they do deal with something called unwinding in the UI, there is a specific library called libunwind (IRC) on savannah.org.

[b]The libunwind project[/b]
[
center]The primary goal of this project is to define a portable and efficient C programming interface (APIto determine the call-chain of a programThe API additionally provides the means to manipulate the preserved (callee-savedstate of each call-frame and to resume execution at any point in the call-chain (non-local goto). The API supports both local (same-process) and remote (across-processoperation. As suchthe API is useful in a number of applicationsSome examples include:[/center]

[
b]exception handling[/b]
The libunwind API makes it trivial to implement the stack-manipulation aspects of exception handling.
debuggers
The libunwind API makes it trivial 
for debuggers to generate the call-chain (backtraceof the threads in a running program.

[
b]introspection[/b]
It is often useful for a running thread to determine its call-chain. For examplethis is useful to display error messages (to show how the error came about) and for performance monitoring/analysis.

[
b]efficient setjmp()[/b]
With libunwindit is possible to implement an extremely efficient version of setjmp(). Effectivelythe only context that needs to be saved consists of the stack-pointer(s).


so my answer is somehow either libunwind has been put as a dependency into Qt 6.1.2
or you have somthing that enables macintosh/iOS/tvOS code.

   Report Go to top

Re: Cmake and adtools
Just can't stay away
Joined:
2006/11/30 11:30
From Finland
Posts: 1805
@alfkil

Are you using the libstdc++.so that is built along with gcc 11, or are you using the one the one that is supplied with the OS (in SOBJS:)? If it's the latter then that is likely the reason for your problem.

IIRC the newer libstdc++.so is not backwards compatible so the best solution ATM is to bundle it with your program or not use shared objects if possible.

You may also need to update other compiler shared object files like libgcc.so. I'm not sure as I don't use shared objects much anymore.

   Report Go to top

Re: Cmake and adtools
Home away from home
Joined:
2006/11/26 21:45
From a dying planet
Posts: 4340
@salass00

It should become mandatory to always bundle the shared objects a project is built with.

There are so many different versions, even private builds, one can't keep track of them all.

Better to let the package grow than to receive bug reports about missing dependencies

m2c

_________________
People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
   Report Go to top

Re: Cmake and adtools
Just can't stay away
Joined:
2009/10/7 1:11
From Copenhagen
Posts: 1297
@salass00

I think, you are on the spot. I have not updated libstdc++. I have, however, changed my strategy towards the use of static linking as not only a rule og thumb but rather as an absolutte principle. Qt tries to avoid this, but in vain. ;)


Edited by alfkil on 2021/8/29 22:29:58
   Report Go to top

Re: Cmake and adtools
Just can't stay away
Joined:
2009/10/7 1:11
From Copenhagen
Posts: 1297
@Raziel

I think there is a deeper issue of shared objects being conceptully stray in comparison to the way they are implemented on amiga. It seems to give more problems that it solves, and often working on 100% static pays off in simplicity.

   Report Go to top

Re: Cmake and adtools
Just can't stay away
Joined:
2009/10/7 1:11
From Copenhagen
Posts: 1297
@trgswe

I doubt that the current build includes stuff from Mac OS. It is very tightly wound around generic Unix, and its autodetection of features seems to catch most stray functionalities. I deem it more likely that one shared objects was mismatching between host and target platforms.

   Report Go to top

Re: Cmake and adtools
Home away from home
Joined:
2006/11/26 21:45
From a dying planet
Posts: 4340
@alfkil

While that may be true to an extent it also limits the ability of building big projects natively.

ScummVM is hitting the 2GB RAM barrier on compiling the binary natively already and it will stay that way until there is a breach of that barrier (which may never come).

I switched to a shared build to still be able to provide native builds, as switching to cross compiles will be equal to quitting amiga completely for me.

I hope that whatever OS solution there will be in the *near* future will bring system-wide extmem support and 2+GB RAM support.

_________________
People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
   Report Go to top

Re: Cmake and adtools
Just popping in
Joined:
2017/1/3 6:03
From Atlanta GA
Posts: 81
@alfkil & @Raziel,

I just want to chime in on this about dynamic linking. I am with Raziel with this. For the size of executables we are now looking at static linking is almost to point of unusable with C++. Right now only viable option for C++ on AmigaOS is Clib2 statically linked.

For LLVM a Debug build is almost a 1.5 Gig and the Amiga Elf loader struggles runs executable two three times and memory is hosed.

Striped you are looking at minimum of 30+meg executable. The libStdc++ for Clib unstripped is almost 26megs. I would love to try to get Clang building but until a newer version of newlib becomes available that supports C++ 14 and the std namespace. I am not sure how much further I can go. And for LLVM there is no way to compile native. I had to reconfigure my Hyper-V to give at least 16 gigs of ram to my Linux instance to get LLVM cross to build.

Anyway just sharing some thoughts on dynamic vs static linking. Teach me to not just stick with C!

Regards
Doug

   Report Go to top

Re: Cmake and adtools
Just can't stay away
Joined:
2009/10/7 1:11
From Copenhagen
Posts: 1297
@DStastny

I of course understand, that there are cases, where dynamic linking is the only option. I was a little too quick on the trigger, but also my statement was more a reminder to myself, that it sometimes helps the advancement of intent to limit the number of unknown factors. I simply thought that on top of feeling a wee tad unfinished, the dynamic linking aspect also gives rise to potential problems such as lost symbols at shutdown, multiple possible linking objects, incongruent search paths etc. So it is very nice to work without this for the time being.

When all that is said, I am of course (of course.... ;) ) going to build Qt 6 with dynamic linking at some point to satisfy the requirement of having small (wee small) executables and also because of completeness. But before I get to that, I will like to first have a complete and congruent model for paths that might or might not preserve some built in unix aspects.

   Report Go to top





[Advanced Search]



Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project